Skip to content

Commit

Permalink
Document tf2::TimePoint vs rclcpp::Time (ros2#3079)
Browse files Browse the repository at this point in the history
* Document tf2::TimePoint vs rclcpp::Time

Signed-off-by: Shane Loretz <[email protected]>
  • Loading branch information
sloretz authored Oct 5, 2022
1 parent b971c33 commit 3d8b551
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ Open ``turtle_tf2_listener.cpp`` and take a look at the ``lookupTransform()`` ca
tf2::TimePointZero);

You can see that we specified a time equal to 0 by calling ``tf2::TimePointZero``.

.. note::

The ``tf2`` package has it's own time type ``tf2::TimePoint``, which is different from ``rclcpp::Time``.
Many APIs in the package ``tf2_ros`` automatically convert between ``rclcpp::Time`` and ``tf2::TimePoint``.

``rclcpp::Time(0, 0, this->get_clock()->get_clock_type())`` could have been used here, but it would have been converted to ``tf2::TimePointZero`` anyways.

For tf2, time 0 means "the latest available" transform in the buffer.
Now, change this line to get the transform at the current time, ``this->get_clock()->now()``:

Expand Down

0 comments on commit 3d8b551

Please sign in to comment.