# Confused about coordinate frames. Can someone please explain?

I've read:

However I'm still quite confused about the different coordinate frames map, odom, and base_link. Below I'll explain what my current understanding of these frames is, along with some questions.

map

• I think this one makes the most sense conceptually.
• I consider this the "ground truth" which is the real world.
• REP-0105 calls this a "world fixed frame", which makes sense, because it's tied to the real world.

odom

• REP-0105 calls this a "world fixed frame". What? How is this fixed? Isn't this supposed to represent the movement of a mobile robot?
• This frame is computed from an odemetry source like wheels or an IMU. Makes sense.

base_link

• Why is base_link a separate frame? Shouldn't odom and base_link be the same thing? Doesn't odom represent the robot base and its movement?

I feel like I partially understand frames and tf. For example if you have sonar sensors mounted on a robot, you may want to know what the sensor value is from the base_link frame instead of the sonar sensor frame. I get that.

But the odom and base_link frames confuse me. Can someone please explain what the difference is?

Originally posted by triantatwo on ROS Answers with karma: 237 on 2016-06-16

Post score: 10

## 3 Answers

Adding to the previous answer, odom frame is called so because it is the frame where the odometry is used to update the pose of the robot. In this frame, there is no correction or jumps in the robot's pose, it is continually updated based on the data coming from the motor's encoders (sometimes fused with accelerometer and gyro).

Map frame is the frame representing the world, where your map (mostly occupancy grid map with black areas represent obstacles and walls) is defined.

Now in order to run robot localization and model the drifts of the robot while it is navigating, a transform between the frame map and the frame odom was introduced. At the beginning map and odom frame are overlapping. While the robot navigates and localizes (using amcl for example) it will correct its drift but it will not do this correction by changing its pose in the odom frame (this pose published under the topic /odom). It will update the transform between map and odom frames such that when you chain the transforms to get the pose of the robot in the map frame, you will get the corrected pose (thus the transform between map and odom frames represents the offset in the robot's pose that is given in the odom frame).

Do not confuse the frame odom with the robot's pose published under the topic /odom. The frame odom is just a coordinate system where the robot has to be located. This location of the robot would then be the coordinates of base_link in the odom frame. These coordinates are published in the /odom topic. If you do a rosrun tf_echo odom base_link you will get exactly the same thing as in rostopic echo /odom (here the topic odom might change depending on the robot model and on your software). So when you turn on the robot, base_link and odom are overlapping as the robot's pose is zero at the beginning. But once the robot's wheels start rotating, base_link will get away from odom. So base_link is a mobile frame and odom a fixed one.

Originally posted by Mehdi. with karma: 3339 on 2016-06-17

This answer was ACCEPTED on the original site

Post score: 18

### Original comments

Comment by triantatwo on 2016-06-17:
So if I understand correctly, the dynamic/mobile base_link frame "lives" in the static/fixed odom frame? And the transform between the map frame and odom frame serves to correct for drift?

Comment by Mehdi. on 2016-06-20:
yes exactly

Here is my understanding. Map = real world. Odom = where the robot thinks it is. The Map to Odom transform provides a correction from the where the robot actually is to where the robot thinks it is. If robot odom is 100% accurate, I think the map to odom TF = 0,0,0. If that understanding is wrong someone will by shortly to correct me.

Originally posted by billy with karma: 1850 on 2016-06-17

This answer was NOT ACCEPTED on the original site

Post score: 5

### Original comments

Comment by joq on 2016-06-17:
That would be the null translation, there would also be a quaternion causing no rotation.

Mehdi answer your question in a relatively proper way, I just want to add the 3D transformation concept that you must understand to be able to clarify your mind. You need always to have a reference to be able to measure any movement or rotation, remember that movements are relative (relativity) to another frame. Each frame knows its own world (3D components - values: x,y,z, roll, pitch, yaw) of the objects that are placed in it, for instance, your robot is placed in the map-world frame, which means that the map-world knows where your robot is located, but your robot has a 3D shape, so it can have stuff on it, like a camera or an arm, then you need a frame in the "centroid" (close to it ;-)) of the robot to be able to transform the exact position of the camera or arm in the map-world frame, so you know the camera position relatively to the centroid of the robot (base_link) and because the world knows where the robot (base_link) is in it's own coordinates, then it knows where the camera is located. But then the robot moves, how does the map-world or robot knows where the heck it is moving?, it needs another frame from which the robot moves relatively to. That's the work of the odom frame, it is placed in the map-world frame and represent the initial position of the robot (base_link) at the beginning of the scene. If the robot moves, it does it relatively to the odom frame, so the map-world use the odom frame to calculate the robot position in its own frame ( see image: http://library.isr.ist.utl.pt/docs/roswiki/hector_slam(2f)Tutorials(2f)SettingUpForYourRobot.html).

There is more about 3D transformations (matrix transformations) and the mathematics behind it. (https://www.youtube.com/watch?v=NsiJNvsuO3s, https://www.youtube.com/watch?v=gdoI2nM6Lio), but don't waist your time getting overwhelmed (no need for a headache).

You can find more in the TF overwiew (http://wiki.ros.org/tf/Overview/Transformations)

Originally posted by pablocesar with karma: 252 on 2016-06-17

This answer was NOT ACCEPTED on the original site

Post score: 8

### Original comments

Comment by mhdadk on 2023-05-19:
(+1) The link http://library.isr.ist.utl.pt/docs/roswiki/hector_slam(2f)Tutorials(2f)SettingUpForYourRobot.html is broken. Here is the fixed one: http://wiki.ros.org/hector_slam/Tutorials/SettingUpForYourRobot