ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
In order for the costmap to clear obstacles, it must be presented with a "clearing" observation for the previously occupied space. Typically, these observations come from an on-board sensor, such as a laser, from which ray-tracing is performed to clear space. From the video you posted, it looks like you're getting information for the robots' positions from an external sensor. To clear space with an external sensor, you have a couple of options, though they're sort of hacky:
If you're running navigation 1.3.1 or greater, you can call the "clear_costmaps" service which will clear all obstacles from the costmap. Then, upon receiving a new observation from your obstacle sensor, only those obstacles will be put into the map. One thing to note here, however, is that for the period of time between making the service call and receiving a new observation the robot will have an empty costmap and could hit something. This option would be super easy to try out, but does have the caveat of being able to run into something if you're not careful about how you run things.
Create a node that publishes clearing information in the robot's base_frame. Basically, you'd be faking a laser with a 360 degree field of view. The fake laser won't clear out observations that are actively being asserted by your obstacle detection, but it will clear out stale obstacles. This option is fairly easy to hack together, and doesn't have the race condition above that could lead to an empty map, but remember to set the frame_id of the LaserScan or PointCloud message correctly as otherwise you'll get the "outside of map bounds..." error you referenced above.
Hope this helps.