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 (#2647)

* �[200~use differnt packages for launch and config packages

* add to function description
  • Loading branch information
forrest-rm authored Jan 12, 2024
1 parent 1fb4041 commit 627e95a
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 @@ -244,10 +244,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 @@ -256,6 +258,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 @@ -272,11 +277,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 @@ -288,15 +293,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 @@ -305,7 +310,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 @@ -315,7 +320,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 @@ -338,7 +343,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 627e95a

Please sign in to comment.