ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org

# Occupancy Grid Coordinates

Hi,

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 close merge delete

Sort by ยป oldest newest most voted

Hi,

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

Edit

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 .

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?

( 2015-04-26 04:53:37 -0600 )edit

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

( 2015-04-26 06:18:40 -0600 )edit