Hi Péter,
you indicated two points:
1st point: voxel_layer
mentioned in documentation but not added to the actual config file
In the documentation we mention that there exist several plugins to be applied to the global_costmap
:
- The
static_layer
- The
inflation_layer
- The
obstacle_layer
- The
voxel_layer
(this one is like the previous one but for 3D sensors that provide a pointcloud of distances measurements)
Hence, you can add to you configuration file whichever of those that you need for your specific application. In our example, we use only the first 3 plugins. We do not use the voxel_layer
because we do not have a pointcloud device on the robot, only a lidar
But you can use all of them at once if you have so many sensors. Actually, you can even have several
obstacle_layer
and several voxel_layer
at the same time if you have so many sensors in your robot.
Remember, though, that the words voxel_layer
or obstacle_layer
or inflation_layer
are just labels we decided to differentiate the config of each plugin. You can put any label to the plugin list, as long as the same name corresponds to the plugin configuration below.
Actually, if you have several lidars you will need to add each one with a different layer and hence, different configuration. One label for each device, one configuration for each device.
Example for a robot with 2 lidars and one pointcloud:
plugins: ["static_layer", "obstacle_layer1", "obstacle_layer2", "point_cloud_layer", "inflation_layer"]
obstacle_layer1:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /scan_1
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
obstacle_layer2:
plugin: "nav2_costmap_2d::ObstacleLayer"
enabled: True
observation_sources: scan
scan:
topic: /scan_2
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
point_cloud_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
footprint_clearing_enabled: true
max_obstacle_height: 2.0
publish_voxel_map: True
origin_z: 0.0
z_resolution: 0.05
z_voxels: 16
max_obstacle_height: 2.0
unknown_threshold: 15
mark_threshold: 0
observation_sources: pointcloud
combination_method: 1
pointcloud: # no frame set, uses frame from message
topic: /intel_realsense_r200_depth/points
max_obstacle_height: 2.0
min_obstacle_height: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
raytrace_max_range: 3.0
raytrace_min_range: 0.0
clearing: True
marking: True
data_type: "PointCloud2"
2nd point: in local_costmap
the static_layer
is added to the config but not used
You are right!
The config for the local_costmap
is as follows:
plugins: ["voxel_layer", "inflation_layer"]
inflation_layer:
plugin: "nav2_costmap_2d::InflationLayer"
cost_scaling_factor: 3.0
inflation_radius: 0.35
voxel_layer:
plugin: "nav2_costmap_2d::VoxelLayer"
enabled: True
publish_voxel_map: True
origin_z: 0.0
z_resolution: 0.05
z_voxels: 16
max_obstacle_height: 2.0
mark_threshold: 0
observation_sources: scan
scan:
topic: /scan
max_obstacle_height: 2.0
clearing: True
marking: True
data_type: "LaserScan"
raytrace_max_range: 3.0
raytrace_min_range: 0.0
obstacle_max_range: 2.5
obstacle_min_range: 0.0
static_layer:
map_subscribe_transient_local: True
At the end of the file, we are indicating the config parameters for the static_layer
but the plugins
list doesn’t include it. That means that the static_layer
is not actually used (only the parts included in the plugins
list are actually used for computing the costmap).
So we can get rid of the config part of static_layer
for the local_costmap