Skip to content

Commit

Permalink
Remove Tf2 time tutorials for Python (#4384)
Browse files Browse the repository at this point in the history
* Small update for language in tf2 static transforms.

* Small language fixups in tf2 broadcaster tutorials.

* Small language updates in Writing a tf2 listener.

* Small clarification in Add-a-frame tutorials.

* Small updates to the Learning-about-tf2-and-time-cpp tutorial.

* Remove the python tf2 tutorials.

They have not worked for a very long time, and in point of
fact with the current tf2_py code, they cannot work.
Remove them until the time we actually fix the tf2_py
code, at which point we can reintroduce them.

Signed-off-by: Chris Lalancette <[email protected]>
(cherry picked from commit cb0e0be)
  • Loading branch information
clalancette authored and mergify[bot] committed May 7, 2024
1 parent ac96821 commit 7533eda
Show file tree
Hide file tree
Showing 13 changed files with 28 additions and 252 deletions.
4 changes: 2 additions & 2 deletions source/Concepts/Intermediate/About-Tf2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ If you want to define static transforms in your tf2 tree, take a look at the "Wr
You can also learn how to add fixed and dynamic frames to your tf2 tree in the "Adding a frame" :doc:`(Python) <../../Tutorials/Intermediate/Tf2/Adding-A-Frame-Py>` :doc:`(C++) <../../Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp>` tutorial.

Once you are finished with the basic tutorials, you can move on to learn about tf2 and time.
The tf2 and time tutorial :doc:`(Python) <../../Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Py>` :doc:`(C++) <../../Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Cpp>` teaches the basic principles of tf2 and time.
The advanced tutorial about tf2 and time :doc:`(Python) <../../Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Py>` :doc:`(C++) <../../Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Cpp>` teaches the principles of time traveling with tf2.
The tf2 and time tutorial :doc:`(C++) <../../Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Cpp>` teaches the basic principles of tf2 and time.
The advanced tutorial about tf2 and time :doc:`(C++) <../../Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Cpp>` teaches the principles of time traveling with tf2.

Paper
-----
Expand Down
4 changes: 2 additions & 2 deletions source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e
~~~~~~~~~~~~~~~~~~~~~~~~~

Now let's create a launch file for this example.
With your text editor, create a new file called ``launch/turtle_tf2_fixed_frame_demo_launch.py``, and add the following lines:
With your text editor, create a new file called ``turtle_tf2_fixed_frame_demo_launch.py`` in the ``src/learning_tf2_cpp/launch`` directory, and add the following lines:

.. code-block:: python
Expand Down Expand Up @@ -469,7 +469,7 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e
2.3 Write the launch file
~~~~~~~~~~~~~~~~~~~~~~~~~

To test this code, create a new launch file ``launch/turtle_tf2_dynamic_frame_demo_launch.py`` and paste the following code:
To test this code, create a new launch file ``turtle_tf2_dynamic_frame_demo_launch.py`` in the ``src/learning_tf2_cpp/launch`` directory and paste the following code:

.. code-block:: python
Expand Down
5 changes: 2 additions & 3 deletions source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Py.rst
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ Add the following line between the ``'console_scripts':`` brackets:
~~~~~~~~~~~~~~~~~~~~~~~~~

Now let's create a launch file for this example.
With your text editor, create a new file called ``launch/turtle_tf2_fixed_frame_demo_launch.py``, and add the following lines:
With your text editor, create a new file called ``turtle_tf2_fixed_frame_demo_launch.py`` in the ``src/learning_tf2_py/launch`` directory, and add the following lines:

.. code-block:: python
Expand Down Expand Up @@ -204,7 +204,6 @@ The last part of the code will add our fixed ``carrot1`` frame to the turtlesim
name='fixed_broadcaster',
),
1.4 Build
~~~~~~~~~

Expand Down Expand Up @@ -427,7 +426,7 @@ Add the following line between the ``'console_scripts':`` brackets:
2.3 Write the launch file
~~~~~~~~~~~~~~~~~~~~~~~~~

To test this code, create a new launch file ``launch/turtle_tf2_dynamic_frame_demo_launch.py`` and paste the following code:
To test this code, create a new launch file ``turtle_tf2_dynamic_frame_demo_launch.py`` in the ``src/learning_tf2_py/launch`` directory and paste the following code:

.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ Background
----------

In previous tutorials, we recreated the turtle demo by writing a :doc:`tf2 broadcaster <Writing-A-Tf2-Broadcaster-Cpp>` and a :doc:`tf2 listener <Writing-A-Tf2-Listener-Cpp>`.
We also learned how to :doc:`add a new frame to the transformation tree <./Adding-A-Frame-Cpp>` and learned how tf2 keeps track of a tree of coordinate frames.
We also learned how to :doc:`add a new frame to the transformation tree <Adding-A-Frame-Cpp>` and learned how tf2 keeps track of a tree of coordinate frames.
This tree changes over time, and tf2 stores a time snapshot for every transform (for up to 10 seconds by default).
Until now we used the ``lookupTransform()`` function to get access to the latest available transforms in that tf2 tree, without knowing at what time that transform was recorded.
This tutorial will teach you how to get a transform at a specific time.

Tasks
-----

1 tf2 and time
^^^^^^^^^^^^^^
1 Update the listener node
^^^^^^^^^^^^^^^^^^^^^^^^^^

