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: docs/source/publishers_and_subscribers.rst
+18-5Lines changed: 18 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,17 +5,30 @@ Publishers and Subscribers: using messages
5
5
6
6
Except for the particulars of the :file:`setup.py` file, the way that publishers and subscribers in ROS2 work in Python, i.e. the explanation in this section, does not depend on :program:`ament_python` or :program:`ament_cmake`.
7
7
8
-
Finally, we reached the point where ROS2 becomes appealing. As you saw in the last section, we can easily create complex interface types using an easy and generic description.
8
+
Finally, we reached the point where :program:`ROS2` becomes appealing. As you saw in the last section, we can easily create complex interface types using an easy and generic description.
9
9
We can use those to provide `interprocess communication <https://en.wikipedia.org/wiki/Inter-process_communication>`_, i.e. two different programs talking to each other, which otherwise can be error-prone and very difficult to implement.
10
10
11
-
ROS2 works on a model in which any number of processes can communicate over a :code:`Topic` that only accepts one message type. Each topic is uniquely identified by a string.
11
+
:program:`ROS2` messages work on a model in which any number of processes can communicate over a :code:`Topic` that only accepts one message type. Each topic is uniquely identified by a string.
12
12
13
13
Then
14
14
15
-
- A program that sends (publishes) information to the topic has a :code:`Publisher`.
16
-
- A program that reads (subscribes) information from a topic has a :code:`Subscriber`.
15
+
- A program that sends (publishes) information to the topic has one or more :code:`Publisher`\(s).
16
+
- A program that reads (subscribes) information from a topic has one or more :code:`Subscriber`\(s).
17
17
18
-
Each Node can have any number of :code:`Publishers` and :code:`Subscribers` and a combination thereof, connecting to an arbitrary number of Nodes. This forms part of the connections in the so-called `ROS graph <https://docs.ros.org/en/humble/Concepts.html#quick-overview-of-ros-2-concepts>`_.
18
+
Each Node can have any number of :code:`Publishers` and :code:`Subscribers` and a combination thereof, connecting to an arbitrary number of Nodes. This forms part of the connections in the so-called `ROS graph <https://docs.ros.org/en/humble/Concepts.html#quick-overview-of-ros-2-concepts>`_. An example is shown below.
19
+
20
+
.. mermaid::
21
+
22
+
%%{init: { "theme" : "dark" }}%%
23
+
graph LR;
24
+
A[Publisher #1] --> B[Topic]
25
+
C[Publisher #2] --> B
26
+
B --> D[Subscriber #1]
27
+
28
+
.. note::
29
+
30
+
This is an abstraction. As long as the information flows in this manner, it does not mean that an entity called ``topic`` must exist.
31
+
In :program:`ROS2`, this type of communication happens, in fact, peer-to-peer.
0 commit comments