Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf2 Concept: About tf2 page #1951

Merged
merged 6 commits into from Sep 17, 2021
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions source/Concepts.rst
Expand Up @@ -22,6 +22,7 @@ Conceptual overviews provide relatively high-level, general background informati
Concepts/About-Catment
Concepts/About-Cross-Compilation
Concepts/About-Security
Concepts/About-Tf2


The Core Stack Developer Concepts are much more detailed conceptual articles intended for developers who plan modify or contribute to the ROS 2 core:
Expand Down
62 changes: 62 additions & 0 deletions source/Concepts/About-Tf2.rst
@@ -0,0 +1,62 @@
.. _AboutTf2:

About tf2
=========

.. contents:: Table of Contents
:depth: 2
:local:

Overview
--------

tf2 is 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.

.. image:: images/ros2_tf2_frames.png

Properties of tf2
-----------------

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 2 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.
kurshakuz marked this conversation as resolved.
Show resolved Hide resolved

Tutorials
---------

We created a set of :ref:`tutorials <Tf2Main>` that walks you through using tf2, step by step.
You can get started on the :ref:`introduction to tf2 <IntroToTf2>` tutorial.
For a complete list of all tf2 and tf2-related tutorials check out the :ref:`tutorials <Tf2Main>` page.

There are essentially two main tasks that any user would use tf2 for, listening for transforms and broadcasting transforms.

If you use tf2, you will need to listen for transforms.
kurshakuz marked this conversation as resolved.
Show resolved Hide resolved
What you will do is to receive and buffer all coordinate frames that are broadcasted in the system, and query for specific transforms between frames.
Check out the writing a tf2 listener tutorial :ref:`(Python) <WritingATf2ListenerPy>` :ref:`(C++) <WritingATf2ListenerCpp>` to learn more.

To extend the capabilities of a robot you will need to start broadcasting transforms.
Broadcasting transforms means to send out the relative pose of coordinate frames to the rest of the system.
A system can have many broadcasters that each provide information about a different part of the robot.
Check out the writing a tf2 broadcaster tutorial :ref:`(Python) <WritingATf2BroadcasterPy>` :ref:`(C++) <WritingATf2BroadcasterCpp>` to learn more.

If your want to define static transforms in your tf2 tree, take a look at writing static tf2 broadcaster :ref:`(Python) <WritingATf2StaticBroadcasterPy>` :ref:`(C++) <WritingATf2StaticBroadcasterCpp>` tutorial.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If your want to define static transforms in your tf2 tree, take a look at writing static tf2 broadcaster :ref:`(Python) <WritingATf2StaticBroadcasterPy>` :ref:`(C++) <WritingATf2StaticBroadcasterCpp>` tutorial.
If you want to define static transforms in your tf2 tree, take a look at the writing static tf2 broadcaster :ref:`(Python) <WritingATf2StaticBroadcasterPy>` :ref:`(C++) <WritingATf2StaticBroadcasterCpp>` tutorial.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should note that static transforms are published once and assumed to be not changing and therefore no time history stored.
kurshakuz marked this conversation as resolved.
Show resolved Hide resolved

You can also learn how to add fixed and dynamic frames to your tf2 tree in adding a frame :ref:`(Python) <AddingAFramePy>` :ref:`(C++) <AddingAFrameCpp>` tutorial.

Once you are finished with the basic tutorials, you can move on to learn about tf2 and time.
The tf2 and time tutorial :ref:`(Python) <LearningAboutTf2AndTimePy>` :ref:`(C++) <LearningAboutTf2AndTimeCpp>` teaches the basic principles of tf2 and time.
The advanced tutorial about tf2 and time :ref:`(Python) <TimeTravelWithTf2Py>` :ref:`(C++) <TimeTravelWithTf2Cpp>` teaches the principles of time traveling with tf2.

Paper
-----

There is a paper on tf2 presented at TePRA 2013: `tf: The transform library <https://ieeexplore.ieee.org/abstract/document/6556373>`_.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While I like the idea of providing the reference, we should be careful to explain that the paper was about the original tf, not tf2. In particular, the concepts in tf and tf2 are the same, though the implementation and API are very different.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The paper itself actually does not mention anything specific to first tf API. The paper is nice as it covers the very basics of broadcasting and listening, transformations in time and how the transform computation works. I do think that we better mention it.

Originally, paper was directly included in the wiki and I think its even better if we can host it in the docs too. I am myself don't have access to that ieeexplore database, unfortunately.

https://wiki.ros.org/Papers/TePRA2013_Foote?action=AttachFile&do=view&target=TePRA2013_Foote.pdf

Do you think we can include it somewhere and add a link to it? Does current docs website support that?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can add arbitrary files, but I'm not sure. I'd have to do some more looking at the Sphinx documentation. For now, I'm happy to leave this link and we can look at adding in the paper later.

Binary file added source/Concepts/images/ros2_tf2_frames.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.