Grid layer in costmap2d tutorials, out of map bounds, matchSize().
After closely following the Costmap2D tutorial on creating new layers, simple layer worked as intended, grid layer didn't.
After some poking around, I noticed that the costmap it created was always empty because if(worldToMap(mark_x, mark_y, mx, my))
always returned false as the point exceeded the local costmap's bounds. I then noticed that matchSize();
in void GridLayer::onInitialize()
had no impact on execution, I think it gets called by the base class anyway. I then moved matchSize()
into the updateBounds
method and the point now falls inside the costmap's bounds, making it work like simple layer.
My question is the following: Is this a problem with the tutorial or is this a problem with my particular configuration?
I'm using it as a local_costmap layer and my configuration file looks like this:
local_costmap:
global_frame: /map
robot_base_frame: /base_link
update_frequency: 8.0
publish_frequency: 4.0
rolling_window: true
static_map: false
width: 6.0
height: 6.0
resolution: 0.05
plugins:
- {name: obstacle_layer, type: "costmap_2d::ObstacleLayer", output: "screen"}
#- {name: simple_layer, type: "simple_layer_namespace::SimpleLayer", output: "screen"}
- {name: grid_layer, type: "simple_layer_namespace::GridLayer", output: "screen"}
- {name: inflation_layer, type: "costmap_2d::InflationLayer", output: "screen"}
The layer works with and without modification as a global costmap layer.