ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Integrating voxel_layer into the costmap

asked 2016-11-14 09:55:17 -0500

layale.saab gravatar image

updated 2016-11-21 08:54:05 -0500

I am trying to include data from a 3d sensor into a 2d costmap knowing that the costmap is also feeded by a 2d sensor. Therefore, I have different layers, an obstacle layer using 2d laser scan data and a voxel layer using 3d point cloud data from a time of flight device.

First of all, I would like to ask you few specific questions about some parameter settings. I saw through different related questions, that origin_x and origin_y should be set to -width/2 and -height/2 but I didn't understand why and if it is really required, since by default these values are set to 0. Should I set the map_type to voxel or keep it as static_map, knowing that I need to get both layers appear in the costmap. In the voxel layer, do we need to set a negative min_obstacle_height? I would like to precise that in the robot urdf the base_link is lower than the 3d sensor which is itself lower then the laser sensor.

Next, I would like to see if there is something wrong or missing in the way the parameters are defined. At the end of this post, you can find the parameter settings of the different costmap files. In results to this set of configuration, I can visualize the 3d cloud separately but it does not have any impact on the costmap. Yet the laser data is well taken into account in the local costmap where the marking is set to true for both sensors. So I expect to have both sensor data affecting the local costmap. In the global costmap, however, marking is set to true only for the 3d sensor and yet the corresponding data seems not to be included. The voxel_grid topic also seems not to be updated (same values all the time), and following a solution found online to visualize the voxel grid on rviz, I tried to transform the voxel grid into a point cloud as sensor_msgs::PointCloud but the point cloud is empty. I think the problem is in the integration of the voxel layer itself into the costmap. Something must be missing either in the configuration files or a plugin, for example, in my ros version. I am using ros indigo - version 1.11.20

The result I am looking for, concerning the voxel layer, is similar to this video, in addition of course to keep the laser layer in the costmap:

Please find below the yaml settings :


transform_tolerance: 0.5

robot_radius: 0.35



 global_frame: map

 robot_base_frame: center_wheel_link

 update_frequency: 0.5

 publish_frequency: 0.1

 static_map: true

 map_type: costmap

 track_unknown_space: true



 global_frame: map

 robot_base_frame: center_wheel_link

 publish_frequency: 1.0

 update_frequency: 2.0

 rolling_window: true

 map_type: costmap


  width: 10.0
  height: 10.0 
  resolution: 0.03
  origin_x: -5.0
  origin_y: -5.0 

 - {name: static_layer, type: "costmap_2d::StaticLayer"}
 - {name: laser_layer, type: "costmap_2d::ObstacleLayer"}
 - {name: tof_layer, type: "costmap_2d::VoxelLayer ...
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-12-04 21:25:45 -0500

chengwei gravatar image

updated 2016-12-04 23:10:39 -0500


I have the similar work with you.I have a 2D laidr sensor and a 3D depth sensor and the obstacle_layer, static_layer, inflation_layer and the voxel_layer all work in a costmap (2D).I transform voxel_grid topic to pointcloud,so I could add the voxel_grid in the rviz , I have make a test in navigation , in my test,the voxel_grid add only, do not eliminate in my rviz .That is to say, only add obstacles(voxel_grid), the obstacle in the costmap_2d not clear, Did you encounter this problem?

the problem link


   global_frame: /odom
   robot_base_frame: /base_link 
   update_frequency: 3
   publish_frequency: 3
   static_map: false
   rolling_window: true
   width: 6.0
   height: 6.0
   resolution: 0.025
   transform_tolerance: 1.0
   map_type: costmap

     #enabled: false

    - {name: obstacle_layer,  type: "costmap_2d::ObstacleLayer"}
    - {name: voxel_layer, type: "costmap_2d::VoxelLayer"}
    - {name: inflation_layer,   type: "costmap_2d::InflationLayer"}


       global_frame: /map
       robot_base_frame: /base_link    
       update_frequency: 3
       publish_frequency: 0.2
       static_map: true
       rolling_window: false
       resolution: 0.025
       transform_tolerance: 1.0
       map_type: costmap
            enabled: false


  cost_scaling_factor: 0.5  
  inflation_radius: 0.35 #0.45
  robot_radius: 0.35

  obstacle_range: 2.5
  raytrace_range: 3.0
  max_obstacle_height: 1.6 #1.3
  min_obstacle_height: 0.03
  observation_sources: scan
  scan: {data_type: LaserScan, topic: /scan, marking: true, clearing: true, expected_update_rate: 0, inf_is_valid: true}

  enabled: true
  origin_z: 0.0
  z_resolution: 0.05
  z_voxels: 10
  unknown_threshold: 0
  #mark_threshold: 2
  publish_voxel_map: true
  combination_method: 1
  observation_sources: output_points
    data_type: PointCloud2
    topic: /output_points
    marking: true
    clearing: true
    obstacle_range: 1.90
    raytrace_range: 2.00
    min_obstacle_height: 0.00
    max_obstacle_height: 3.00
    mark_threshold: 3
    observation_persistence: 2.0
edit flag offensive delete link more


@chengwei i am trying something similar with multiple layers and it still doesn't work for me. Any help is appreciated. Thanks

cryptichead gravatar image cryptichead  ( 2022-03-03 02:49:32 -0500 )edit

Question Tools

1 follower


Asked: 2016-11-14 09:55:17 -0500

Seen: 3,774 times

Last updated: Dec 04 '16