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

Occupancy Grid Coordinates

asked 2015-04-26 02:21:42 -0500

sobot gravatar image

updated 2015-04-26 02:23:59 -0500


This might be a newbie question but i need a help with it or at least to be pointed in the right direction. I need to extract/acquire the (x, y) coordinates of a given map's (grid) cells to be used in a path planning program.

  • like in the RVIZ that you click somewhere on the map and it prints out the coordinates of that specific location. what i need to achieve is to acquire all of available "unoccupied" cells coordinates of a given map for my Node to calculate a STC path for the robot to travel.

How can i achieve this goal through a ROS node?

Does the (x, y) map coordinates system follow a certain rule? for example (0, 0) is always at a specific corner or there is a system for row and column numbering, etc.

Thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2015-04-26 02:53:59 -0500

bvbdort gravatar image

updated 2015-04-26 06:12:29 -0500


Please have a look into yaml of map you are using.

using origin and resolution you can find position of each cell.

origin : The 2-D pose of the lower-left pixel in the map, as (x, y, yaw), with yaw as counterclockwise rotation (yaw=0 means no rotation). Many parts of the system currently ignore yaw.

resolution : Resolution of the map, meters / pixel


Occupancy Grid msg member data is having

Occupancy probabilities are in the range [0,100]. Unknown is -1.

Use free_thresh param to get Unoccupied cells (i.e free cells).

free_thresh : Pixels with occupancy probability less than this threshold are considered completely free.

if free_thresh: 0.196 then all cells with occupancy lessthan 19.6 (and not -1 ) are free .

edit flag offensive delete link more


Thanks so much! This answers the second part of my question. a little twist though, what if its not a static map (would local_costmap_params.yaml serve the same purpose?) Any idea about the first part of the problem (extracting unoccupied grid coordinates) through use of cpp codes?

sobot gravatar image sobot  ( 2015-04-26 04:53:37 -0500 )edit

check update, yes if map is not static you have to use cost map but you need good localization.

bvbdort gravatar image bvbdort  ( 2015-04-26 06:18:40 -0500 )edit

Question Tools



Asked: 2015-04-26 02:21:42 -0500

Seen: 8,198 times

Last updated: Apr 26 '15