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

Revision history [back]

Hello everyone!

Since I posted this question I have managed to somehow find a workaround for my problem. Unfortunately, after checking all the answers other people kindly posted to this thread I was unable to call the move_base clear_costmap_recovery behavior manually from a Python script and I kinda gave up trying after some time. If anyone else manages to achieve this and also stumbles upon this question, please post here how you did it, if you can!

To just bring a little context in, the bigger issue I was trying to address was trying to properly have some virtual obstacles (published as PointCloud points to a topic) marked as obstacles in local and global costmaps for move_base node and not only that but to properly clear them once that PointCloud is cleared or not published anymore. I couldn't achieve the deserved behavior by calling the clear_costmaps service or clear_costmap_recovery so what I did instead is, after I had my PointCloud properly formed and the coordinates for all the points properly computed, I created a separate static map layer in the form of an OccupancyGrid (with the same size as the map found in /map topic) to which I drew pixels according to the locations of the points in the PointCloud (had to do some simple translations from map origin but that was the biggest issue I encountered while attempting this). Now, after building this OccupancyGrid with the virtual obstacles drawn to it I just marked it as an observation source in costmap_common.yaml and then in costmap_global and costmap_local as type: "costmap_2d::StaticLayer".

After I did what I presented above, I managed to obtain the desired behavior for my virtual obstacles. They are now added and removed accordingly! If anyone else is interested in how I achieved this specifically, I can give some more information and also post some Rviz screenshots if needed! :)