From cfd0f8c74ded9efdcb35410135d0a1da1727dcff Mon Sep 17 00:00:00 2001 From: Aarav Gupta Date: Fri, 22 Nov 2024 01:38:30 +0530 Subject: [PATCH 1/2] Fix use_respawn argument causing errors (#651) Signed-off-by: Aarav Gupta --- ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py b/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py index 4cbee322..bcebee0c 100644 --- a/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py +++ b/ros_gz_bridge/ros_gz_bridge/actions/ros_gz_bridge.py @@ -175,6 +175,9 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]: if isinstance(self.__create_own_container, list): self.__create_own_container = self.__create_own_container[0] + if isinstance(self.__use_respawn, list): + self.__use_respawn = self.__use_respawn[0] + # Standard node configuration load_nodes = GroupAction( condition=IfCondition(PythonExpression(['not ', self.__use_composition])), @@ -185,7 +188,7 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]: name=self.__bridge_name, namespace=self.__namespace, output='screen', - respawn=self.__use_respawn, + respawn=bool(self.__use_respawn), respawn_delay=2.0, parameters=[{'config_file': self.__config_file, **parsed_bridge_params}], arguments=['--ros-args', '--log-level', self.__log_level], From 5c1251a658ad8dd276664c2c88300d27572e25da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Ag=C3=BCero?= Date: Fri, 22 Nov 2024 09:51:28 +0100 Subject: [PATCH 2/2] Use member variables instead. (#653) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Carlos Agüero --- ros_gz_sim/ros_gz_sim/actions/gzserver.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/ros_gz_sim/ros_gz_sim/actions/gzserver.py b/ros_gz_sim/ros_gz_sim/actions/gzserver.py index 12d288f4..2665ea4d 100644 --- a/ros_gz_sim/ros_gz_sim/actions/gzserver.py +++ b/ros_gz_sim/ros_gz_sim/actions/gzserver.py @@ -23,7 +23,7 @@ from launch.frontend import Entity, expose_action, Parser from launch.launch_context import LaunchContext from launch.some_substitutions_type import SomeSubstitutionsType -from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.substitutions import PythonExpression from launch_ros.actions import ComposableNodeContainer, LoadComposableNodes, Node from launch_ros.descriptions import ComposableNode @@ -125,8 +125,8 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]: package='ros_gz_sim', executable='gzserver', output='screen', - parameters=[{'world_sdf_file': LaunchConfiguration('world_sdf_file'), - 'world_sdf_string': LaunchConfiguration('world_sdf_string')}], + parameters=[{'world_sdf_file': self.__world_sdf_file, + 'world_sdf_string': self.__world_sdf_string}], ), ], ) @@ -145,8 +145,8 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]: package='ros_gz_sim', plugin='ros_gz_sim::GzServer', name='gz_server', - parameters=[{'world_sdf_file': LaunchConfiguration('world_sdf_file'), - 'world_sdf_string': LaunchConfiguration('world_sdf_string')}], + parameters=[{'world_sdf_file': self.__world_sdf_file, + 'world_sdf_string': self.__world_sdf_string}], extra_arguments=[{'use_intra_process_comms': True}], ), ], @@ -166,8 +166,8 @@ def execute(self, context: LaunchContext) -> Optional[List[Action]]: package='ros_gz_sim', plugin='ros_gz_sim::GzServer', name='gz_server', - parameters=[{'world_sdf_file': LaunchConfiguration('world_sdf_file'), - 'world_sdf_string': LaunchConfiguration('world_sdf_string')}], + parameters=[{'world_sdf_file': self.__world_sdf_file, + 'world_sdf_string': self.__world_sdf_string}], extra_arguments=[{'use_intra_process_comms': True}], ), ],