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

costmap_2d with nothing but a clearing footprint?

asked 2016-08-12 19:09:32 -0500

lucasw gravatar image

updated 2020-11-21 12:11:37 -0500

I'd like to set up a costmap_2d initialized to be 100% unknown or obstacles, and have it do nothing except clear grid locations within the footprint. I don't want to have a static map that is unchangeable, just provide initial values that can be cleared by moving the footprint over them.

As it is now the static map doesn't get altered by the obstacle layer, it preserves it regardless of the footprint moving over it.

Do I need to create a fake sensor that will put an obstacle in every grid location when I want to initialize it?

This is with jade.

* Update *

I've tried to publish a point cloud into the obstacle layer that drops a point into every grid location, but even then the footprint is only cleared within the current footprint, if I move the footprint the old obstacle grid points now outside the footprint are restored.

Publishing a single large point cloud that attempts to cover the entire grid (this isn't quite working either, it is only clearing a circle, but more likely that is my fault) also causes the costmap node to issue a huge costmap_update every cycle, even though nothing is changing or getting updated, and it complains about not being able to keep up: [Map update loop missed its desired rate of 10.0000Hz... the loop actually took 1.4570 seconds].

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2016-08-18 08:03:03 -0500

David Lu gravatar image

The nature of the static layer is that it cannot be changed. You can initialize everything to be unknown using the track_unknown_space parameter.

edit flag offensive delete link more

answered 2016-08-15 13:53:48 -0500

lucasw gravatar image

updated 2021-12-18 23:42:47 -0500

It's looking like the costmap_2d node is completely wrong for this task, unless I'm just missing a parameter or two that would get the desired behavior.

I think the solution will be a custom node that publishes an OccupancyGrid and subscribes to the footprint, and uses an opencv function to draw the footprint onto the grid when it updates and this will get the desired obstacle clearing behavior.


Just tried this again and I was able to take a pgm with all black pixels, a static map config with negate: 0, and the obstacle layer has combination_method: 0 :

  - {name: static, type: "costmap_2d::StaticLayer"}
  - {name: cleared, type: "costmap_2d::ObstacleLayer"}

  track_unknown_space: true
  combination_method: 0

image description

edit flag offensive delete link more


For future reference, this node does that:

Timple86 gravatar image Timple86  ( 2020-07-09 07:30:22 -0500 )edit

Hi @lucasw! This is exactly what I am trying to accomplish, yet unsuccessfully so far... do you have any repo where you implemented this feature? Thank you!

jpsantos gravatar image jpsantos  ( 2022-07-07 02:32:07 -0500 )edit

Question Tools

1 follower


Asked: 2016-08-12 19:09:32 -0500

Seen: 694 times

Last updated: Dec 18 '21