Ask Your Question

StaticLayer map-resize erases all obstacles from ObstacleLayer

asked 2017-02-09 07:18:12 -0500

Huibuh gravatar image

updated 2017-02-09 07:19:16 -0500

Hello @David Lu

I am using Google Cartographer as SLAM component, and move_base for navigation. In the config of the global costmap, I have setup costmap_2d::StaticLayer to subscribe to the /map topic published by cartographer. There is also an ObstacleLayer and an InflationLayer. My problem is that each time cartographer dynamically adjusts the map size, all obstacles which have been added to the global costmap get erased.

Looking at the code of static_layer.cpp I can see that StaticLayer::incomingMap() is executed when a map with new dimensions is received. In this function, there is a section that initializes the costmap with static data.

How can I prevent the StaticLayer from erasing previously discovered obstacles from the ObstacleLayer to get erased from the master costmap (i.e. global costmap)?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-02-12 20:31:37 -0500

David Lu gravatar image

In the initial formulation of the static layer, the size was presumed to be relatively constant (static you might say).

The semantics of resizing the underlying static map are not so well defined that it defines how to deal with all the previous data in the layers. It's a decent use case, but I don't believe its currently covered in the existing layers.

edit flag offensive delete link more


You're right, each time StaticLayer::incomingMap() is executed, Costmap2D::resizeMap() is called on all other layers. In this function, initMaps() and resetMaps() wipes the existing data. Do you have any suggestions how to modify Costmap2D::resizeMap() to preserve the data?

Huibuh gravatar image Huibuh  ( 2017-02-23 08:38:07 -0500 )edit

It would involve a substantial amount of changes. The implementation should probably be similar to Costmap2D::updateOrigin which also changes the coordinate system of the map while keeping some of the data.

David Lu gravatar image David Lu  ( 2017-03-26 10:47:25 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2017-02-09 07:18:12 -0500

Seen: 557 times

Last updated: Feb 12 '17