# About TF Transformations between /odom and /base_footprint

Hello, Since I m really trying to undertand the principles of ROS in order to write programs on my own, I find somehow some concepts really hard to digest. It could be for you maybe easy at first, but I have some sublte questions regarding ROS and some functions even if I did the tutorials more than one time.

Ok, as far as I understood the tf package is used to transform position and orientation in one system in another system. Let s say I have a frame

/world = {Xw, Yw, Zw}

, which is absolut and fixed with the world as in the following figure:

It is supposed to be fixed and cannot move.

and let's take another frame, for istance

/base_frame = {Xf, Yf, Zf}

, which is attached to our robot and moves with its frame:

Now: as far as I understood from my mecatronics' lessons is that, due to cumulative errors of the internal sensor, lack of precision etc... then the odometry position of the robot will drift during time of a little bit from the true position. So the position our robot could not anymore considered absolut and precise but there is small offset which will be bigger and bigger (in the following figure);

/odom = {Xo, Yo, Zo}

Am I right till now? Ok, perfect.. I was reading with attention the tutorial of the pr2_controller here and I was a little bit surprised to read the following line of code:

  //record the starting transform from the odometry to the base frame
listener_.lookupTransform("base_footprint", "odom_combined",
ros::Time(0), start_transform);


What kind of transformation is going to be calculated? To me (maybe I am wrong) there is no sense to calculated of a transformation between a frame which is unknow (/base_footprint) and the frame /odom . To me should be the only /odom information available to calculate the estimated position of the robot, since theoretically I going to calculate the position whit the measured speed and acceleration. So I find the "base_footprint" in the lookupTransform a litlle bit misleading.

I hope my question is clear :) Thanks in advance

edit retag close merge delete

Sort by » oldest newest most voted

Many nodes that carry out state estimation generate both a transform from the odom frame to the base_link frame and a nav_msgs/Odometry message. If, for example, you start up your robot, and then drive 10 meters forward and 20 meters to the left, you will end up at (10, 20) in the odom frame and will likely have a heading (yaw) of pi/2. Your odom->base_link transform will contain the exact same information (although actually transforming a point from the odom frame to the base_link frame would require the inverse of that transform).

Looking at the code example, it seems like what they're trying to do is use the transform as a measurement of the robot's current position. They wait for the robot's first reported position and stick that in start_transform. They then start driving, and repeatedly get the current transform (again, just the robot's position in the odom frame), determine the difference between the current transform and the start transform, and use that to calculate a distance traveled. When the robot has traveled far enough, the loop terminates.

listener_.lookupTransform is just receiving the latest transform. Some other node is broadcasting it. The first two arguments, "base_footprint" and "odom_combined," are the target and source frames, respectively.

more
lookupTransform() is a lower level method which returns the transform between two coordinate frames.


In below code nothing is calculated, just reading the transform between frames "base_footprint", "odom_combined"

As per your above description, odom_combined fame similar to world frame and base_footprint is similar to odom .

  //record the starting transform from the odometry to the base frame
listener_.lookupTransform("base_footprint", "odom_combined",
ros::Time(0), start_transform);


Image from amcl page may give you idea of frames

more