Skip to content

Commit

Permalink
Use different packages for launch and config packages in generate_dem…
Browse files Browse the repository at this point in the history
…o_launch (backport #2647) (#2650)

(cherry picked from commit 627e95a)

Co-authored-by: Forrest Rogers-Marcovitz <[email protected]>
Co-authored-by: Sebastian Jahr <[email protected]>
  • Loading branch information
3 people authored Mar 14, 2024
1 parent 360299c commit 44a2edb
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions moveit_configs_utils/moveit_configs_utils/launches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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(
Expand All @@ -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(
Expand All @@ -293,15 +298,15 @@ 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")
),
)
)

ld.add_action(
IncludeLaunchDescription(
PythonLaunchDescriptionSource(
str(moveit_config.package_path / "launch/move_group.launch.py")
str(launch_package_path / "launch/move_group.launch.py")
),
)
)
Expand All @@ -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")),
)
Expand All @@ -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")),
)
Expand All @@ -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")
),
)
)
Expand Down

0 comments on commit 44a2edb

Please sign in to comment.