Skip to content

Commit 2af957f

Browse files
committed
teleop connection fixed
Signed-off-by: Blanca <blancasoriaru@gmail.com>
1 parent 04bd261 commit 2af957f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

manager/libs/applications/compatibility/exercise_wrapper_ros2_teleop.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ def __init__(self, exercise_command, gui_command, teleop_command, update_callbac
2121
self.running = False
2222
self.linter = Lint()
2323
self.brain_ready_event = threading.Event()
24+
2425
# TODO: review hardcoded values
2526
process_ready, self.exercise_server = self._run_exercise_server(f"python3 {exercise_command}",
2627
f'{home_dir}/ws_code.log',
@@ -35,6 +36,7 @@ def __init__(self, exercise_command, gui_command, teleop_command, update_callbac
3536
else:
3637
self.exercise_server.kill()
3738
raise RuntimeError(f"Exercise {exercise_command} could not be run")
39+
3840

3941
process_ready, self.gui_server = self._run_exercise_server(f"python3 {gui_command}", f'{home_dir}/ws_gui.log',
4042
'websocket_gui=ready')
@@ -51,6 +53,16 @@ def __init__(self, exercise_command, gui_command, teleop_command, update_callbac
5153
# Websocket server for person teleoperator
5254
process_ready, self.teleop_server = self._run_exercise_server(f"python3 {teleop_command}", f'{home_dir}/ws_teleop.log',
5355
'websocket_teleop=ready')
56+
57+
if process_ready:
58+
LogManager.logger.info(f"Exercise gui {teleop_command} launched")
59+
time.sleep(1)
60+
self.teleop_connection = Client(
61+
'ws://127.0.0.1:7164', 'teleop', self.server_message)
62+
self.teleop_connection.start()
63+
else:
64+
self.teleop_server.kill()
65+
raise RuntimeError(f"Exercise GUI {teleop_command} could not be run")
5466

5567
self.running = True
5668

@@ -160,6 +172,7 @@ def terminate(self):
160172
self.running = False
161173
self.exercise_connection.stop()
162174
self.gui_connection.stop()
175+
self.teleop_connection.stop()
163176

164177
stop_process_and_children(self.exercise_server)
165178
stop_process_and_children(self.gui_server)

0 commit comments

Comments
 (0)