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)

# Conflicts:
#	source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp.rst
#	source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Py.rst
#	source/Tutorials/Intermediate/Tf2/Learning-About-Tf2-And-Time-Py.rst
#	source/Tutorials/Intermediate/Tf2/Time-Travel-With-Tf2-Py.rst
#	source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Cpp.rst
#	source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Broadcaster-Py.rst
#	source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Cpp.rst
#	source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Py.rst
  • Loading branch information
clalancette authored and mergify[bot] committed May 7, 2024
1 parent 4812c5c commit 747d852
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 23 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
8 changes: 8 additions & 0 deletions source/Tutorials/Intermediate/Tf2/Adding-A-Frame-Cpp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,11 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e
~~~~~~~~~~~~~~~~~~~~~~~~~

Now let's create a launch file for this example.
<<<<<<< HEAD
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:
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))

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

<<<<<<< HEAD
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:
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))

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

Now let's create a launch file for this example.
<<<<<<< HEAD
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:
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))

.. code-block:: python
Expand Down Expand Up @@ -204,7 +208,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 +430,11 @@ Add the following line between the ``'console_scripts':`` brackets:
2.3 Write the launch file
~~~~~~~~~~~~~~~~~~~~~~~~~

<<<<<<< HEAD
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:
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))

.. 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 @@ -73,7 +73,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 @@ -84,8 +84,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 @@ -103,8 +103,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 run the launch file.

Expand Down
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
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,12 @@ Finally, add the ``install(TARGETS…)`` section so ``ros2 run`` can find your e
^^^^^^^^^^^^^^^^^^^^^^^

Now create a launch file for this demo.
<<<<<<< HEAD
With your text editor, create a new file called ``turtle_tf2_demo.launch.py`` in the ``launch`` folder, and add the following lines:
=======
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:
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))

.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,11 @@ 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.
<<<<<<< HEAD
With your text editor, create a new file called ``turtle_tf2_demo.launch.py`` in the ``launch`` folder, and add the following lines:
=======
With your text editor, create a new file called ``turtle_tf2_demo_launch.py`` in the ``launch`` folder, and add the following lines:
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))

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

<<<<<<< HEAD
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.
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))
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,11 @@ Add the following line between the ``'console_scripts':`` brackets:
2 Update the launch file
^^^^^^^^^^^^^^^^^^^^^^^^

<<<<<<< HEAD
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.
>>>>>>> cb0e0be2 (Remove Tf2 time tutorials for Python (#4384))
The resulting file should look like:

.. code-block:: python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -394,14 +394,14 @@ This tutorial aimed to show how ``StaticTransformBroadcaster`` can be used to pu
In your real development process you shouldn't have to write this code yourself and should use the dedicated ``tf2_ros`` tool to do so.
``tf2_ros`` provides an executable named ``static_transform_publisher`` that can be used either as a commandline tool or a node that you can add to your launchfiles.

Publish a static coordinate transform to tf2 using an x/y/z offset in meters and roll/pitch/yaw in radians.
In our case, roll/pitch/yaw refers to rotation about the x/y/z-axis, respectively.
The following command publishes a static coordinate transform to tf2 using an x/y/z offset in meters and roll/pitch/yaw in radians.
In ROS 2, roll/pitch/yaw refers to rotation about the x/y/z-axis, respectively.

.. code-block:: console
ros2 run tf2_ros static_transform_publisher --x x --y y --z z --yaw yaw --pitch pitch --roll roll --frame-id frame_id --child-frame-id child_frame_id
Publish a static coordinate transform to tf2 using an x/y/z offset in meters and quaternion.
The following command publishes a static coordinate transform to tf2 using an x/y/z offset in meters and roll/pitch/yaw as a quaternion.

.. code-block:: console
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -413,14 +413,14 @@ This tutorial aimed to show how ``StaticTransformBroadcaster`` can be used to pu
In your real development process you shouldn't have to write this code yourself and should use the dedicated ``tf2_ros`` tool to do so.
``tf2_ros`` provides an executable named ``static_transform_publisher`` that can be used either as a commandline tool or a node that you can add to your launchfiles.

Publish a static coordinate transform to tf2 using an x/y/z offset in meters and roll/pitch/yaw in radians.
In our case, roll/pitch/yaw refers to rotation about the x/y/z-axis, respectively.
The following command publishes a static coordinate transform to tf2 using an x/y/z offset in meters and roll/pitch/yaw in radians.
In ROS 2, roll/pitch/yaw refers to rotation about the x/y/z-axis, respectively.

.. code-block:: console
ros2 run tf2_ros static_transform_publisher --x x --y y --z z --yaw yaw --pitch pitch --roll roll --frame-id frame_id --child-frame-id child_frame_id
Publish a static coordinate transform to tf2 using an x/y/z offset in meters and quaternion.
The following command publishes a static coordinate transform to tf2 using an x/y/z offset in meters and roll/pitch/yaw as a quaternion.

.. code-block:: console
Expand Down

0 comments on commit 747d852

Please sign in to comment.