From a14ed9300776631cdb3013ef352d279f201d2284 Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Wed, 31 Jan 2024 12:12:03 +0000 Subject: [PATCH] Reduce number of controller_spawners to 3 Since the controller_spawner supports a list of controllers since a while we can use this to reduce the number of total controllers. (cherry picked from commit 31993abdd5a22284adde08378668457c484e86eb) # Conflicts: # ur_robot_driver/launch/ur_control.launch.py --- ur_robot_driver/launch/ur_control.launch.py | 66 +++++++++++++++++---- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/ur_robot_driver/launch/ur_control.launch.py b/ur_robot_driver/launch/ur_control.launch.py index c7d572f56..633726492 100644 --- a/ur_robot_driver/launch/ur_control.launch.py +++ b/ur_robot_driver/launch/ur_control.launch.py @@ -36,7 +36,12 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, OpaqueFunction from launch.conditions import IfCondition, UnlessCondition -from launch.substitutions import Command, FindExecutable, LaunchConfiguration, PathJoinSubstitution +from launch.substitutions import ( + Command, + FindExecutable, + LaunchConfiguration, + PathJoinSubstitution, +) def launch_setup(context, *args, **kwargs): @@ -80,16 +85,35 @@ def launch_setup(context, *args, **kwargs): [FindPackageShare(description_package), "config", ur_type, "joint_limits.yaml"] ) kinematics_params = PathJoinSubstitution( - [FindPackageShare(description_package), "config", ur_type, "default_kinematics.yaml"] + [ + FindPackageShare(description_package), + "config", + ur_type, + "default_kinematics.yaml", + ] ) physical_params = PathJoinSubstitution( - [FindPackageShare(description_package), "config", ur_type, "physical_parameters.yaml"] + [ + FindPackageShare(description_package), + "config", + ur_type, + "physical_parameters.yaml", + ] ) visual_params = PathJoinSubstitution( - [FindPackageShare(description_package), "config", ur_type, "visual_parameters.yaml"] + [ + FindPackageShare(description_package), + "config", + ur_type, + "visual_parameters.yaml", + ] ) script_filename = PathJoinSubstitution( - [FindPackageShare("ur_client_library"), "resources", "external_control.urscript"] + [ + FindPackageShare("ur_client_library"), + "resources", + "external_control.urscript", + ] ) input_recipe_filename = PathJoinSubstitution( [FindPackageShare("ur_robot_driver"), "resources", "rtde_input_recipe.txt"] @@ -309,31 +333,31 @@ def launch_setup(context, *args, **kwargs): ) # Spawn controllers - def controller_spawner(name, active=True): + def controller_spawner(controllers, active=True): inactive_flags = ["--inactive"] if not active else [] return Node( package="controller_manager", executable="spawner", arguments=[ - name, "--controller-manager", "/controller_manager", "--controller-manager-timeout", controller_spawner_timeout, ] - + inactive_flags, + + inactive_flags + + controllers, ) - controller_spawner_names = [ + controllers_active = [ "joint_state_broadcaster", "io_and_status_controller", "speed_scaling_state_broadcaster", "force_torque_sensor_broadcaster", ] - controller_spawner_inactive_names = ["forward_position_controller"] + controllers_inactive = ["forward_position_controller"] - controller_spawners = [controller_spawner(name) for name in controller_spawner_names] + [ - controller_spawner(name, active=False) for name in controller_spawner_inactive_names + controller_spawners = [controller_spawner(controllers_active)] + [ + controller_spawner(controllers_inactive, active=False) ] # There may be other controllers of the joints, but this is the initially-started one @@ -386,7 +410,21 @@ def generate_launch_description(): DeclareLaunchArgument( "ur_type", description="Type/series of used UR robot.", +<<<<<<< HEAD choices=["ur3", "ur3e", "ur5", "ur5e", "ur10", "ur10e", "ur16e", "ur20"], +======= + choices=[ + "ur3", + "ur3e", + "ur5", + "ur5e", + "ur10", + "ur10e", + "ur16e", + "ur20", + "ur30", + ], +>>>>>>> 31993ab (Reduce number of controller_spawners to 3) ) ) declared_arguments.append( @@ -503,7 +541,9 @@ def generate_launch_description(): ) declared_arguments.append( DeclareLaunchArgument( - "launch_dashboard_client", default_value="true", description="Launch Dashboard Client?" + "launch_dashboard_client", + default_value="true", + description="Launch Dashboard Client?", ) ) declared_arguments.append(