Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions source/Tutorials/Advanced/Discovery-Server/Discovery-Server.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,13 +203,31 @@ In several terminals, run the following code to establish a communication with r

.. code-block:: console

$ fastdds discovery --server-id 0 --ip-address 127.0.0.1 --port 11811
$ fastdds discovery --server-id 0 --udp-address 127.0.0.1 --udp-port 11811

.. code-block:: console

$ fastdds discovery --server-id 1 --ip-address 127.0.0.1 --port 11888
$ fastdds discovery --server-id 1 --udp-address 127.0.0.1 --udp-port 11888

``--server-id N`` means server with id N. When referencing the servers with ``ROS_DISCOVERY_SERVER``, server ``0`` must be in first place and server ``1`` in second place.
.. important::

**Understanding Server ID Mapping**

The ``ROS_DISCOVERY_SERVER`` environment variable uses a **semicolon-separated list** where each position corresponds to a server ID.
The server ID is determined by the **index position** (0-based) in this semicolon-delimited list, NOT by the order servers appear.

* Server with ``--server-id 0``: First position (no leading semicolon needed)
* Server with ``--server-id 1``: Second position (one leading semicolon)
* Server with ``--server-id 2``: Third position (two leading semicolons)

**Examples:**

* For ``--server-id 0``: ``ROS_DISCOVERY_SERVER="127.0.0.1:11811"``
* For ``--server-id 1``: ``ROS_DISCOVERY_SERVER=";127.0.0.1:11888"``
* For ``--server-id 2``: ``ROS_DISCOVERY_SERVER=";;127.0.0.1:11999"``
* For multiple servers (0 and 1): ``ROS_DISCOVERY_SERVER="127.0.0.1:11811;127.0.0.1:11888"``

If the server ID doesn't match the position in the environment variable, clients will not be able to connect to the server.

.. tabs::

Expand Down Expand Up @@ -263,7 +281,7 @@ In different terminals, run the following code to establish a communication with

.. code-block:: console

$ fastdds discovery --server-id 0 --ip-address 127.0.0.1 --port 11811 --backup
$ fastdds discovery --server-id 0 --udp-address 127.0.0.1 --udp-port 11811 --backup

.. tabs::

Expand Down Expand Up @@ -324,13 +342,13 @@ Run the first server listening on localhost with the default port of 11811.

.. code-block:: console

$ fastdds discovery --server-id 0 --ip-address 127.0.0.1 --port 11811
$ fastdds discovery --server-id 0 --udp-address 127.0.0.1 --udp-port 11811

In another terminal run the second server listening on localhost using another port, in this case port 11888.

.. code-block:: console

$ fastdds discovery --server-id 1 --ip-address 127.0.0.1 --port 11888
$ fastdds discovery --server-id 1 --udp-address 127.0.0.1 --udp-port 11888

Now, run each node in a different terminal.
Use ``ROS_DISCOVERY_SERVER`` environment variable to decide which server they are connected to.
Expand Down