From 901e3a48bfe41cfb89380d6cb9c1115ed20c9967 Mon Sep 17 00:00:00 2001 From: "Felix Exner (fexner)" Date: Wed, 19 Jun 2024 14:32:09 +0200 Subject: [PATCH] Fix launching without a tf_prefix specified (#1029) * Make test without a tf_prefix actually not specify the tf_prefix to the launchfile * Revert "Remove tf_prefix from ur_control.launch.py (#1020)" tf_prefix is used as a substitution argument inside the controllers.yaml Therefore, it needs to be specified as an argument for the ur_conttrol.launch.py file --- ur_robot_driver/launch/ur_control.launch.py | 11 +++++++++ ur_robot_driver/test/test_common.py | 25 ++++++++++++--------- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ur_robot_driver/launch/ur_control.launch.py b/ur_robot_driver/launch/ur_control.launch.py index 7b108f20..461f1503 100644 --- a/ur_robot_driver/launch/ur_control.launch.py +++ b/ur_robot_driver/launch/ur_control.launch.py @@ -68,6 +68,8 @@ def launch_setup(): parameters=[ LaunchConfiguration("update_rate_config_file"), ParameterFile(controllers_file, allow_substs=True), + # We use the tf_prefix as substitution in there, so that's why we keep it as an + # argument for this launchfile ], output="screen", ) @@ -280,6 +282,15 @@ def generate_launch_description(): "publishes the description topic.", ) ) + declared_arguments.append( + DeclareLaunchArgument( + "tf_prefix", + default_value="", + description="tf_prefix of the joint names, useful for " + "multi-robot setup. If changed, also joint names in the controllers' configuration " + "have to be updated.", + ) + ) declared_arguments.append( DeclareLaunchArgument( "use_mock_hardware", diff --git a/ur_robot_driver/test/test_common.py b/ur_robot_driver/test/test_common.py index 435a20c3..4a0b2ad1 100644 --- a/ur_robot_driver/test/test_common.py +++ b/ur_robot_driver/test/test_common.py @@ -307,23 +307,26 @@ def generate_driver_test_description( ): ur_type = LaunchConfiguration("ur_type") + launch_arguments = { + "robot_ip": "192.168.56.101", + "ur_type": ur_type, + "launch_rviz": "false", + "controller_spawner_timeout": str(controller_spawner_timeout), + "initial_joint_controller": "scaled_joint_trajectory_controller", + "headless_mode": "true", + "launch_dashboard_client": "false", + "start_joint_controller": "false", + } + if tf_prefix: + launch_arguments["tf_prefix"] = tf_prefix + robot_driver = IncludeLaunchDescription( PythonLaunchDescriptionSource( PathJoinSubstitution( [FindPackageShare("ur_robot_driver"), "launch", "ur_control.launch.py"] ) ), - launch_arguments={ - "robot_ip": "192.168.56.101", - "ur_type": ur_type, - "launch_rviz": "false", - "controller_spawner_timeout": str(controller_spawner_timeout), - "initial_joint_controller": "scaled_joint_trajectory_controller", - "headless_mode": "true", - "launch_dashboard_client": "false", - "start_joint_controller": "false", - "tf_prefix": tf_prefix, - }.items(), + launch_arguments=launch_arguments.items(), ) wait_dashboard_server = ExecuteProcess( cmd=[