From bc66f18f63c6cc98056d0b114117540678c8619d Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Tue, 21 Apr 2026 19:44:28 +0200 Subject: [PATCH 01/10] Add changes --- .../manager/launcher/launcher_robot.py | 43 ++----------------- .../launcher/launcher_robot_ros2_api.py | 26 ++++++++++- 2 files changed, 28 insertions(+), 41 deletions(-) diff --git a/robotics_application_manager/manager/launcher/launcher_robot.py b/robotics_application_manager/manager/launcher/launcher_robot.py index 800cd97..8115cc2 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot.py +++ b/robotics_application_manager/manager/launcher/launcher_robot.py @@ -13,55 +13,20 @@ worlds = { "gazebo": { - "1": [ - { - "type": "module", - "module": "ros_api", - "parameters": [], - "launch_file": [], - } - ], "2": [ { - "type": "module", + "type": "gazebo", "module": "robot_ros2_api", "parameters": [], "launch_file": [], } ], }, - "drones": { - "1": [ - { - "type": "module", - "module": "drones", - "resource_folders": [], - "model_folders": [], - "plugin_folders": [], - "parameters": [], - "launch_file": [], - } - ], - "2": [ - { - "type": "module", - "module": "drones_ros2", - "resource_folders": [], - "model_folders": [], - "plugin_folders": [], - "parameters": [], - "launch_file": [], - } - ], - }, - "gzsimdrones": { + "gz": { "2": [ { - "type": "module", - "module": "drones_gzsim", - "resource_folders": [], - "model_folders": [], - "plugin_folders": [], + "type": "gz", + "module": "robot_ros2_api", "parameters": [], "launch_file": [], } diff --git a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py index eb25b48..5acc65e 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py +++ b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py @@ -9,8 +9,31 @@ ) from robotics_application_manager.manager.docker_thread import DockerThread import subprocess +import sys import logging +from robotics_application_manager import LogManager + + +def call_service(service, service_type, request_data="{}"): + command = f"ros2 service call {service} {service_type} '{request_data}'" + try: + p = subprocess.Popen( + [ + f"{command}", + ], + shell=True, + stdout=sys.stdout, + stderr=subprocess.STDOUT, + bufsize=1024, + universal_newlines=True, + ) + p.wait(10) + except: + p.kill() + + LogManager.logger.exception(f"Unable to complete call: {service}") + raise Exception(f"Unable to complete call: {service}") class LauncherRobotRos2Api(ILauncher): @@ -58,8 +81,7 @@ def terminate(self): universal_newlines=True, ) - kill_cmd = "pkill -9 " - cmd = kill_cmd + "bridg" + cmd = kill_cmd + "bridge" subprocess.call( cmd, shell=True, From 40886a3e6a1073ef47e51c5e3557df5c607aeeb8 Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Wed, 22 Apr 2026 23:43:34 +0200 Subject: [PATCH 02/10] Add tmp fix for reset --- .../manager/launcher/launcher_gzsim.py | 39 ++++++++++++++++--- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/robotics_application_manager/manager/launcher/launcher_gzsim.py b/robotics_application_manager/manager/launcher/launcher_gzsim.py index 261b19a..ea4cebf 100644 --- a/robotics_application_manager/manager/launcher/launcher_gzsim.py +++ b/robotics_application_manager/manager/launcher/launcher_gzsim.py @@ -13,6 +13,12 @@ from typing import List, Any from robotics_application_manager import LogManager +from gz.msgs10.world_control_pb2 import WorldControl +from gz.msgs10.world_reset_pb2 import WorldReset +from gz.msgs10.entity_pb2 import Entity +from gz.msgs10.boolean_pb2 import Boolean +from gz.transport13 import Node + def call_gzservice(service, reqtype, reptype, timeout, req): command = f"gz service -s {service} --reqtype {reqtype} --reptype {reptype} --timeout {timeout} --req '{req}'" @@ -108,6 +114,16 @@ def run(self, config_file, callback): gzclient_thread.start() self.threads.append(gzclient_thread) + node = Node() + + node.request( + f"/world/default/control", + WorldControl(pause=True), + WorldControl, + Boolean, + 1000, + ) + process_name = "gz sim" wait_for_process_to_start(process_name, timeout=60) @@ -157,13 +173,24 @@ def reset(self): "std_srvs/srv/Trigger", "{}", ) - call_gzservice( - "/world/default/control", - "gz.msgs.WorldControl", - "gz.msgs.Boolean", - "3000", - "reset: {all: true}", + node = Node() + + node.request( + f"/world/default/remove", + Entity(name="f1", type=Entity.MODEL), + Entity, + Boolean, + 1000, ) + + node.request( + f"/world/default/control", + WorldControl(pause=True, reset=WorldReset(all=True)), + WorldControl, + Boolean, + 1000, + ) + if is_ros_service_available("/drone0/controller/_reset"): call_service("/drone0/controller/_reset", "std_srvs/srv/Trigger", "{}") From 761c353b424d63529d59ec0a99f9738bf6b7055c Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Thu, 23 Apr 2026 10:01:41 +0200 Subject: [PATCH 03/10] Test working pose --- .../manager/launcher/launcher_gzsim.py | 10 ---------- .../manager/launcher/launcher_robot_ros2_api.py | 4 ++-- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/robotics_application_manager/manager/launcher/launcher_gzsim.py b/robotics_application_manager/manager/launcher/launcher_gzsim.py index ea4cebf..f7ff2fb 100644 --- a/robotics_application_manager/manager/launcher/launcher_gzsim.py +++ b/robotics_application_manager/manager/launcher/launcher_gzsim.py @@ -114,16 +114,6 @@ def run(self, config_file, callback): gzclient_thread.start() self.threads.append(gzclient_thread) - node = Node() - - node.request( - f"/world/default/control", - WorldControl(pause=True), - WorldControl, - Boolean, - 1000, - ) - process_name = "gz sim" wait_for_process_to_start(process_name, timeout=60) diff --git a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py index 5acc65e..0fc490c 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py +++ b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py @@ -56,9 +56,9 @@ def run(self, robot_pose, callback): ROBOT_POSE = f"ROBOT_X={robot_pose[0]} ROBOT_Y={robot_pose[1]} ROBOT_Z={robot_pose[2]} ROBOT_ROLL={robot_pose[3]} ROBOT_PITCH={robot_pose[4]} ROBOT_YAW={robot_pose[5]}" if ACCELERATION_ENABLED: - exercise_launch_cmd = f"export VGL_DISPLAY={DRI_PATH}; vglrun {ROBOT_POSE} ros2 launch {self.launch_file}" + exercise_launch_cmd = f"export VGL_DISPLAY={DRI_PATH}; vglrun ros2 launch {self.launch_file} x:={53.462} y:={-10.734} z:={0.004} R:={0} P:={0} Y:={-1.57}" else: - exercise_launch_cmd = f"{ROBOT_POSE} ros2 launch {self.launch_file}" + exercise_launch_cmd = f"ros2 launch {self.launch_file} x:={53.462} y:={-10.734} z:={0.004} R:={0} P:={0} Y:={-1.57}" exercise_launch_thread = DockerThread(exercise_launch_cmd) exercise_launch_thread.start() From ceb83189db7b36711ff79858745112979171a0a9 Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Fri, 24 Apr 2026 10:49:01 +0200 Subject: [PATCH 04/10] Add robot entity and additional config --- .../manager/launcher/launcher_console.py | 2 +- .../manager/launcher/launcher_gazebo.py | 8 ++--- .../manager/launcher/launcher_gzsim.py | 17 +++++----- .../manager/launcher/launcher_o3de.py | 2 +- .../manager/launcher/launcher_robot.py | 12 ++++--- .../launcher/launcher_robot_ros2_api.py | 8 ++--- .../manager/launcher/launcher_rviz.py | 2 +- .../launcher/launcher_state_monitor.py | 2 +- .../manager/launcher/launcher_tools.py | 4 +-- .../manager/launcher/launcher_web_gui.py | 2 +- .../manager/manager.py | 32 +++++++++---------- 11 files changed, 48 insertions(+), 43 deletions(-) diff --git a/robotics_application_manager/manager/launcher/launcher_console.py b/robotics_application_manager/manager/launcher/launcher_console.py index af94190..fbbf1fc 100644 --- a/robotics_application_manager/manager/launcher/launcher_console.py +++ b/robotics_application_manager/manager/launcher/launcher_console.py @@ -45,7 +45,7 @@ def pause(self): def unpause(self): pass - def reset(self): + def reset(self, robot_entity=None): pass def is_running(self): diff --git a/robotics_application_manager/manager/launcher/launcher_gazebo.py b/robotics_application_manager/manager/launcher/launcher_gazebo.py index 3f81a1f..d85d424 100644 --- a/robotics_application_manager/manager/launcher/launcher_gazebo.py +++ b/robotics_application_manager/manager/launcher/launcher_gazebo.py @@ -1,9 +1,9 @@ """ Gazebo Classic Launcher and Lifecycle Manager. -Handles the initialization, state management, and cleanup of the -Gazebo GUI client (gzclient). Orchestrates display routing via -VNC and provides hardware-accelerated rendering through VirtualGL +Handles the initialization, state management, and cleanup of the +Gazebo GUI client (gzclient). Orchestrates display routing via +VNC and provides hardware-accelerated rendering through VirtualGL when compatible DRI devices are detected. """ @@ -106,7 +106,7 @@ def unpause(self): """Resumes the physics engine via the /unpause_physics ROS 2 service.""" call_service("/unpause_physics", "std_srvs/srv/Empty") - def reset(self): + def reset(self, robot_entity=None): call_service("/reset_world", "std_srvs/srv/Empty") def is_running(self): diff --git a/robotics_application_manager/manager/launcher/launcher_gzsim.py b/robotics_application_manager/manager/launcher/launcher_gzsim.py index f7ff2fb..4f03395 100644 --- a/robotics_application_manager/manager/launcher/launcher_gzsim.py +++ b/robotics_application_manager/manager/launcher/launcher_gzsim.py @@ -156,7 +156,7 @@ def unpause(self): "pause: false", ) - def reset(self): + def reset(self, robot_entity=None): if is_ros_service_available("/drone0/platform/state_machine/_reset"): call_service( "/drone0/platform/state_machine/_reset", @@ -165,13 +165,14 @@ def reset(self): ) node = Node() - node.request( - f"/world/default/remove", - Entity(name="f1", type=Entity.MODEL), - Entity, - Boolean, - 1000, - ) + if robot_entity is not None: + node.request( + f"/world/default/remove", + Entity(name=robot_entity, type=Entity.MODEL), + Entity, + Boolean, + 1000, + ) node.request( f"/world/default/control", diff --git a/robotics_application_manager/manager/launcher/launcher_o3de.py b/robotics_application_manager/manager/launcher/launcher_o3de.py index 0bb9af1..289c148 100644 --- a/robotics_application_manager/manager/launcher/launcher_o3de.py +++ b/robotics_application_manager/manager/launcher/launcher_o3de.py @@ -50,7 +50,7 @@ def unpause(self): self.running = True pass - def reset(self): + def reset(self, robot_entity=None): # TODO: add reset pass diff --git a/robotics_application_manager/manager/launcher/launcher_robot.py b/robotics_application_manager/manager/launcher/launcher_robot.py index 8115cc2..20932ae 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot.py +++ b/robotics_application_manager/manager/launcher/launcher_robot.py @@ -46,13 +46,17 @@ class LauncherRobot(BaseModel): launchers: Optional[ILauncher] = [] start_pose: Optional[list] = [] - def run(self, start_pose=None): + def run(self, start_pose=None, extra_config=None): """Run the robot launcher with an optional start pose.""" if start_pose is not None: self.start_pose = start_pose + + if extra_config is None: + extra_config = "" + for module in worlds[self.type][str(self.ros_version)]: module["launch_file"] = self.launch_file_path - launcher = self.launch_module(module) + launcher = self.launch_module(module, extra_config) self.launchers.append(launcher) LogManager.logger.info(self.launchers) @@ -64,7 +68,7 @@ def terminate(self): launcher.terminate() self.launchers = [] - def launch_module(self, configuration): + def launch_module(self, configuration, extra_config=None): """Launch a robot module based on the provided configuration.""" def process_terminated(name, exit_code): @@ -82,7 +86,7 @@ def process_terminated(name, exit_code): launcher_class = get_class(launcher_module) launcher = launcher_class.from_config(launcher_class, configuration) - launcher.run(self.start_pose, process_terminated) + launcher.run(self.start_pose, extra_config, process_terminated) return launcher def launch_command(self, configuration): diff --git a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py index 0fc490c..a217910 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py +++ b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py @@ -42,7 +42,7 @@ class LauncherRobotRos2Api(ILauncher): launch_file: str threads: List[Any] = [] - def run(self, robot_pose, callback): + def run(self, robot_pose, extra_config, callback): DRI_PATH = self.get_dri_path() ACCELERATION_ENABLED = self.check_device(DRI_PATH) @@ -53,12 +53,12 @@ def run(self, robot_pose, callback): xserver_thread.start() self.threads.append(xserver_thread) - ROBOT_POSE = f"ROBOT_X={robot_pose[0]} ROBOT_Y={robot_pose[1]} ROBOT_Z={robot_pose[2]} ROBOT_ROLL={robot_pose[3]} ROBOT_PITCH={robot_pose[4]} ROBOT_YAW={robot_pose[5]}" + x, y, z, R, P, Y = robot_pose if ACCELERATION_ENABLED: - exercise_launch_cmd = f"export VGL_DISPLAY={DRI_PATH}; vglrun ros2 launch {self.launch_file} x:={53.462} y:={-10.734} z:={0.004} R:={0} P:={0} Y:={-1.57}" + exercise_launch_cmd = f"export VGL_DISPLAY={DRI_PATH}; vglrun ros2 launch {self.launch_file} x:={x} y:={y} z:={z} R:={R} P:={P} Y:={Y} {extra_config}" else: - exercise_launch_cmd = f"ros2 launch {self.launch_file} x:={53.462} y:={-10.734} z:={0.004} R:={0} P:={0} Y:={-1.57}" + exercise_launch_cmd = f"ros2 launch {self.launch_file} x:={x} y:={y} z:={z} R:={R} P:={P} Y:={Y} {extra_config}" exercise_launch_thread = DockerThread(exercise_launch_cmd) exercise_launch_thread.start() diff --git a/robotics_application_manager/manager/launcher/launcher_rviz.py b/robotics_application_manager/manager/launcher/launcher_rviz.py index e066aa2..193957e 100644 --- a/robotics_application_manager/manager/launcher/launcher_rviz.py +++ b/robotics_application_manager/manager/launcher/launcher_rviz.py @@ -68,7 +68,7 @@ def pause(self): def unpause(self): pass - def reset(self): + def reset(self, robot_entity=None): pass def is_running(self): diff --git a/robotics_application_manager/manager/launcher/launcher_state_monitor.py b/robotics_application_manager/manager/launcher/launcher_state_monitor.py index 2785fb8..7b4767d 100644 --- a/robotics_application_manager/manager/launcher/launcher_state_monitor.py +++ b/robotics_application_manager/manager/launcher/launcher_state_monitor.py @@ -40,7 +40,7 @@ def pause(self): def unpause(self): pass - def reset(self): + def reset(self, robot_entity=None): pass def died(self): diff --git a/robotics_application_manager/manager/launcher/launcher_tools.py b/robotics_application_manager/manager/launcher/launcher_tools.py index 19242fb..c7f5e0b 100644 --- a/robotics_application_manager/manager/launcher/launcher_tools.py +++ b/robotics_application_manager/manager/launcher/launcher_tools.py @@ -131,9 +131,9 @@ def unpause(self): for launcher in self.launchers: launcher.unpause() - def reset(self): + def reset(self, robot_entity=None): for launcher in self.launchers: - launcher.reset() + launcher.reset(robot_entity) def pass_msg(self, data): for launcher in self.launchers: diff --git a/robotics_application_manager/manager/launcher/launcher_web_gui.py b/robotics_application_manager/manager/launcher/launcher_web_gui.py index 1e4f6db..a93e222 100644 --- a/robotics_application_manager/manager/launcher/launcher_web_gui.py +++ b/robotics_application_manager/manager/launcher/launcher_web_gui.py @@ -40,7 +40,7 @@ def pause(self): def unpause(self): pass - def reset(self): + def reset(self, robot_entity=None): pass def died(self): diff --git a/robotics_application_manager/manager/manager.py b/robotics_application_manager/manager/manager.py index 2e49bde..105faa4 100644 --- a/robotics_application_manager/manager/manager.py +++ b/robotics_application_manager/manager/manager.py @@ -225,6 +225,7 @@ def __init__(self, host: str, port: int): self.world_launcher = None self.world_type = None self.robot_launcher = None + self.robot_entity = None self.tools_launcher = None self.application_process = None self.running = True @@ -345,25 +346,24 @@ def on_launch_world(self, event): self.world_launcher = LauncherWorld(**cfg.model_dump()) LogManager.logger.info(str(self.world_launcher)) - self.world_launcher.run() - LogManager.logger.info("Launch transition finished") # Launch robot - try: - if robot_cfg["type"] == None: - self.robot_launcher = None - LogManager.logger.info("Launch transition finished") - return - cfg = ConfigurationManager.validate(robot_cfg) - LogManager.logger.info("Launching robot from the RB") + self.robot_launcher = None + if robot_cfg["type"] is not None: + try: + cfg = ConfigurationManager.validate(robot_cfg) + LogManager.logger.info("Launching robot from the RB") + LogManager.logger.info(cfg) + except ValueError as e: + LogManager.logger.error(f"Configuration validation failed: {e}") - LogManager.logger.info(cfg) - except ValueError as e: - LogManager.logger.error(f"Configuration validation failed: {e}") + self.robot_launcher = LauncherRobot(**cfg.model_dump()) + self.robot_entity = robot_cfg["entity"] + LogManager.logger.info(str(self.robot_launcher)) - self.robot_launcher = LauncherRobot(**cfg.model_dump()) - LogManager.logger.info(str(self.robot_launcher)) - self.robot_launcher.run(robot_cfg["start_pose"]) + self.world_launcher.run() + if self.robot_launcher is not None: + self.robot_launcher.run(robot_cfg["start_pose"]) LogManager.logger.info("Launch transition finished") def prepare_custom_universe(self, cfg_dict): @@ -995,7 +995,7 @@ def reset_sim(self): self.robot_launcher.terminate() try: - self.tools_launcher.reset() + self.tools_launcher.reset(self.robot_entity) except subprocess.TimeoutExpired as e: self.write_to_tool_terminal(f"{e}\n\n") raise Exception("Failed to reset simulator") From 266790f1b41a508d788b2f97f0650d41ba16d4cd Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Fri, 24 Apr 2026 19:03:44 +0200 Subject: [PATCH 05/10] Update params --- .../manager/launcher/launcher_robot_ros2_api.py | 1 + robotics_application_manager/manager/manager.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py index a217910..fc03e55 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py +++ b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py @@ -59,6 +59,7 @@ def run(self, robot_pose, extra_config, callback): exercise_launch_cmd = f"export VGL_DISPLAY={DRI_PATH}; vglrun ros2 launch {self.launch_file} x:={x} y:={y} z:={z} R:={R} P:={P} Y:={Y} {extra_config}" else: exercise_launch_cmd = f"ros2 launch {self.launch_file} x:={x} y:={y} z:={z} R:={R} P:={P} Y:={Y} {extra_config}" + print(extra_config) exercise_launch_thread = DockerThread(exercise_launch_cmd) exercise_launch_thread.start() diff --git a/robotics_application_manager/manager/manager.py b/robotics_application_manager/manager/manager.py index 105faa4..5d1d9a8 100644 --- a/robotics_application_manager/manager/manager.py +++ b/robotics_application_manager/manager/manager.py @@ -363,7 +363,7 @@ def on_launch_world(self, event): self.world_launcher.run() if self.robot_launcher is not None: - self.robot_launcher.run(robot_cfg["start_pose"]) + self.robot_launcher.run(robot_cfg["start_pose"], robot_cfg["extra_config"]) LogManager.logger.info("Launch transition finished") def prepare_custom_universe(self, cfg_dict): From fbbd864b00f439cf48ee2579f011d24eb14fee22 Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Fri, 24 Apr 2026 19:40:33 +0200 Subject: [PATCH 06/10] Remove trace --- .../manager/launcher/launcher_robot_ros2_api.py | 1 - 1 file changed, 1 deletion(-) diff --git a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py index fc03e55..a217910 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py +++ b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py @@ -59,7 +59,6 @@ def run(self, robot_pose, extra_config, callback): exercise_launch_cmd = f"export VGL_DISPLAY={DRI_PATH}; vglrun ros2 launch {self.launch_file} x:={x} y:={y} z:={z} R:={R} P:={P} Y:={Y} {extra_config}" else: exercise_launch_cmd = f"ros2 launch {self.launch_file} x:={x} y:={y} z:={z} R:={R} P:={P} Y:={Y} {extra_config}" - print(extra_config) exercise_launch_thread = DockerThread(exercise_launch_cmd) exercise_launch_thread.start() From 68d76ded2ce0a1f7d637d1c00946f37aeaf4e45d Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Wed, 29 Apr 2026 11:50:24 +0200 Subject: [PATCH 07/10] Fix robot reset --- robotics_application_manager/manager/manager.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/robotics_application_manager/manager/manager.py b/robotics_application_manager/manager/manager.py index 5d1d9a8..5a26cf0 100644 --- a/robotics_application_manager/manager/manager.py +++ b/robotics_application_manager/manager/manager.py @@ -225,7 +225,7 @@ def __init__(self, host: str, port: int): self.world_launcher = None self.world_type = None self.robot_launcher = None - self.robot_entity = None + self.robot_config = None self.tools_launcher = None self.application_process = None self.running = True @@ -358,7 +358,7 @@ def on_launch_world(self, event): LogManager.logger.error(f"Configuration validation failed: {e}") self.robot_launcher = LauncherRobot(**cfg.model_dump()) - self.robot_entity = robot_cfg["entity"] + self.robot_config = robot_cfg LogManager.logger.info(str(self.robot_launcher)) self.world_launcher.run() @@ -995,14 +995,16 @@ def reset_sim(self): self.robot_launcher.terminate() try: - self.tools_launcher.reset(self.robot_entity) + self.tools_launcher.reset(self.robot_config["entity"]) except subprocess.TimeoutExpired as e: self.write_to_tool_terminal(f"{e}\n\n") raise Exception("Failed to reset simulator") if self.robot_launcher: try: - self.robot_launcher.run() + self.robot_launcher.run( + self.robot_config["start_pose"], self.robot_config["extra_config"] + ) except Exception as e: LogManager.logger.exception("Exception terminating world launcher") From ea4c3a19ebd3e783db09ce066e2c4a77bdf63955 Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Mon, 4 May 2026 12:17:08 +0200 Subject: [PATCH 08/10] Add if statements --- .../manager/launcher/launcher_robot_ros2_api.py | 3 +++ robotics_application_manager/manager/manager.py | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py index a217910..0ef78ad 100644 --- a/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py +++ b/robotics_application_manager/manager/launcher/launcher_robot_ros2_api.py @@ -55,6 +55,9 @@ def run(self, robot_pose, extra_config, callback): x, y, z, R, P, Y = robot_pose + if extra_config == "None": + extra_config = "" + if ACCELERATION_ENABLED: exercise_launch_cmd = f"export VGL_DISPLAY={DRI_PATH}; vglrun ros2 launch {self.launch_file} x:={x} y:={y} z:={z} R:={R} P:={P} Y:={Y} {extra_config}" else: diff --git a/robotics_application_manager/manager/manager.py b/robotics_application_manager/manager/manager.py index 5a26cf0..0f89f31 100644 --- a/robotics_application_manager/manager/manager.py +++ b/robotics_application_manager/manager/manager.py @@ -995,7 +995,10 @@ def reset_sim(self): self.robot_launcher.terminate() try: - self.tools_launcher.reset(self.robot_config["entity"]) + entity = None + if self.robot_config is not None: + entity = self.robot_config["entity"] + self.tools_launcher.reset(entity) except subprocess.TimeoutExpired as e: self.write_to_tool_terminal(f"{e}\n\n") raise Exception("Failed to reset simulator") From 5860e4e963b8ebe6738f2267eb5dc2a8920f68a1 Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Wed, 27 May 2026 17:46:50 +0200 Subject: [PATCH 09/10] Linter --- .../manager/vnc/vnc_server.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/robotics_application_manager/manager/vnc/vnc_server.py b/robotics_application_manager/manager/vnc/vnc_server.py index 24129cb..da05946 100755 --- a/robotics_application_manager/manager/vnc/vnc_server.py +++ b/robotics_application_manager/manager/vnc/vnc_server.py @@ -177,16 +177,14 @@ def create_desktop_icon(self): os.makedirs(desktop_dir) desktop_path = os.path.join(desktop_dir, "terminal_launcher.desktop") with open(desktop_path, "w") as f: - f.write( - """[Desktop Entry] + f.write("""[Desktop Entry] Name=Open Terminal Exec=xterm Icon=utilities-terminal Type=Application Encoding=UTF-8 Terminal=false - Categories=None;""" - ) + Categories=None;""") os.chmod(desktop_path, 0o755) except Exception as err: print(err) @@ -200,16 +198,14 @@ def create_gzclient_icon(self): try: with open(desktop_path, "w") as f: - f.write( - """[Desktop Entry] + f.write("""[Desktop Entry] Name=Gazebo Client Exec=gzclient Icon=gazebo Type=Application Encoding=UTF-8 Terminal=false - Categories=None;""" - ) + Categories=None;""") os.chmod(desktop_path, 0o755) print("Icono de gzclient creado con éxito en el escritorio.") except Exception as e: From 865be8524d4d38c44de13e6298b5f9c2b008a729 Mon Sep 17 00:00:00 2001 From: Javier Izquierdo Hernandez Date: Wed, 27 May 2026 18:03:44 +0200 Subject: [PATCH 10/10] Update linter --- .github/workflows/python_lint.yaml | 56 +++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/.github/workflows/python_lint.yaml b/.github/workflows/python_lint.yaml index bb15826..07c867f 100644 --- a/.github/workflows/python_lint.yaml +++ b/.github/workflows/python_lint.yaml @@ -4,31 +4,31 @@ name: Python Linting on: [push] jobs: - black-lint: - runs-on: ubuntu-latest - name: Python black Lint - steps: - - uses: actions/checkout@v4 - - uses: psf/black@stable - with: - version: "22.3.0" - # flake8-lint: - # runs-on: ubuntu-latest - # name: Python flake8 Lint - # steps: - # - name: Check out source repository - # uses: actions/checkout@v3 - - # - name: Set up Python environment - # uses: actions/setup-python@v4 - # with: - # python-version: "3.11" - - # - name: flake8 Lint - # uses: py-actions/flake8@v2 - # with: - # ignore: "E701,W503,E203" - # exclude: "docs,.idea" - # max-line-length: "88" - # path: "." - # plugins: "flake8-docstrings flake8-black" \ No newline at end of file + black-lint: + runs-on: ubuntu-latest + name: Python black Lint + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable + with: + version: "26.5.1" + # flake8-lint: + # runs-on: ubuntu-latest + # name: Python flake8 Lint + # steps: + # - name: Check out source repository + # uses: actions/checkout@v3 + + # - name: Set up Python environment + # uses: actions/setup-python@v4 + # with: + # python-version: "3.11" + + # - name: flake8 Lint + # uses: py-actions/flake8@v2 + # with: + # ignore: "E701,W503,E203" + # exclude: "docs,.idea" + # max-line-length: "88" + # path: "." + # plugins: "flake8-docstrings flake8-black"