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 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.
costmap_common_params
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
costmap_global_params
global_costmap:
global_frame: map
static_map: true
rolling_window: true
resolution: 0.05
costmap_local_params
local_costmap:
global_frame: odom
static_map: false
rolling_window: true
resolution: 0.05
I have not used
gmapping
, but it seems like a problem that you do not have astatic_layer
in the global costmap. Which costmap2d layer is the gmapping data being written to?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 syntaxstatic_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/....You should put the required properties on the following lines after
static_map:
, indented (just like you did for yourobstacles_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.Deleting
static_map
and adding proper spacing after the colon did the trick. Thank you very much for your help!