You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: source/Tutorials/Intermediate/Tf2/Writing-A-Tf2-Listener-Cpp.rst
+8-4
Original file line number
Diff line number
Diff line change
@@ -111,7 +111,7 @@ Open the file using your preferred text editor.
111
111
112
112
// Call on_timer function every second
113
113
timer_ = this->create_wall_timer(
114
-
1s, [this](){return this->on_timer();});
114
+
1s, [this](){return this->on_timer();});
115
115
}
116
116
117
117
private:
@@ -212,7 +212,7 @@ Open the file using your preferred text editor.
212
212
To understand how the service behind spawning turtle works, please refer to :doc:`writing a simple service and client (C++) <../../Beginner-Client-Libraries/Writing-A-Simple-Cpp-Service-And-Client>` tutorial.
213
213
214
214
Now, let's take a look at the code that is relevant to get access to frame transformations.
215
-
The ``tf2_ros`` contains a ``TransformListener`` header file implementation that makes the task of receiving transforms easier.
215
+
The ``tf2_ros`` contains a ``TransformListener`` class that makes the task of receiving transforms easier.
216
216
217
217
.. code-block:: C++
218
218
@@ -235,7 +235,7 @@ We call ``lookup_transform`` method with following arguments:
235
235
236
236
#. The time at which we want to transform
237
237
238
-
Providing ``tf2::TimePointZero()`` will just get us the latest available transform.
238
+
Providing ``tf2::TimePointZero`` will just get us the latest available transform.
239
239
All this is wrapped in a try-catch block to handle possible exceptions.
240
240
241
241
.. code-block:: C++
@@ -244,6 +244,10 @@ All this is wrapped in a try-catch block to handle possible exceptions.
244
244
toFrameRel, fromFrameRel,
245
245
tf2::TimePointZero);
246
246
247
+
The resulting transformation represents the position and orientation of the target turtle relative to ``turtle2``.
248
+
The angle between the turtles is then used to calculate a velocity command to follow the target turtle.
249
+
For more general information about tf2 see also the :doc:`tf2 page in the Concepts section <../../../Concepts/Intermediate/About-Tf2>`.
250
+
247
251
1.2 CMakeLists.txt
248
252
~~~~~~~~~~~~~~~~~~
249
253
@@ -323,7 +327,7 @@ The resulting file should look like:
323
327
),
324
328
])
325
329
326
-
This will declare a ``target_frame`` launch argument, start a broadcaster for second turtle that we will spawn and listener that will subscribe to those transformations.
330
+
This will declare a ``target_frame`` launch argument, start a broadcaster for the second turtle that we will spawn and a listener that will subscribe to those transformations.
0 commit comments