Skip to content

Commit

Permalink
declare_rviz_config追加
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuwamai committed Dec 20, 2024
1 parent d744e91 commit 9010b44
Showing 1 changed file with 31 additions and 23 deletions.
54 changes: 31 additions & 23 deletions crane_plus_gazebo/launch/crane_plus_with_table.launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,17 @@
import os

from ament_index_python.packages import get_package_share_directory
from crane_plus_description.robot_description_loader \
import RobotDescriptionLoader
from crane_plus_description.robot_description_loader import RobotDescriptionLoader
from launch import LaunchDescription
from launch.actions \
import DeclareLaunchArgument, ExecuteProcess, IncludeLaunchDescription
from launch.conditions import IfCondition, UnlessCondition
from launch.actions import DeclareLaunchArgument
from launch.actions import ExecuteProcess
from launch.actions import IncludeLaunchDescription
from launch.conditions import IfCondition
from launch.conditions import UnlessCondition
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch.substitutions import LaunchConfiguration
from launch_ros.actions import Node, SetParameter
from launch_ros.actions import Node
from launch_ros.actions import SetParameter


def generate_launch_description():
Expand All @@ -33,6 +35,24 @@ def generate_launch_description():
description='Use camera.'
)

declare_rviz_config = DeclareLaunchArgument(
'rviz_config',
default_value=get_package_share_directory(
'crane_plus_moveit_config'
) + '/config/moveit.rviz',
description='Set the path to rviz configuration file.',
condition=UnlessCondition(LaunchConfiguration('use_camera')),
)

declare_rviz_config_camera = DeclareLaunchArgument(
'rviz_config',
default_value=get_package_share_directory(
'crane_plus_examples'
) + '/launch/camera_example.rviz',
description='Set the path to rviz configuration file.',
condition=IfCondition(LaunchConfiguration('use_camera')),
)

declare_world_name = DeclareLaunchArgument(
'world_name',
default_value=os.path.join(
Expand Down Expand Up @@ -76,30 +96,17 @@ def generate_launch_description():
description_loader.use_camera = LaunchConfiguration('use_camera')
description_loader.use_gazebo = 'true'
description_loader.gz_control_config_package = 'crane_plus_control'
description_loader.gz_control_config_file_path = (
'config/crane_plus_controllers.yaml'
)
description_loader.gz_control_config_file_path = 'config/crane_plus_controllers.yaml'
description = description_loader.load()

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}.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
}.items()
'rviz_config': LaunchConfiguration('rviz_config')
}.items()
)

spawn_joint_state_controller = ExecuteProcess(
Expand Down Expand Up @@ -137,11 +144,12 @@ def generate_launch_description():
return LaunchDescription([
SetParameter(name='use_sim_time', value=True),
declare_use_camera,
declare_rviz_config,
declare_rviz_config_camera,
declare_world_name,
gz_gazebo,
gazebo_spawn_entity,
move_group,
move_group_camera,
spawn_joint_state_controller,
spawn_arm_controller,
spawn_gripper_controller,
Expand Down

0 comments on commit 9010b44

Please sign in to comment.