Skip to content

Commit cb2c8f1

Browse files
mergify[bot]EsipovPAahcorde
authored
#130 add simple filter tutorial for cpp (backport #239) (#240)
* #130 add simple filter tutorial for cpp (#239) Signed-off-by: EsipovPA <esipov.p@mail.ru> (cherry picked from commit 92af2b7) Signed-off-by: Alejandro Hernandez Cordero <ahcorde@gmail.com> Co-authored-by: Pavel Esipov <38457822+EsipovPA@users.noreply.github.com> Co-authored-by: Alejandro Hernandez Cordero <ahcorde@gmail.com>
1 parent 8619a66 commit cb2c8f1

File tree

5 files changed

+513
-10
lines changed

5 files changed

+513
-10
lines changed

doc/Tutorials/Cache-Cpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ Now open the ``CMakeLists.txt`` add the executable and name it ``cache_tutorial`
293293
294294
ament_auto_add_executable(cache_tutorial src/cache_tutorial.cpp)
295295
296-
Finally, add the install(TARGETS…) section so ros2 run can find your executable:
296+
Finally, add the ``install(TARGETS…)`` section so ros2 run can find your executable:
297297

298298
.. code-block:: CMake
299299

doc/Tutorials/Chain-Cpp.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ Now open the ``CMakeLists.txt`` add the executable and name it ``chain_tutorial`
445445
446446
ament_auto_add_executable(chain_tutorial src/chain_tutorial.cpp)
447447
448-
Finally, add the install(TARGETS…) section so ros2 run can find your executable:
448+
Finally, add the ``install(TARGETS…)`` section so ros2 run can find your executable:
449449

450450
.. code-block:: CMake
451451

doc/Tutorials/Chain-Python.rst

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,14 @@ It allows you to store an N-long set of filters inside a single structure, makin
1111
To demonstrate the functionality of the ``Chain`` filter in a more clear manner, we are going to add a custom filter to this tutorial.
1212
This is going to be the ``CounterFilter`` that will be counting the number of messages passing through it.
1313
This filter class will be a successor to the ``SimpleFilter`` class, but this is a topic for another tutorial.
14-
15-
.. TODO: @EsipovPA: Add message_filters.SimpleFilter tutorial reference, when ready
14+
For more information on this topic, please refer to the `SimpleFilter for Python tutorial <https://docs.ros.org/en/kilted/p/message_filters/doc/Tutorials/SimpleFilter-Python.html>`.
1615

1716
Prerequisites
1817
~~~~~~~~~~~~~
1918

2019
This tutorial assumes you have a working knowledge of ROS 2.
2120

22-
If you have not done so already `create a workspace <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html>`_ and `create a package <https://docs.ros.org/en/rolling/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html>`_
21+
If you have not done so already `create a workspace <https://docs.ros.org/en/kilted/Tutorials/Beginner-Client-Libraries/Creating-A-Workspace/Creating-A-Workspace.html>`_ and `create a package <https://docs.ros.org/en/kilted/Tutorials/Beginner-Client-Libraries/Creating-Your-First-ROS2-Package.html>`_
2322

2423
1. Create a Basic Node
2524
~~~~~~~~~~~~~~~~~~~~~~
@@ -174,8 +173,7 @@ The ``add`` method increases messages count, and passes messages to the followin
174173
The ``connectInput`` connects this filter to a previous filter's output.
175174
The ``counter`` property grants access to the current messages count.
176175

177-
.. More on this succession mechanism should be in the corresponding tutorial
178-
.. TODO: @EsipovPA Add link to the message_filters.SimpleFilter tutorial, when added.
176+
For more information on this succession mechanism, please refer to the `SimpleFilter for Python tutorial <https://docs.ros.org/en/kilted/p/message_filters/doc/Tutorials/SimpleFilter-Python.html>`.
179177

180178
And now we can turn our attention to the main tutorial class, that is the ``ChainNode`` class.
181179
For starters, let's take a look at the ``__init__`` method of this class:
@@ -201,7 +199,7 @@ For starters, let's take a look at the ``__init__`` method of this class:
201199
self.chain_counter = 0
202200
203201
First we declare a Quality of Service profile.
204-
After that we initialize a basic ``ros2`` ``publisher`` that will generate the input for our filters chain.
202+
After that we initialize a basic ``ros2`` ``publisher`` that will generate the input for our filters chain.
205203
The chain is giong to contain three filters.
206204
A ``Subscriber`` filter and two instances of a ``CounterFilter`` that is defined earlier.
207205
We initialize all of those.
@@ -367,7 +365,7 @@ After that the first message passes through the all filters in chain as indicate
367365
368366
From this point on, all three counters increase their values as more messages are passed down the filter chain.
369367

370-
6. Other methods of the Chain filter interface
368+
6. Other methods of the Chain filter interface
371369
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
372370

373371
In this example we've passed the ``subscriber_filter`` object to the ``chain_filter`` as a constructor argument.
@@ -380,7 +378,7 @@ In this case, the ``subscriber_filter`` was used as an input filter for the ``ch
380378
The other way to do it is by calling ``connectInput`` method of the ``Chain`` class.
381379

382380
.. code-block:: python
383-
381+
384382
self.chain_filter = Chain()
385383
self.subscriber = Subscriber()
386384
self.chain_filter.connectInput(self.subscriber)

0 commit comments

Comments
 (0)