-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add discovery server minimal example (#154)
* Add discovery server minimal example Signed-off-by: Lucia Echevarria <[email protected]> * Add discovery server minimal example (fixed) Signed-off-by: Lucia Echevarria <[email protected]> * Add discovery server minimal example (changed) Signed-off-by: Lucia Echevarria <[email protected]> * Add discovery server minimal example (changed fixed) Signed-off-by: Lucia Echevarria <[email protected]> * Final changes in structure of Discovery Server tutorial Signed-off-by: Lucia Echevarria <[email protected]> * Final changes in structure of Discovery Server tutorial (changes made) Signed-off-by: Lucia Echevarria <[email protected]> --------- Signed-off-by: Lucia Echevarria <[email protected]> (cherry picked from commit 1ff9136)
- Loading branch information
1 parent
22fab00
commit c913d6e
Showing
4 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
docs/rst/figures/tutorials/core/discovery_server/Discovery_Server.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions
12
docs/rst/tutorials/core/discoveryserver/discoveryserver_tutorials.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
.. _tutorials_discoveryserver_tutorials: | ||
|
||
Discovery Server Tutorials | ||
=========================== | ||
|
||
This section provides some tutorials for creating and utilizing the *FastDDS Discovery Server* to avoid multicast communication in ROS 2 deployments. | ||
They will serve as the starting point for gaining proficiency in working with ROS 2 and the FastDDS middleware. | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
|
||
discoveryserverminimalexample/discovery_server_minimal_example |
86 changes: 86 additions & 0 deletions
86
...coveryserver/discoveryserverminimalexample/discovery_server_minimal_example.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
.. _tutorials_deployment_discovery_server_minimal_example: | ||
|
||
Discovery Server Minimal Example | ||
================================= | ||
|
||
.. contents:: | ||
:depth: 2 | ||
:local: | ||
:backlinks: none | ||
|
||
Background | ||
---------- | ||
|
||
By default, ROS 2 uses the Simple Discovery Protocol (SDP), which relies on multicast communication to discover other nodes. | ||
While SDP is suitable for many scenarios, it may not be the best choice in complex and large-scale network configurations. | ||
This is where the Fast DDS Discovery Server comes into play. Fast DDS offers an alternative discovery mechanism that allows ROS 2 nodes to connect to a Discovery Server. | ||
This server acts as a centralized point for node registration and discovery, providing more flexibility and control in managing the network of nodes and is particularly advantageous in scenarios such as: | ||
|
||
* Large networks | ||
|
||
* Complex networks | ||
|
||
* WiFi networks | ||
|
||
In this tutorial, we will explore how to set up and use the Fast DDS Discovery Server with ROS 2, enabling robust and dynamic node discovery communication. | ||
|
||
.. figure:: /rst/figures/tutorials/core/discovery_server/Discovery_Server.svg | ||
:align: center | ||
:scale: 150% | ||
|
||
|
||
Prerequisites | ||
------------- | ||
|
||
It is required to have previously installed Vulcanexus using one of the following installation methods: | ||
|
||
* `Linux binary installation <https://docs.vulcanexus.org/en/latest/rst/installation/linux_binary_installation.html>`__ | ||
* `Linux installation from sources <https://docs.vulcanexus.org/en/latest/rst/installation/linux_source_installation.html>`__ | ||
* `Docker installation <https://docs.vulcanexus.org/en/latest/rst/installation/docker.html>`__ | ||
|
||
|
||
Run this tutorial | ||
------------------ | ||
|
||
Once we finish with the set up of Vulcanexus environment we are ready to start with the *talker-listener* demo tutorial. | ||
In this demo both a ``talker`` and a ``listener`` nodes from the ``demo_nodes_cpp`` ROS 2 package are created: the talker node will publish a "hello world" message every second, while the listener node will listen to these messages. | ||
By sourcing Vulcanexus you will get access to the CLI tool ``fastdds``, together with the ROS 2 environment. | ||
This tool gives access to the `discovery tool <https://fast-dds.docs.eprosima.com/en/latest/fastddscli/cli/cli.html#discovery>`__, which can be used to launch a discovery server. | ||
This server will manage the discovery process for the nodes that connect to it. | ||
|
||
.. important:: | ||
|
||
Do not forget to source ROS 2 every time you open another session to have access to the ROS 2 environment and the CLI tool ``fastdds``. | ||
|
||
|
||
Setup Discovery Server | ||
^^^^^^^^^^^^^^^^^^^^^^ | ||
Start by launching a discovery server with id 0, port 11811 (default port) and listening on all available interfaces. | ||
The role of the server is to re-distribute the clients (and servers) discovery information to their known clients (and servers). | ||
|
||
.. code-block:: bash | ||
fastdds discovery --server-id 0 | ||
Launch Talker Node | ||
^^^^^^^^^^^^^^^^^^^ | ||
Execute the Talker demo to publish on the ``/chatter`` topic. When setting the ``ROS_DISCOVERY_SERVER`` environment variable you are indicating that ROS node should act as a client that connects to a discovery server to discover other nodes on the network. | ||
Use the argument ``--remap __node:=talker_discovery_server`` to change the node’s name for this tutorial. | ||
|
||
.. code-block:: bash | ||
export ROS_DISCOVERY_SERVER=127.0.0.1:11811 | ||
ros2 run demo_nodes_cpp talker --ros-args --remap __node:=talker_discovery_server | ||
Launch Listener Node | ||
^^^^^^^^^^^^^^^^^^^^^ | ||
Execute the Listener demo to listen to the ``/chatter`` topic. | ||
|
||
.. code-block:: bash | ||
export ROS_DISCOVERY_SERVER=127.0.0.1:11811 | ||
ros2 run demo_nodes_cpp listener --ros-args --remap __node:=listener_discovery_server | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters