From 6dba9c978ef5401dc915fdee15ba5628f2d237bd Mon Sep 17 00:00:00 2001 From: Vincenzo Di Pentima Date: Mon, 10 Jun 2024 12:20:25 +0000 Subject: [PATCH 1/3] Removed useless argument and added moveit_launch_file --- .../launch/ur_sim_moveit.launch.py | 28 ++++++------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/ur_simulation_gz/launch/ur_sim_moveit.launch.py b/ur_simulation_gz/launch/ur_sim_moveit.launch.py index 32de71e..7fb6e5f 100644 --- a/ur_simulation_gz/launch/ur_sim_moveit.launch.py +++ b/ur_simulation_gz/launch/ur_sim_moveit.launch.py @@ -44,8 +44,7 @@ def launch_setup(context, *args, **kwargs): controllers_file = LaunchConfiguration("controllers_file") description_package = LaunchConfiguration("description_package") description_file = LaunchConfiguration("description_file") - moveit_config_package = LaunchConfiguration("moveit_config_package") - moveit_config_file = LaunchConfiguration("moveit_config_file") + moveit_launch_file = LaunchConfiguration("moveit_launch_file") prefix = LaunchConfiguration("prefix") ur_control_launch = IncludeLaunchDescription( @@ -66,16 +65,10 @@ def launch_setup(context, *args, **kwargs): ur_moveit_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( - [FindPackageShare("ur_moveit_config"), "/launch", "/ur_moveit.launch.py"] + moveit_launch_file ), launch_arguments={ "ur_type": ur_type, - "safety_limits": safety_limits, - "description_package": description_package, - "description_file": description_file, - "moveit_config_package": moveit_config_package, - "moveit_config_file": moveit_config_file, - "prefix": prefix, "use_sim_time": "true", "launch_rviz": "true", }.items(), @@ -140,19 +133,16 @@ def generate_launch_description(): ) declared_arguments.append( DeclareLaunchArgument( - "moveit_config_package", - default_value="ur_moveit_config", - description="MoveIt config package with robot SRDF/XACRO files. Usually the argument " + "moveit_launch_file", + default_value=[ + FindPackageShare("ur_moveit_config"), + "/launch", + "/ur_moveit.launch.py", + ], + description="Absolute path for MoveIt launch file, part of a config package with robot SRDF/XACRO files. Usually the argument " "is not set, it enables use of a custom moveit config.", ) ) - declared_arguments.append( - DeclareLaunchArgument( - "moveit_config_file", - default_value="ur.srdf.xacro", - description="MoveIt SRDF/XACRO description file with the robot.", - ) - ) declared_arguments.append( DeclareLaunchArgument( "prefix", From 917c8ac4c5af15bd1e6ecdbfe064ad6ee23fe7ff Mon Sep 17 00:00:00 2001 From: Vincenzo Di Pentima Date: Mon, 10 Jun 2024 13:05:44 +0000 Subject: [PATCH 2/3] Fix formatting --- ur_simulation_gz/launch/ur_sim_moveit.launch.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ur_simulation_gz/launch/ur_sim_moveit.launch.py b/ur_simulation_gz/launch/ur_sim_moveit.launch.py index 7fb6e5f..a890479 100644 --- a/ur_simulation_gz/launch/ur_sim_moveit.launch.py +++ b/ur_simulation_gz/launch/ur_sim_moveit.launch.py @@ -64,9 +64,7 @@ def launch_setup(context, *args, **kwargs): ) ur_moveit_launch = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - moveit_launch_file - ), + PythonLaunchDescriptionSource(moveit_launch_file), launch_arguments={ "ur_type": ur_type, "use_sim_time": "true", From 32ddbf1519e27110a2890918b222997fa5d625cd Mon Sep 17 00:00:00 2001 From: Felix Exner Date: Tue, 11 Jun 2024 11:33:39 +0200 Subject: [PATCH 3/3] Use PathJoinSubstitution instead of concatenating paths by hand --- .../launch/ur_sim_moveit.launch.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ur_simulation_gz/launch/ur_sim_moveit.launch.py b/ur_simulation_gz/launch/ur_sim_moveit.launch.py index a890479..d3b1685 100644 --- a/ur_simulation_gz/launch/ur_sim_moveit.launch.py +++ b/ur_simulation_gz/launch/ur_sim_moveit.launch.py @@ -31,7 +31,7 @@ from launch import LaunchDescription from launch.actions import DeclareLaunchArgument, IncludeLaunchDescription, OpaqueFunction from launch.launch_description_sources import PythonLaunchDescriptionSource -from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution from launch_ros.substitutions import FindPackageShare @@ -49,7 +49,9 @@ def launch_setup(context, *args, **kwargs): ur_control_launch = IncludeLaunchDescription( PythonLaunchDescriptionSource( - [FindPackageShare("ur_simulation_gz"), "/launch", "/ur_sim_control.launch.py"] + PathJoinSubstitution( + [FindPackageShare("ur_simulation_gz"), "launch", "ur_sim_control.launch.py"] + ) ), launch_arguments={ "ur_type": ur_type, @@ -132,11 +134,13 @@ def generate_launch_description(): declared_arguments.append( DeclareLaunchArgument( "moveit_launch_file", - default_value=[ - FindPackageShare("ur_moveit_config"), - "/launch", - "/ur_moveit.launch.py", - ], + default_value=PathJoinSubstitution( + [ + FindPackageShare("ur_moveit_config"), + "launch", + "ur_moveit.launch.py", + ] + ), description="Absolute path for MoveIt launch file, part of a config package with robot SRDF/XACRO files. Usually the argument " "is not set, it enables use of a custom moveit config.", )