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

Where is the origin of a map made by gmapping?

asked 2018-10-18 00:42:57 -0600

stevemartin gravatar image

updated 2018-10-18 01:25:10 -0600

gvdhoorn gravatar image

When I construct a 2d map using laser gmapping, how can I be sure where the origin is? For example, before starting gmapping, if I go in gazebo simulation to the desired center in my environment and then start gmapping:

  1. Will that be considered as the origin?
  2. If yes, then if I go left by 1 meter, does it mean that now I moved x=-1 y=0 z=0?
  3. So with my resolution of 0.5, do I need to translate to ROS by saying : x= (-1 * 0.5), y = 0, z=0 ?
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
4

answered 2018-10-18 01:44:00 -0600

Delb gravatar image

If you are talking about the orign as the coordinates (0;0) then the origin is set to the position of the robot at the beginning of your simulation (you can verify that by looking at the position of the frame map and odom). Also, if you look at the information of mapmetadata there is an attribute origin that is always on the bottom right corner of the map but it's not a frame, it's just the origin (not (0;0) but the pose of the first cell of the occupancygrid) of the map created accordingly to have your robot centered at the beginning.

With that in mind, to answer your questions :

  1. No, when you launch gmapping it creates the frame map. gmapping can locate the robot according to sensors data and odometry so the frame is created at the same pose as the frame odom. So your origin when you launch gmapping is odom.
  2. You have misunderstood the axis in ROS, you can look at the REP103. The x axis is for the movements forward/backwards. So if you move by 1 meter to the left you are at (0;1;0) (if you were at (0;0;0)).
  3. No, the resolution sets the size of the cells of the occupancygrid. So if you have a resolution of 0.01 it means your map will be created with cells of side 1cm. (e.g. if you have a map of 10 meters by 10 meters with that resolution you would have 10⁶ cells in the map : calculated with the formula map_width/resolution * map_length/resolution). But that doesn't means that all the coordinates are rounded to the resolution, the coordinates depends of the movement of base_link accroding to odom (thanks to the tf) and cells with simply keep a value if there is an obstacle or not (and if it's unknown). So you simply have to tell ROS the coordinates you want.
edit flag offensive delete link more

Comments

So for the 1), does it mean that at the start of the gmapping, the coordinate system of map will start at (0;0;0)?

stevemartin gravatar image stevemartin  ( 2018-10-18 02:04:23 -0600 )edit

Yes but if you move the robot before creating the map frame (i.e. launching gmapping) then its first pose according to map won't be (0;0;0).

Delb gravatar image Delb  ( 2018-10-18 02:14:56 -0600 )edit

@Delb, okay thank you for the detailed answer, now I understood. So the origin reads from the odom.

stevemartin gravatar image stevemartin  ( 2018-10-18 02:29:27 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2018-10-18 00:42:57 -0600

Seen: 3,028 times

Last updated: Oct 18 '18