# [SOLVED] Getting map co-ordinates

We are building a SLAM map using our Turtlebot. During the process, we stop the Turtlebot at certain points and would like to obtain the x,y,z values from the map coordinate frame. We are using the /map_metadata topic which we believe gives us the x,y,z values in the map. However, these values never seem to change and always stay the same in the /map_metadata topic.

Could someone please provide a solution or an alternative? Many thanks!

Edit: We've managed to obtain the corresponding robot co-ordinates by simply using

rosrun tf tf_echo /map /base_footprint

edit retag close merge delete

Sort by » oldest newest most voted

The MapMetaData message type used for the "/map_metadata" topic provides information about the transform and scaling of the grid map with regards to the (metric) map frame (Essentially allowing to convert between grid and metric coordinates). Note it contains no information about a robot´s location whatsoever. If you have setup everything correctly (which appears to be the case if your Turtlebot is mapping the environment), you can use tf to obtain the robot´s pose estimate. Have a look at this tutorial and this Q/A.

more

Thanks Stefan! Now, once I have acquired the translation from map to robot pose estimate, if I want to send a goal to the map (map co-ordinates), how am I able to translate from metric back to grid? Do I still use tf to perform the translation from metric to grid or is there another way?

( 2014-05-06 16:03:13 -0600 )edit

Navigation happens in a metric map frame when using the ROS navigation stack. You normally do not care about the grid (e.g. pixel) coordinates of the underlying occupancy grid map (unless you want to do lower level things like SLAM or query the map data directly).

( 2014-05-07 00:48:09 -0600 )edit

Hi,

In MapMetaData, you get the real wold pose of pixel(0,0) in form of [x0,y0,orientation]; so if you need to know some particular pixel's(px,py) real world position(x,y)

then, letssay

resolution = occ.info.resolution (occ is occupancy grid msg)

[x;y] = R * [px * resolution ; py * resolution] + [x0,y0]

where, R is a 2d rotational matrix, with theta according to orientation of the map. However this data does not carry robot's location in the map.(tf data can be used)

Hope this helped, :) Sudeep

more