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

Why every cell of my costmap is considered free?

asked 2021-10-03 11:50:44 -0500

f.cabeccia gravatar image

Hi, I am writing a Global Planner plugin in C++ and I am having the following issue processing the data incoming from the costmap_2d generated by move_base: every cell of the map is marked as free even if that's not the case (I am using a gazebo environment from Turtlebot3 packages, turtlebot3_stage_4). This is obviously a big problem when I try to generate the path inside the code, since the planner can not discriminate between free, occupied and unknown space.

Also, consider that the map is not static, but is generated using SLAM with gmapping method.

Could anyone suggests what may be wrong with these configuration files? I have been dealing with this problem for some time now and I really can not find what is wrong.


footprint: [[-0.105, -0.105], [-0.105, 0.105], [0.041, 0.105], [0.041, -0.105]] 
footprint_padding: 0.01
robot_base_frame: base_footprint

update_frequency: 5.0
publish_frequency: 5.0
transform_tolerance: 0.5  #0.2
map_type: costmap

obstacle_range: 3.0
raytrace_range: 3.5

 - {name: obstacles_layer, type: "costmap_2d::ObstacleLayer"}
 - {name: inflater_layer, type: "costmap_2d::InflationLayer"}

# Layers
 observation_sources: scan
 scan: {sensor_frame: base_scan, data_type: LaserScan, topic: scan, marking: true, clearing: true}
  track_unknown_space: true
 footprint_clearing_enabled: true
 combination_method: 1

 inflation_radius: 1.75
 cost_scaling_factor: 2.58


global_frame: map

static_map: true
rolling_window: true
resolution: 0.05


  global_frame: odom

  static_map: false
  rolling_window: true
  resolution: 0.05
edit retag flag offensive close merge delete



I have not used gmapping, but it seems like a problem that you do not have a static_layer in the global costmap. Which costmap2d layer is the gmapping data being written to?

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-10-04 07:15:58 -0500 )edit

I tried setting a static_layer as follows: plugins: - {name: static_map, type: "costmap_2d::StaticLayer"} and I solved that problem, thank you for pointing it out. The only problem now is that if a use the following syntax static_map: ***some parameters***I get a "cannot marshal None" error, which basically means that I have not set a parameter. But that is strange, since I've taken everything on this page

f.cabeccia gravatar image f.cabeccia  ( 2021-10-05 11:06:36 -0500 )edit

You should put the required properties on the following lines after static_map:, indented (just like you did for your obstacles_layer:) And make sure you have a space character after the :.

I don't know what static_map: true does in your config, but you may have created a name clash there.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2021-10-05 11:20:36 -0500 )edit

Deleting static_map and adding proper spacing after the colon did the trick. Thank you very much for your help!

f.cabeccia gravatar image f.cabeccia  ( 2021-10-07 04:54:21 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-10-05 11:22:40 -0500

Mike Scheutzow gravatar image

It seems like a problem that you do not have a static_layer in the global costmap. To make use of it, the gmapping data has to end up in some costmap2d layer.

edit flag offensive delete link more

Question Tools


Asked: 2021-10-03 11:45:34 -0500

Seen: 78 times

Last updated: Oct 05 '21