From 59f1a080ab6a69cb196565c6d4c8fd186c367b8c Mon Sep 17 00:00:00 2001 From: Sai Kishor Kothakota Date: Sat, 27 Jul 2024 09:49:34 +0200 Subject: [PATCH] Add spawner namespacing and also add the missing --params-file path --- ...oller_manager_example_two_rrbots.launch.py | 22 +++++++++++++++---- .../bringup/launch/rrbot_base.launch.py | 8 ++++++- .../bringup/launch/rrbot_namespace.launch.py | 11 ++++++---- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/example_15/bringup/launch/multi_controller_manager_example_two_rrbots.launch.py b/example_15/bringup/launch/multi_controller_manager_example_two_rrbots.launch.py index b96e5426a..a35adc965 100644 --- a/example_15/bringup/launch/multi_controller_manager_example_two_rrbots.launch.py +++ b/example_15/bringup/launch/multi_controller_manager_example_two_rrbots.launch.py @@ -79,11 +79,18 @@ def generate_launch_description(): rrbot_1_position_trajectory_controller_spawner = Node( package="controller_manager", executable="spawner", + namespace="rrbot_1", arguments=[ "position_trajectory_controller", - "-c", - "/rrbot_1/controller_manager", "--inactive", + "--param-file", + PathJoinSubstitution( + [ + FindPackageShare("ros2_control_demo_example_15"), + "config", + "multi_controller_manager_rrbot_1_controllers.yaml", + ] + ), ], ) @@ -108,11 +115,18 @@ def generate_launch_description(): rrbot_2_position_trajectory_controller_spawner = Node( package="controller_manager", executable="spawner", + namespace="rrbot_2", arguments=[ "position_trajectory_controller", - "-c", - "/rrbot_2/controller_manager", "--inactive", + "--param-file", + PathJoinSubstitution( + [ + FindPackageShare("ros2_control_demo_example_15"), + "config", + "multi_controller_manager_rrbot_2_controllers.yaml", + ] + ), ], ) diff --git a/example_15/bringup/launch/rrbot_base.launch.py b/example_15/bringup/launch/rrbot_base.launch.py index 1de7e6900..1e75578bb 100644 --- a/example_15/bringup/launch/rrbot_base.launch.py +++ b/example_15/bringup/launch/rrbot_base.launch.py @@ -209,7 +209,13 @@ def generate_launch_description(): package="controller_manager", executable="spawner", namespace=namespace, - arguments=[robot_controller, "-c", controller_manager_name], + arguments=[ + robot_controller, + "-c", + controller_manager_name, + "--param-file", + robot_controllers, + ], ) # Delay rviz start after `joint_state_broadcaster` diff --git a/example_15/bringup/launch/rrbot_namespace.launch.py b/example_15/bringup/launch/rrbot_namespace.launch.py index 0cd59332b..dc96b1743 100644 --- a/example_15/bringup/launch/rrbot_namespace.launch.py +++ b/example_15/bringup/launch/rrbot_namespace.launch.py @@ -84,23 +84,26 @@ def generate_launch_description(): joint_state_broadcaster_spawner = Node( package="controller_manager", executable="spawner", - arguments=["joint_state_broadcaster", "-c", "/rrbot/controller_manager"], + namespace="rrbot", + arguments=["joint_state_broadcaster"], ) robot_forward_position_controller_spawner = Node( package="controller_manager", executable="spawner", - arguments=["forward_position_controller", "-c", "/rrbot/controller_manager"], + namespace="rrbot", + arguments=["forward_position_controller", "--param-file", robot_controllers], ) robot_position_trajectory_controller_spawner = Node( package="controller_manager", executable="spawner", + namespace="rrbot", arguments=[ "position_trajectory_controller", - "-c", - "/rrbot/controller_manager", "--inactive", + "--param-file", + robot_controllers, ], )