|
1 | 1 | import os |
2 | 2 | from launch import LaunchDescription |
3 | 3 | from launch.actions import DeclareLaunchArgument |
4 | | -from launch.substitutions import LaunchConfiguration |
| 4 | +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution |
5 | 5 | from launch.conditions import IfCondition, UnlessCondition |
| 6 | +import launch_ros |
6 | 7 | from launch_ros.actions import Node |
7 | 8 | from launch.actions import ExecuteProcess |
8 | 9 | from ament_index_python.packages import get_package_share_directory |
9 | 10 | from moveit_configs_utils import MoveItConfigsBuilder |
10 | 11 |
|
| 12 | +_PANDA_MOVEIT_CONFIG_RSC = "moveit_resources_panda_moveit_config" |
| 13 | + |
| 14 | +def _octomap_launch_params(): |
| 15 | + _path_panda_sensor_conf = PathJoinSubstitution( |
| 16 | + [ |
| 17 | + launch_ros.substitutions.FindPackageShare(_PANDA_MOVEIT_CONFIG_RSC), |
| 18 | + "config", |
| 19 | + "sensors_kinect_pointcloud.yaml" |
| 20 | + ]) |
| 21 | + _params = [ |
| 22 | + launch_ros.parameter_descriptions.ParameterFile( |
| 23 | + param_file=_path_panda_sensor_conf, |
| 24 | + allow_substs=True), |
| 25 | + {"octomap_frame": "odom_combined"}, |
| 26 | + {"octomap_resolution": "0.05"}, |
| 27 | + {"max_range": "5.0"}] |
| 28 | + return _params |
11 | 29 |
|
12 | 30 | def generate_launch_description(): |
13 | 31 |
|
@@ -49,14 +67,14 @@ def generate_launch_description(): |
49 | 67 | package="moveit_ros_move_group", |
50 | 68 | executable="move_group", |
51 | 69 | output="screen", |
52 | | - parameters=[moveit_config.to_dict()], |
| 70 | + parameters=[moveit_config.to_dict()] + _octomap_launch_params(), |
53 | 71 | arguments=["--ros-args", "--log-level", "info"], |
54 | 72 | ) |
55 | 73 |
|
56 | 74 | # RViz |
57 | 75 | tutorial_mode = LaunchConfiguration("rviz_tutorial") |
58 | 76 | rviz_base = os.path.join( |
59 | | - get_package_share_directory("moveit_resources_panda_moveit_config"), "launch" |
| 77 | + get_package_share_directory(_PANDA_MOVEIT_CONFIG_RSC), "launch" |
60 | 78 | ) |
61 | 79 | rviz_full_config = os.path.join(rviz_base, "moveit.rviz") |
62 | 80 | rviz_empty_config = os.path.join(rviz_base, "moveit_empty.rviz") |
|
0 commit comments