File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ from src .manager .manager .launcher .launcher_interface import ILauncher
2+ from src .manager .manager .docker_thread .docker_thread import DockerThread
3+ import time
4+ import os
5+ import stat
6+
7+
8+ class LauncherTeleoperatorRos2 (ILauncher ):
9+ running = False
10+ threads = []
11+
12+ def run (self , callback ):
13+ DRI_PATH = os .path .join ("/dev/dri" , os .environ .get ("DRI_NAME" , "card0" ))
14+ ACCELERATION_ENABLED = self .check_device (DRI_PATH )
15+
16+ if (ACCELERATION_ENABLED ):
17+ teleop_cmd = f"export VGL_DISPLAY={ DRI_PATH } ; vglrun python3 /opt/jderobot/utils/model_teleoperator.py 0.0.0.0"
18+ else :
19+ teleop_cmd = f"python3 /opt/jderobot/utils/model_teleoperator.py 0.0.0.0"
20+
21+ teleop_thread = DockerThread (teleop_cmd )
22+ teleop_thread .start ()
23+ self .threads .append (teleop_thread )
24+
25+ self .running = True
26+
27+ def check_device (self , device_path ):
28+ try :
29+ return stat .S_ISCHR (os .lstat (device_path )[stat .ST_MODE ])
30+ except :
31+ return False
32+
33+ def is_running (self ):
34+ return self .running
35+
36+ def terminate (self ):
37+ for thread in self .threads :
38+ thread .terminate ()
39+ thread .join ()
40+ self .running = False
41+
42+ def died (self ):
43+ pass
You can’t perform that action at this time.
0 commit comments