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

[SOLVED] Getting map co-ordinates

asked 2014-05-05 16:05:49 -0500

aviprobo gravatar image

updated 2014-05-08 16:38:21 -0500

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

2 Answers

Sort by » oldest newest most voted
2

answered 2014-05-06 04:54:40 -0500

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.

edit flag offensive delete link more

Comments

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?

aviprobo gravatar image aviprobo  ( 2014-05-06 16:03:13 -0500 )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).

Stefan Kohlbrecher gravatar image Stefan Kohlbrecher  ( 2014-05-07 00:48:09 -0500 )edit
2

answered 2014-05-06 14:08:57 -0500

updated 2014-05-06 14:11:47 -0500

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

edit flag offensive delete link more

Question Tools

4 followers

Stats

Asked: 2014-05-05 16:05:49 -0500

Seen: 3,677 times

Last updated: May 08 '14