diff --git a/controller_manager/controller_manager/launch_utils.py b/controller_manager/controller_manager/launch_utils.py index e3ef28e928..f36ca38741 100644 --- a/controller_manager/controller_manager/launch_utils.py +++ b/controller_manager/controller_manager/launch_utils.py @@ -19,8 +19,13 @@ from launch_ros.actions import Node +<<<<<<< HEAD def generate_load_controller_launch_description( controller_name, controller_type=None, controller_params_file=None +======= +def generate_controllers_spawner_launch_description( + controller_names: list, controller_params_file=None, extra_spawner_args=[] +>>>>>>> 88441b0 (Improve launch utils to support the multiple controller names (#1782)) ): """ Generate launch description for loading a controller using spawner. @@ -31,6 +36,7 @@ def generate_load_controller_launch_description( Examples -------- +<<<<<<< HEAD # Assuming the controller type and controller parameters are known to the controller_manager generate_load_controller_launch_description('joint_state_broadcaster') @@ -38,6 +44,14 @@ def generate_load_controller_launch_description( generate_load_controller_launch_description( 'joint_state_broadcaster', controller_type='joint_state_broadcaster/JointStateBroadcaster', +======= + # Assuming the controller parameters are known to the controller_manager + generate_controllers_spawner_launch_description(['joint_state_broadcaster']) + + # Passing controller parameter file to load the controller (Controller type is retrieved from config file) + generate_controllers_spawner_launch_description( + ['joint_state_broadcaster'], +>>>>>>> 88441b0 (Improve launch utils to support the multiple controller names (#1782)) controller_params_file=os.path.join(get_package_share_directory('my_pkg'), 'config', 'controller_params.yaml') ) @@ -54,11 +68,13 @@ def generate_load_controller_launch_description( description="Wait until the node is interrupted and then unload controller", ) - spawner_arguments = [ - controller_name, - "--controller-manager", - LaunchConfiguration("controller_manager_name"), - ] + spawner_arguments = controller_names + spawner_arguments.extend( + [ + "--controller-manager", + LaunchConfiguration("controller_manager_name"), + ] + ) if controller_type: spawner_arguments += ["--controller-type", controller_type] @@ -94,3 +110,13 @@ def generate_load_controller_launch_description( spawner, ] ) + + +def generate_load_controller_launch_description( + controller_name: str, controller_params_file=None, extra_spawner_args=[] +): + return generate_controllers_spawner_launch_description( + controller_names=[controller_name], + controller_params_file=controller_params_file, + extra_spawner_args=extra_spawner_args, + )