0
$\begingroup$

Rosanswers logo

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


Originally posted by aviprobo on ROS Answers with karma: 61 on 2014-05-05

Post score: 3

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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.


Originally posted by Stefan Kohlbrecher with karma: 24361 on 2014-05-06

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by aviprobo on 2014-05-06:
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?

Comment by Stefan Kohlbrecher on 2014-05-07:
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).

$\endgroup$
0
$\begingroup$

Rosanswers logo

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


Originally posted by Sudeep with karma: 460 on 2014-05-06

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.