Robotics StackExchange | Archived questions

Why every cell of my costmap is considered free?

Hi, I am writing a Global Planner plugin in C++ and I am having the following issue processing the data incoming from the costmap2d generated by movebase: 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.

costmapcommonparams

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

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

# Layers
obstacles_layer:
 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

inflater_layer:
 inflation_radius: 1.75
 cost_scaling_factor: 2.58

costmapglobalparams

global_costmap:
global_frame: map

static_map: true
rolling_window: true
resolution: 0.05

costmaplocalparams

 local_costmap:
  global_frame: odom

  static_map: false
  rolling_window: true
  resolution: 0.05

Asked by f.cabeccia on 2021-10-03 11:45:34 UTC

Comments

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?

Asked by Mike Scheutzow on 2021-10-04 07:15:58 UTC

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 http://wiki.ros.org/costmap_2d/hydro/staticmap.

Asked by f.cabeccia on 2021-10-05 11:06:36 UTC

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.

Asked by Mike Scheutzow on 2021-10-05 11:20:36 UTC

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

Asked by f.cabeccia on 2021-10-07 04:54:21 UTC

Answers

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.

Asked by Mike Scheutzow on 2021-10-05 11:22:40 UTC

Comments