# questions about 2d map structure?

hello everyone,

i did the turtlebot gmapping tutorial,got a map(width=768,height=512,resolution=0.05). does it mean that the actual size of the environment is (768 multiply by 0.05,512 multiply by0.05) ,the grid map of X from [0,767],Y from [ 0,511] or maybe X-Y axes reverse,the [0,0]cell is the lower left corner of the grid map,am i right?

then i saw the OccupancyGrid andMapMetaData , and when i saw the link1,link2and link3,There are few points unclear.

1. when gmapping over with the turtlebot stop ,but the node slam_gmapping not kill, then i want to see the map data,sorosrun echo /map > map_data.txt,but the data are only three type: 0,100 and -1.But the Image_format said the "occupancy is represented as an integer in the range [0,100]",why?
2. from the experiment ,i got the map.info.origin.position=[-12.2,-12.2,0] , map.info.origin.orientation=[0,0,0,1],it suggest that there is no orientation between the grid map frame coordinate and the /map frame coordinate,am i right ?how does the map_server make the grid map 's X-Y axes parallel to the /map frame's X-Y? if i do experiment in a rectangular totally free room ,i let the initial pose of turtlebot located in the diagonal of the environment ，facing to another diagonal corner,the /map frame's axes-X isn't parallel to the future build grid map frame's axes-X, the /map frame's axes-Y is also not parallel to map frame's axes-Y,can i understand like this ?

Thanks for your time and attention.sorry,my english is poor ,i hope i will not confuse you .your any ideas will be appreciated,thank you very much !!

jxl

Originally posted by jxl on ROS Answers with karma: 252 on 2014-10-07

Post score: 0

First, your interpretations are correct.

1. It's still correct as per the definition. My guess is that it's easier for later algorithm to work with binary data than make the thresholding themselves as like this everyone is working on the same representation.

2. Yes this is correct. gmapping always uses 0 orientation. In principle you can use maps with other orientation, but I would not recommend that as as far as I known neither amcl nor the static map currently support that.

Originally posted by dornhege with karma: 31395 on 2014-10-07

This answer was ACCEPTED on the original site

Post score: 0

Comment by paulbovbel on 2014-10-07:
Addendum on 1: Map data is represented by an unsigned char, with 255 (or -1 after conversion to signed) being a special value to represent unknown space. link

Comment by dornhege on 2014-10-07:
Yes, this is also in the message spec: http://docs.ros.org/api/nav_msgs/html/msg/OccupancyGrid.html

Comment by jxl on 2014-10-07:
hello @dornhege,you mean the value of the grid map published by /slam_gmapping node is only have three values,there is no value is (0,100),such as 87,18 and so on ?

Comment by dornhege on 2014-10-07:
It probably is internally, but is thresholed before publishing.

Comment by jxl on 2014-10-07:
sorry for late reply ,thank you .in other place i see the origin.position of the /map in the /world can be set by yaml file which initialize map_server,where is it ? i only rosrun map_server map_saver -f /tmp/map.yaml,not set the origin ,does the origin get the fault value ?how can i set it?