Unit 5 - global and local costmap settings - material issues

Hi,

In the material for the global costmap the plugins and settings do not match:

plugins: ["static_layer", "obstacle_layer", "inflation_layer"]

But there are settings for “voxel_layer” in section 5. however it is not added to “plugins”.

In the material for the local costmap the plugins and settings do not match:

plugins: ["voxel_layer", "inflation_layer"]

But static_layer is also added to the config. I think, that is not useful without adding it to the “plugins”

Can you make the configurations and plugins more cohesive?
I think, that can help for the learners.

Thank you in advance
Péter

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:

  1. The static_layer
  2. The inflation_layer
  3. The obstacle_layer
  4. 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

Hi @rtellez ,

Thank you for your answer.
So you said, that voxel_layer is only for 3d point cloud sensors.
Because Turtlebot3 probably does not have such a sensor, maybe it is a mistake to put it into the config file with the topic /scan, because that is a 2d laser scan sensor.

I am not sure, but this seems to me a bug in the material.
Maybe this is why my robot is trying to go through obstacles.

Thank you for your enlightening answer, but if you can, check the material please, if using the voxel_layer for turtlebot3 is ok or not.

Péter

Hi Peter,
the voxel_layer can use both a laser sensor or a pointcloud sensor as input for obstacle data. We are using it in the tutorial to show an example of voxel_layer with laser data, because in the global costmap we show an example of obstacle_layer (so you have in the same exercise two different ways of doing the same thing)

The point where you indicate to the voxel_laer which type of data to expect to populate the costmap is at the data_type: "LaserScan" parameter. If you are using a point cloud device you should indicate PointCloud2.

An example of voxel_layer with two sources of obstacles at the same time, one is a laser and antoher is a pointcloud:

voxel_layer:
  plugin: "nav2_costmap_2d::VoxelLayer"
  enabled: True
  observation_sources: scan pointcloud
  scan:
    topic: /scan
    data_type: "LaserScan"
  pointcloud:
    topic: /depth_camera/points
    data_type: "PointCloud2"
1 Like

@rtellez

Thank you very much, now it is clear.
I did not know what was that “observation_sources” in the config, now it is clear.

Thousand thanks
Péter

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.