From 44a2edbb39723527a142b33c4d5b75408a53b4a6 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Thu, 14 Mar 2024 14:45:03 +0100 Subject: [PATCH] Use different packages for launch and config packages in generate_demo_launch (backport #2647) (#2650) (cherry picked from commit 627e95ac347ce7b58145d522b2f60a8c6b876097) Co-authored-by: Forrest Rogers-Marcovitz <39061824+forrest-rm@users.noreply.github.com> Co-authored-by: Sebastian Jahr --- .../moveit_configs_utils/launches.py | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/moveit_configs_utils/moveit_configs_utils/launches.py b/moveit_configs_utils/moveit_configs_utils/launches.py index e8e588bd81..4985b2caab 100644 --- a/moveit_configs_utils/moveit_configs_utils/launches.py +++ b/moveit_configs_utils/moveit_configs_utils/launches.py @@ -249,10 +249,12 @@ def generate_move_group_launch(moveit_config): return ld -def generate_demo_launch(moveit_config): +def generate_demo_launch(moveit_config, launch_package_path=None): """ Launches a self contained demo + launch_package_path is optional to use different launch and config packages + Includes * static_virtual_joint_tfs * robot_state_publisher @@ -261,6 +263,9 @@ def generate_demo_launch(moveit_config): * warehouse_db (optional) * ros2_control_node + controller spawners """ + if launch_package_path == None: + launch_package_path = moveit_config.package_path + ld = LaunchDescription() ld.add_action( DeclareBooleanLaunchArg( @@ -277,11 +282,11 @@ def generate_demo_launch(moveit_config): ) ) ld.add_action(DeclareBooleanLaunchArg("use_rviz", default_value=True)) - # If there are virtual joints, broadcast static tf by including virtual_joints launch virtual_joints_launch = ( - moveit_config.package_path / "launch/static_virtual_joint_tfs.launch.py" + launch_package_path / "launch/static_virtual_joint_tfs.launch.py" ) + if virtual_joints_launch.exists(): ld.add_action( IncludeLaunchDescription( @@ -293,7 +298,7 @@ def generate_demo_launch(moveit_config): ld.add_action( IncludeLaunchDescription( PythonLaunchDescriptionSource( - str(moveit_config.package_path / "launch/rsp.launch.py") + str(launch_package_path / "launch/rsp.launch.py") ), ) ) @@ -301,7 +306,7 @@ def generate_demo_launch(moveit_config): ld.add_action( IncludeLaunchDescription( PythonLaunchDescriptionSource( - str(moveit_config.package_path / "launch/move_group.launch.py") + str(launch_package_path / "launch/move_group.launch.py") ), ) ) @@ -310,7 +315,7 @@ def generate_demo_launch(moveit_config): ld.add_action( IncludeLaunchDescription( PythonLaunchDescriptionSource( - str(moveit_config.package_path / "launch/moveit_rviz.launch.py") + str(launch_package_path / "launch/moveit_rviz.launch.py") ), condition=IfCondition(LaunchConfiguration("use_rviz")), ) @@ -320,7 +325,7 @@ def generate_demo_launch(moveit_config): ld.add_action( IncludeLaunchDescription( PythonLaunchDescriptionSource( - str(moveit_config.package_path / "launch/warehouse_db.launch.py") + str(launch_package_path / "launch/warehouse_db.launch.py") ), condition=IfCondition(LaunchConfiguration("db")), ) @@ -341,7 +346,7 @@ def generate_demo_launch(moveit_config): ld.add_action( IncludeLaunchDescription( PythonLaunchDescriptionSource( - str(moveit_config.package_path / "launch/spawn_controllers.launch.py") + str(launch_package_path / "launch/spawn_controllers.launch.py") ), ) )