Skip to content

Commit

Permalink
MoveitConfigsBuilderを使いつつ、rvizの設定ファイルを適切に設定する要修正
Browse files Browse the repository at this point in the history
  • Loading branch information
mizonon committed Nov 29, 2024
1 parent 3fdea40 commit 30b83f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
14 changes: 10 additions & 4 deletions crane_plus_examples/launch/demo.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,32 @@ def generate_launch_description():
description_loader.use_camera = LaunchConfiguration('use_camera')
description = description_loader.load()

rviz_config_file_move_group = get_package_share_directory(
'crane_plus_moveit_config'
) + '/config/moveit.rviz'
rviz_config_file_camera = get_package_share_directory(
'crane_plus_examples'
) + '/launch/camera_example.rviz'

move_group = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
get_package_share_directory('crane_plus_moveit_config'),
'/launch/run_move_group.launch.py']),
condition=UnlessCondition(LaunchConfiguration('use_camera')),
launch_arguments={
'loaded_description': description
'loaded_description': description,
'rviz_config': rviz_config_file_move_group
}.items()
)

rviz_config_file = get_package_share_directory(
'crane_plus_examples') + '/launch/camera_example.rviz'
move_group_camera = IncludeLaunchDescription(
PythonLaunchDescriptionSource([
get_package_share_directory('crane_plus_moveit_config'),
'/launch/run_move_group.launch.py']),
condition=IfCondition(LaunchConfiguration('use_camera')),
launch_arguments={
'loaded_description': description,
'rviz_config_file': rviz_config_file
'rviz_config': rviz_config_file_camera
}.items()
)

Expand Down
9 changes: 9 additions & 0 deletions crane_plus_moveit_config/launch/run_move_group.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node
from moveit_configs_utils import MoveItConfigsBuilder
from moveit_configs_utils.launches import generate_move_group_launch
from moveit_configs_utils.launches import generate_moveit_rviz_launch
Expand Down Expand Up @@ -51,6 +52,8 @@ def generate_launch_description():
description='Set the path to rviz configuration file.',
)
)

rviz_config = LaunchConfiguration('rviz_config')

moveit_config = (
MoveItConfigsBuilder('crane_plus')
Expand All @@ -74,6 +77,12 @@ def generate_launch_description():
ld.add_entity(generate_move_group_launch(moveit_config))

# RViz
rviz_entities = generate_moveit_rviz_launch(moveit_config).entities
for entity in rviz_entities:
if isinstance(entity, Node):
entity.cmd.extend(['--ros-args', '--params-file', rviz_config])
ld.add_entity(entity)

ld.add_entity(generate_moveit_rviz_launch(moveit_config))

# Static TF
Expand Down

0 comments on commit 30b83f4

Please sign in to comment.