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

where are stored obstacles from map?

asked 2014-08-14 03:51:38 -0600

GuillaumeB gravatar image

hello, I want to check if my path is correct on many maps, so i want to know the position of the obstacles. The map is provided by map_server ( a picture in black for obstacles and white for empty spaces).

I Was thinking that these values were stored in the cotmap_ of my global_planner but I have checked costmap_.getCost(i,j) for all the position and everything is empty. ( if i sent a goal to my move_base, my robot avoid the obstacles)

So my question is where are stored obstacles from my map?


edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-14 07:32:55 -0600

GuillaumeB gravatar image

I have solve my problem. As always in my case it was a stupid mistake. The things is :

  • the funtion getCost(mx,my) don't take meters but cells's coordinate (only positive coordinate).
  • the most importante in my case, the zero of the world is not always the center of the map (in my case my map was a little bit smaller).

So global_costmap contain obstacles from the map.

edit flag offensive delete link more


Hi, i have a similar question/problem but for the opposite occupancy, i want to extract the FREE cell coordinates of my map and the use them for navigation. do you happen to have a code snip for the free cell export or if can guide to the right path? Thanks a million.

sobot gravatar image sobot  ( 2015-05-03 14:46:48 -0600 )edit

has I explained if you have a costmap2_d you can use the function getCost(mx,my). This will return you 0 if it's a free cell ( but free cells could have values different than 0 if there are close to an object. --> )

GuillaumeB gravatar image GuillaumeB  ( 2015-05-03 16:31:04 -0600 )edit

thnx, that part i know. my noob problem is how to index cell coords in the first place, i.e in a vector. are them stored somewhere that can be accessed? and then isolate the FREE cells based on their cost of course. - thanks again for your elaboration.

sobot gravatar image sobot  ( 2015-05-04 03:56:18 -0600 )edit

@sobot "Comment" is not suitable for asking a new question. You should open a new question referring to this thread.

130s gravatar image 130s  ( 2015-05-04 04:28:19 -0600 )edit

Question Tools



Asked: 2014-08-14 03:51:38 -0600

Seen: 441 times

Last updated: Aug 14 '14