So let's go back to where we ended in the :doc:`adding a frame tutorial <./Adding-A-Frame-Cpp>`.
Go to ``learning_tf2_cpp`` package.
Let's go back to where we ended in the :doc:`adding a frame tutorial <Adding-A-Frame-Cpp>`.
Go to the ``learning_tf2_cpp`` package.
Open ``turtle_tf2_listener.cpp`` and take a look at the ``lookupTransform()`` call:

.. code-block:: C++
Expand Down Expand Up @@ -76,7 +76,7 @@ You will notice that it fails and outputs something similar to this:

.. code-block:: console
[INFO] [1629873136.345688064] [listener]: Could not transform turtle1 to turtle2: Lookup would
[INFO] [1629873136.345688064] [listener]: Could not transform turtle2 to turtle1: Lookup would
require extrapolation into the future. Requested time 1629873136.345539 but the latest data
is at time 1629873136.338804, when looking up transform from frame [turtle1] to frame [turtle2]
Expand All @@ -87,8 +87,8 @@ Firstly, each listener has a buffer where it stores all the coordinate transform
Secondly, when a broadcaster sends out a transform, it takes some time before that transform gets into the buffer (usually a couple of milliseconds).
As a result, when you request a frame transform at time "now", you should wait a few milliseconds for that information to arrive.

2 Wait for transforms
^^^^^^^^^^^^^^^^^^^^^
2 Fix the listener node
^^^^^^^^^^^^^^^^^^^^^^^

tf2 provides a nice tool that will wait until a transform becomes available.
You use this by adding a timeout parameter to ``lookupTransform()``.
Expand All @@ -108,8 +108,8 @@ To fix this, edit your code as shown below (add the last timeout parameter):
The ``lookupTransform()`` can take four arguments, where the last one is an optional timeout.
It will block for up to that duration waiting for it to timeout.

3 Checking the results
^^^^^^^^^^^^^^^^^^^^^^
3 Check the results
^^^^^^^^^^^^^^^^^^^

You can now build the package and run the launch file.

Expand Down
100 changes: 0 additions & 100 deletions source/Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Py.rst

This file was deleted.

6 changes: 2 additions & 4 deletions source/Tutorials/Intermediate/Tf2/Tf2-Main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ If you want to learn both C++ and Python, you should go through the tutorials on
Writing-A-Tf2-Listener-Cpp
Adding-A-Frame-Py
Adding-A-Frame-Cpp
Learning-About-Tf2-And-Time-Py
Learning-About-Tf2-And-Time-Cpp
Time-Travel-With-Tf2-Py
Time-Travel-With-Tf2-Cpp
Debugging-Tf2-Problems
Quaternion-Fundamentals
Expand Down Expand Up @@ -65,12 +63,12 @@ Learning tf2

This tutorial teaches you how to add an extra fixed frame to tf2.

#. Using time :doc:`(Python) <Learning-About-Tf2-And-Time-Py>` :doc:`(C++) <Learning-About-Tf2-And-Time-Cpp>`.
#. Using time :doc:`(C++) <Learning-About-Tf2-And-Time-Cpp>`.

This tutorial teaches you to use the timeout in ``lookup_transform`` function to
wait for a transform to be available on the tf2 tree.

#. Traveling in time :doc:`(Python) <./Time-Travel-With-Tf2-Py>` :doc:`(C++) <./Time-Travel-With-Tf2-Cpp>`.
#. Traveling in time :doc:`(C++) <./Time-Travel-With-Tf2-Cpp>`.

This tutorial teaches you about advanced time travel features of tf2.

Expand Down
122 changes: 0 additions & 122 deletions source/Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Py.rst

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e
^^^^^^^^^^^^^^^^^^^^^^^

Now create a launch file for this demo.
Create a ``launch`` folder in the ``src/learning_tf2_cpp`` directory.
With your text editor, create a new file called ``turtle_tf2_demo_launch.py`` in the ``launch`` folder, and add the following lines:

.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Add the following line between the ``'console_scripts':`` brackets:
^^^^^^^^^^^^^^^^^^^^^^^

Now create a launch file for this demo.
Create a ``launch`` folder in the ``src/learning_tf2_py`` directory
Create a ``launch`` folder in the ``src/learning_tf2_py`` directory.
With your text editor, create a new file called ``turtle_tf2_demo_launch.py`` in the ``launch`` folder, and add the following lines:

.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e
2 Update the launch file
^^^^^^^^^^^^^^^^^^^^^^^^

Open the launch file called ``turtle_tf2_demo_launch.py`` with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports.
Open the launch file called ``turtle_tf2_demo_launch.py`` in the ``src/learning_tf2_cpp/launch`` directory with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports.
The resulting file should look like:

.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ Add the following line between the ``'console_scripts':`` brackets:
2 Update the launch file
^^^^^^^^^^^^^^^^^^^^^^^^

Open the launch file called ``turtle_tf2_demo_launch.py`` with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports.
Open the launch file called ``turtle_tf2_demo_launch.py`` in the ``src/learning_tf2_py/launch`` directory with your text editor, add two new nodes to the launch description, add a launch argument, and add the imports.
The resulting file should look like:

.. code-block:: python
Expand Down
Loading

0 comments on commit 7533eda

Please sign in to comment.