Skip to content

Commit 4e36994

Browse files
christophebedardmergify[bot]
authored andcommitted
Add rmw implementation tutorial (#5927)
Signed-off-by: Christophe Bedard <[email protected]> Co-authored-by: gavanderhoorn <[email protected]> Co-authored-by: William Woodall <[email protected]> Co-authored-by: Chris Lalancette <[email protected]> (cherry picked from commit e831830) # Conflicts: # source/Concepts/Advanced/About-Middleware-Implementations.rst
1 parent c357c2f commit 4e36994

File tree

7 files changed

+553
-1
lines changed

7 files changed

+553
-1
lines changed

source/Concepts/Advanced/About-Internal-Interfaces.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ In this context, type support means: meta data or functions that are specific to
6565
The type support for a given message might include things like a list of the names and types for each field in the message.
6666
It might also contain a reference to code that can perform particular tasks for that type, e.g. publish a message.
6767

68+
.. _internal-interfaces_static-type-support:
69+
6870
Static Type Support
6971
^^^^^^^^^^^^^^^^^^^
7072

@@ -84,6 +86,8 @@ For example, consider the Fast DDS implementation, which has a package called ``
8486
This package is responsible for generating code to handle things like converting a C++ message object into a serialized octet buffer to be written over the network.
8587
This code, while specific to Fast DDS, is still not exposed to the user because of the abstraction in the type support code.
8688

89+
.. _internal-interfaces_dynamic-type-support:
90+
8791
Dynamic Type Support
8892
^^^^^^^^^^^^^^^^^^^^
8993

@@ -137,13 +141,14 @@ The ``rmw`` repository
137141

138142
The ROS middleware interface (``rmw`` |API|) is the minimal set of primitive middleware capabilities needed to build ROS on top.
139143
Providers of different middleware implementations must implement this interface in order to support the entire ROS stack on top.
140-
Currently all of the middleware implementations are for different DDS vendors.
144+
Currently most of the middleware implementations are for different DDS vendors.
141145

142146
The ``rmw`` |API| is located in the `ros2/rmw <https://github.com/ros2/rmw>`_ repository.
143147
The ``rmw`` |package| contains the C headers which define the interface, the implementation of which is provided by the various |packages| of rmw implementations for different DDS vendors.
144148

145149
For a definition of the ``rmw`` |API|, see `the rmw docs <http://docs.ros.org/en/{DISTRO}/p/rmw/>`_.
146150

151+
For a more practical in-depth overview of how ROS 2 integrates with different middleware implementations, see :doc:`the middleware implementation tutorial <../../Tutorials/Advanced/Creating-An-RMW-Implementation>`.
147152

148153
The ``rosidl`` repository
149154
-------------------------

source/Concepts/Advanced/About-Middleware-Implementations.rst

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ ROS 2 middleware implementations
1212

1313
ROS middleware implementations are sets of |packages| that implement some of the internal ROS interfaces, e.g. the ``rmw``, ``rcl``, and ``rosidl`` |APIs|.
1414

15+
<<<<<<< HEAD
1516
Common Packages for DDS Middleware Packages
1617
-------------------------------------------
18+
=======
19+
For a more practical in-depth overview of how ROS 2 integrates with different middleware implementations, see :doc:`the middleware implementation tutorial <../../Tutorials/Advanced/Creating-An-RMW-Implementation>`.
20+
21+
Common Packages for DDS Middleware Implementations
22+
--------------------------------------------------
23+
>>>>>>> e831830 (Add rmw implementation tutorial (#5927))
1724

1825
All of the current ROS middleware implementations are based on full or partial DDS implementations.
1926
For example, there is a middleware implementation that uses RTI's Connext DDS and an implementation which uses eProsima's Fast DDS.
@@ -26,7 +33,13 @@ In the `ros2/rosidl_dds <https://github.com/ros2/rosidl_dds>`_ repository on |Gi
2633
The ``rosidl_generator_dds_idl`` |package| generates a DDS ``.idl`` file for each ``rosidl`` file, e.g. ``.msg`` file, defined by |packages| containing messages.
2734
Currently DDS based ROS middleware implementations make use of this generator's output ``.idl`` files to generate pre-compiled type support that is vendor specific.
2835

36+
<<<<<<< HEAD
2937
Structure of ROS Middleware Implementations
38+
=======
39+
.. _about-middleware-impls_struct_dds:
40+
41+
Structure of DDS Middleware Implementations
42+
>>>>>>> e831830 (Add rmw implementation tutorial (#5927))
3043
-------------------------------------------
3144

3245
A ROS middleware implementation is typically made up of a few |packages| in a single repository:
@@ -54,7 +67,55 @@ As such, rmw implementations may provide support for the X-Types standard, and/o
5467

5568
As an example of an rmw implementation repository, the ``Eclipse Cyclone DDS`` ROS middleware implementation is on |GitHub|_ at `ros2/rmw_cyclonedds <https://github.com/ros2/rmw_cyclonedds>`_.
5669

70+
<<<<<<< HEAD
5771
The rmw implementation for ``Fast DDS`` is on |GitHub|_ at `ros2/rmw_fastrtps_cpp <https://github.com/ros2/rmw_fastrtps_cpp>`_.
72+
=======
73+
| The ``Eclipse Cyclone DDS`` ROS middleware implementation is on |GitHub|_ at `ros2/rmw_cyclonedds <https://github.com/ros2/rmw_cyclonedds>`_.
74+
| The RMW implementation for ``Fast DDS`` is on |GitHub|_ at `ros2/rmw_fastrtps_cpp <https://github.com/ros2/rmw_fastrtps_cpp>`_.
75+
| The RMW implementation for ``Connext DDS`` is on |GitHub|_ at `ros2/rmw_connextdds <https://github.com/ros2/rmw_connextdds>`_.
76+
| The RMW implementation for ``GurumDDS`` is on |GitHub|_ at `ros/rmw_gurumdds <https://github.com/ros2/rmw_gurumdds>`_.
77+
78+
.. _about-middleware-impls_struct_zenoh:
79+
80+
Structure of the Zenoh Middleware Implementation
81+
------------------------------------------------
82+
83+
For data to be sent and received over Zenoh using ROS 2, the middleware package, ``rmw_zenoh_cpp``, maps the ROS 2 middleware |API| to Zenoh's |APIs| using `zenoh-c <https://github.com/eclipse-zenoh/zenoh-c>`_.
84+
Unlike DDS-based implementations, this middleware relies on a Zenoh router to discover peers and pass discovery information along via Zenoh's 'gossip scouting'.
85+
Therefore, ``rmw_zenoh_cpp`` requires the Zenoh router (``zenohd``) to be active on the local system or reachable over the network.
86+
87+
In ROS 2's Zenoh integration, each `context <https://docs.ros.org/en/rolling/p/rclcpp/generated/classrclcpp_1_1Context.html>`_ is mapped to a single Zenoh session.
88+
This session is shared across all publishers, subscriptions, services, and clients within that context.
89+
The context maintains a local graph cache that tracks the network topology of ROS 2 entities and the presence of each entity is managed through unique liveliness tokens issued on creation and revoked during destruction.
90+
91+
Here is an inexhaustive list of how the Zenoh middleware |API| adapts ROS 2 entities over its communication protocol:
92+
93+
**Nodes:** Nodes in ROS 2 have been referred to as "units of computation" in a ROS 2 graph, whereby each node should be responsible for a single, modular purpose.
94+
Zenoh has no direct counterpart to the node, so ``rmw_zenoh_cpp`` creates no Zenoh entities for them.
95+
However, when a node is created through the RMW |API|, a liveliness token of type ``NN`` is declared.
96+
97+
**Publishers:** A ROS 2 publisher sends data to a specific topic.
98+
Because Zenoh publishers function very similarly with Keys, ``rmw_zenoh_cpp`` maps these entities directly.
99+
When a publisher is created through the RMW |API|, a liveliness token of type ``MP`` is declared.
100+
101+
**Subscribers:** Subscribers in ROS 2 listen on topics for new data.
102+
They are conceptually equivalent to subscribers in Zenoh so ``rmw_zenoh_cpp`` maps these entities directly.
103+
When new data arrives, Zenoh's middleware |package| invokes an internal callback that takes ownership of the data and signals availability to ``rmw_wait``.
104+
When a subscriber is created through the RMW |API|, a liveliness token of type ``MS`` is declared.
105+
106+
**Service clients:** ``rmw_zenoh_cpp`` uses Zenoh queryables to implement ROS 2 services.
107+
Clients use ``rmw_send_request`` to make requests in ROS 2.
108+
A request will carry metadata that will be used to correlate a response, like its sequence number and the GUID of the client that sent it.
109+
Zenoh's middleware |package| can then use ``z_get`` to send a query out into the network.
110+
When a client is created through the RMW |API|, a liveliness token of type ``SC`` is declared.
111+
112+
**Service server:** ``rmw_zenoh_cpp`` uses Zenoh queryables to implement ROS 2 services.
113+
ROS 2 nodes use ``rmw_create_service`` to advertise services to the network and the Zenoh |API|, ``z_declare_queryable``, is used to create the server-side representation of a ROS 2 service.
114+
``rmw_take_request`` delivers the query to the use callback to be processed and after the computation is complete, ``rmw_send_reponse`` returns the result to the requester.
115+
When a server is created, a liveliness token of type ``SS`` is declared.
116+
117+
The RMW implementation for ``Zenoh`` is on |GitHub|_ at `ros2/rmw_zenoh <https://github.com/ros2/rmw_zenoh/tree/rolling>`_.
118+
>>>>>>> e831830 (Add rmw implementation tutorial (#5927))
58119

59120
The rmw implementation for ``Connext DDS`` is on |GitHub|_ at `ros2/rmw_connextdds <https://github.com/ros2/rmw_connextdds>`_.
60121

source/Concepts/Intermediate/About-Quality-of-Service-Settings.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ The currently defined QoS profiles are:
121121
`Click here <https://github.com/ros2/rmw/blob/{REPOS_FILE_BRANCH}/rmw/include/rmw/qos_profiles.h>`__ for the specific policies in use for the above profiles.
122122
The settings in these profiles are subject to further tweaks, based on the feedback from the community.
123123

124+
.. _about-qos_compatibilities:
124125

125126
QoS compatibilities
126127
-------------------
@@ -279,6 +280,7 @@ Comparison to ROS 1
279280
Historically in ROS 1, any publisher and subscriber with the same message type on the same topic would be connected.
280281
The possibility of incompatible requested and offered QoS profiles is something new to be aware of when using ROS 2.
281282

283+
.. _about-qos_qos-events:
282284

283285
QoS events
284286
----------
@@ -314,6 +316,7 @@ Developers may subscribe to the following QoS events that are associated with a
314316

315317
The subscription has encountered a publisher on the same topic that is offering a QoS profile that does not satisfy the requested QoS profile, resulting in no connection between the subscription and that publisher.
316318

319+
.. _about-qos_matched-events:
317320

318321
Matched events
319322
--------------

source/How-To-Guides/Ament-CMake-Documentation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,6 +459,8 @@ To do so:
459459
Ament extensions work by defining a variable containing the name of the extension point and filling it with the macros to be executed.
460460
Upon calling ``ament_execute_extensions``, the scripts defined in the variable are then executed one after another.
461461

462+
.. _ament-cmake-doc_adding-resources:
463+
462464
Adding resources
463465
----------------
464466

source/How-To-Guides/DDS-tuning.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ Fast RTPS tuning
9696

9797
See the solutions under :ref:`Cross-vendor tuning <cross-vendor-tuning>`.
9898

99+
.. _cyclonedds-tuning:
100+
99101
Cyclone DDS tuning
100102
------------------
101103

source/Tutorials/Advanced.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,6 @@ Advanced
1414
Advanced/Recording-A-Bag-From-Your-Own-Node-Py
1515
Advanced/Reading-From-A-Bag-File-CPP
1616
Advanced/ROS2-Tracing-Trace-and-Analyze
17+
Advanced/Creating-An-RMW-Implementation
1718
Advanced/Simulators/Simulation-Main
1819
Advanced/Security/Security-Main

0 commit comments

Comments
 (0)