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

CostMap2D no longer showing unknown space

asked 2014-03-17 08:57:46 -0600

BlitherPants gravatar image

updated 2016-10-24 08:36:45 -0600

ngrennan gravatar image

Hello,

I am running ROS Hydro on Ubuntu 12.04.

I have written an application that runs alongside gmapping_demo.launch but has its own Costmap2DROS object keeping track of the global costmap. While developing my app, I have been able to use the getCostmap() function to get a copy of the character map. Relevant code is shown:

costmap_2d::Costmap2D* mymap = globalmap_->getCostmap();
boost::unique_lock< boost::shared_mutex > lock(*(mymap->getLock()));
mymap->saveMap("/tmp/map");

I then go through the "mymap" pointer and copy its cost values to a character array.

This used to work perfectly, but today I noticed that the saved map no longer keeps track of unknown space (cost = 255), instead just saving it as zeros, as though all unknown space was freespace. To illustrate this, here is the map generated by saveMap():

image description

I have searched the file, and 255 does not appear anywhere.

I am quite stumped as to why this is happening. The only thing I can think of is that I allowed Ubuntu to install updates yesterday, and the navigation packages were included. Has something changed in the way they work? I am wondering if some bug was introduced.

Saving the map via rosrun map_server map_saver still runs the way I expect it to.

If there is any more information I can provide, please let me know. Thanks in advance.

edit retag flag offensive close merge delete

Comments

This is odd. If you run mymap->getCost(0,0) before saveMap what does it return?

David Lu gravatar image David Lu  ( 2014-05-14 10:21:34 -0600 )edit

2 Answers

Sort by ยป oldest newest most voted
0

answered 2014-03-20 03:53:58 -0600

BlitherPants gravatar image

In case anyone has the same problem, I still have no idea what causes this, but I have worked around it by subscribing to the "map" topic, and during callback, copying the OccupancyGrid to a global character array. This includes unknown space, though it doesn't inflate obstacles in the way the Costmap2DROS object would have. I suppose if in the future I needed the inflation, I could use both methods and only copy unknown space in the callback.

edit flag offensive delete link more
0

answered 2014-04-04 12:23:17 -0600

paulbovbel gravatar image

Make sure track_unknown_space is enabled in your globalmap_ costmap parameters:

globalmap_->getLayeredCostmap->isTrackingUnknown

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-03-17 08:57:46 -0600

Seen: 719 times

Last updated: Apr 04 '14