Rosanswers logo

Hey guys, I am all in all pretty new to computer science in general and learning ROS now. came across some tutorials on tf after completing the beginner tutorials. I want to use rososc but that's another story since it is not updated for kinetic and catkin and I'm still trying to work out how to make that work for me... anyway,

-explain what tf is used for as if I am a 5 year old. -why would I use it in developing robots? -what type of applications is it useful for?

Originally posted by moonspacedancer on ROS Answers with karma: 123 on 2017-09-07

Post score: 5

Original comments

Comment by moonspacedancer on 2017-09-07:
wow someone downvoted my question? am i supposed to be ashamed to be a beginner or something? sounds like you need to take a break if you can't even come up w a creative response and instead downvote the question.

Comment by gvdhoorn on 2017-09-07:
I don't think the downvote was because you are asking a beginners question. We all started like that, and it is definitely nothing to be ashamed of.

I didn't downvote, but I can imagine some people don't appreciate the "like I'm 5" bit: ROS Answers is a beginners site, we already know that, so ..

Comment by gvdhoorn on 2017-09-07:
.. adding that is unnecessary and makes you seem unnecessarily insecure. If something in an answer is unclear, you can always just ask for additional clarification or explanation.

Comment by moonspacedancer on 2017-09-07:
oh ok, thanks it's based on a reddit group where people explain things like they are talking to extreme beginners. guess it's not some people's cup of tea. thank you. I just feel like if I don't say I am an absolute beginner it won't be concise enough for me to understand at this point.


1 Answer 1


Rosanswers logo

The question "what is TF" seems to be rather succinctly answered by its wiki page:

tf2 is the second generation of the transform library, which lets the user keep track of multiple coordinate frames over time. tf2 maintains the relationship between coordinate frames in a tree structure buffered in time, and lets the user transform points, vectors, etc between any two coordinate frames at any desired point in time.

And the first section -- What does tf2 do? Why should I use tf2? -- has this to say:

A robotic system typically has many 3D coordinate frames that change over time, such as a world frame, base frame, gripper frame, head frame, etc. tf2 keeps track of all these frames over time, and allows you to ask questions like:

  • Where was the head frame relative to the world frame, 5 seconds ago?
  • What is the pose of the object in my gripper relative to my base?
  • What is the current pose of the base frame in the map frame?

tf2 can operate in a distributed system. This means all the information about the coordinate frames of a robot is available to all ROS components on any computer in the system. Tf2 can operate with a central server that contains all transform information, or you can have every component in your distributed system build its own transform information database.

I'm assuming you already read that, but it wasn't clear enough.

If that is the case, it would help if you could clarify what wasn't clear and perhaps we can explain that.


@gvdhoorn I did read all of this. I am asking even more basically: what do all of these 'frames' have to do w my actual robot in space and why do I need to transform points, vectors or anything?

Right. I'm not going to explain this in too much detail, as that would be off-topic for this site (we're ROS Answers, not robotics.stackexchange.com).

So almost everything in robotics is concerned with where things are - either relative to the robot itself or relative to other things. Whenever a robot wants to interact with the real world, it will need to know where the things it wants to interact with are.

As robots are basically computers with sensors and actuators, they store references to objects as coordinates with some attached semantics. Those coordinates will need to be updated whenever either the robot moves, or other things move.

And keeping track of all of those coordinates and updating them becomes a really involved task if you move beyond a simple robot or robot application: I've worked on applications that tracked locations of hundreds of objects, updating multiple times per second over several hours and in a large volume of space.

We don't want to -- nor can we -- do that manually. And I also don't want to -- nor should we -- write software that does such things for each and every new robot that we happen to create.

So this is where TF comes in: it's essentially a reusable library that implements a piece of functionality that allows any ROS node to create, retrieve and update locations (ie: frames) in an efficient and (relatively) easy way. The library takes care of integrating all the CRUD operations that happen distributed across your entire ROS node graph (ie: all the connected nodes that you started, which may run on many different machines connected via a network) to guarantee that you have an as consistent as possible view of the state of all those frames (ie: positions). It also keeps a buffer of all the changes, so you can walk backwards through time and see what the state (ie: position) of all frames was at a particular point in time. This is very helpful, as it allows you to corroborate sensor data with positional data, which makes things like mapping possible (as that needs answers to questions like: "where was my camera when it took this picture 5 seconds ago?").

is this for actual movement through space or what???

If you mean: does TF do anything with making my robot move, then: no.

But it is certainly true that movement (as the first derivative of position wrt time) is related to TF, as it stores positions with an associated timestamp.

Originally posted by gvdhoorn with karma: 86574 on 2017-09-07

This answer was ACCEPTED on the original site

Post score: 6

Original comments

Comment by moonspacedancer on 2017-09-07:
@gvdhoorn I did read all of this. I am asking even more basically: what do all of these 'frames' have to do w my actual robot in space and why do I need to transform points, vectors or anything? is this for actual movement through space or what???

Comment by gvdhoorn on 2017-09-07:
If you don't have any prior exposure to things like coordinate frames, transformations, linear algebra or robot kinematics (and dynamics), I can imagine that all of this seems rather strange to want to deal with. It would probably help if you can try to get a grasp of these concepts, as it will ..

Comment by gvdhoorn on 2017-09-07:
.. make working with libraries such as TF a lot more understandable.

Comment by gvdhoorn on 2017-09-07:
Note that for really simple robotics, all of this is probably not needed, but for anything a bit more complicated, dealing with spatial data with a temporal dimension is going to be a lot more feasible with something like TF.

Comment by moonspacedancer on 2017-09-08:
thank you @gvdhoorn this answer plus comments has me in a new place understanding that I need to learn some requisite robotics in general to really get into it. I do study math but am only in precalculus so looking forward to linear and will definitely look into kinematics. thank you :)

Comment by moonspacedancer on 2017-09-08:
like would TF be useful with a robot who uses machine vision and stuff like that?

Comment by gvdhoorn on 2017-09-09:\

like would TF be useful with a robot who uses machine vision

I think you should be able to answer that yourself: does machine vision at any point depend on / use the position of anything? If yes: TF can help. If no, probably not needed.

Comment by SuleKayiran on 2021-08-13:
Hello, your comment was quite explanatory for me. Thank you for myself. Also, I would like to ask: If we are using lidar as a sensor and we see that the movement in the lidar is quite late compared to the robot when we perform imaging in rviz, can the tf transformation be the reason for these delays? @gvdhoorn

Comment by gvdhoorn on 2021-08-13:
Don't post follow-up questions as comments under questions with already accepted answers.

No one will see your question.

Post a new question, after having made sure yours isn't already discussed (use Google and append site:answers.ros.org to your query).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.