Skip to content

Commit 8741b54

Browse files
committed
Refs #20629: Update ROS 2 Use case
Signed-off-by: cferreiragonz <carlosferreira@eprosima.com>
1 parent d6e0ff1 commit 8741b54

2 files changed

Lines changed: 25 additions & 31 deletions

File tree

docs/fastdds/ros2/discovery_server/ros2_discovery_server.rst

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,14 @@ which allows to launch a server. This server will manage the discovery process f
107107
Setup Discovery Server
108108
^^^^^^^^^^^^^^^^^^^^^^^
109109

110-
Start by launching a server with id 0, with port 11811 and listening on all available interfaces.
110+
Start by launching a server with port 11811 and listening on all available interfaces, which is the default
111+
configuration for the ``fastdds`` :ref:`CLI tool <ffastddscli_cli>`.
111112

112113
Open a new terminal and run:
113114

114115
.. code-block:: console
115116
116-
fastdds discovery -i 0
117+
fastdds discovery
117118
118119
119120
Launch node listener
@@ -126,7 +127,7 @@ In a new terminal, set the environment variable ``ROS_DISCOVERY_SERVER`` to use
126127

127128
.. code-block:: console
128129
129-
export ROS_DISCOVERY_SERVER="127.0.0.1:11811"
130+
export ROS_DISCOVERY_SERVER=127.0.0.1:11811
130131
131132
Afterwards, launch the listener node. Use the argument ``--remap __node:=listener_discovery_server``
132133
to change the node's name for future purpose.
@@ -146,7 +147,7 @@ Open a new terminal and set the environment variable as before, so the node rais
146147

147148
.. code-block:: console
148149
149-
export ROS_DISCOVERY_SERVER="127.0.0.1:11811"
150+
export ROS_DISCOVERY_SERVER=127.0.0.1:11811
150151
ros2 run demo_nodes_cpp talker --ros-args --remap __node:=talker_discovery_server
151152
152153
Now, we should see the talker publishing *Hello World* messages, and the listener receiving these messages.
@@ -199,14 +200,11 @@ In different terminals, run the next code to establish a communication over redu
199200

200201
.. code-block:: console
201202
202-
fastdds discovery -i 0 -l 127.0.0.1 -p 11811
203+
fastdds discovery -l 127.0.0.1 -p 11811
203204
204205
.. code-block:: console
205206
206-
fastdds discovery -i 1 -l 127.0.0.1 -p 11888
207-
208-
``-i N`` means server with id N. When referencing the servers with ``ROS_DISCOVERY_SERVER``,
209-
server ``0`` must be in first place and server ``1`` in second place.
207+
fastdds discovery -l 127.0.0.1 -p 11888
210208
211209
.. code-block:: console
212210
@@ -234,7 +232,7 @@ In different terminals, run the next code to establish a communication over a ba
234232

235233
.. code-block:: console
236234
237-
fastdds discovery -i 0 -l 127.0.0.1 -p 11811 -b
235+
fastdds discovery -l 127.0.0.1 -p 11811 -b
238236
239237
.. code-block:: console
240238
@@ -271,20 +269,20 @@ share *Server 1*.
271269
But *Listener 2* will not hear the messages from *Talker 2* because they do not
272270
share any server or servers' network that connect them.
273271

274-
Run the first server listening in localhost in default port 11811.
272+
Run the first server listening in localhost on default port 11811.
275273

276274
.. code-block:: console
277275
278-
fastdds discovery -i 0 -l 127.0.0.1 -p 11811
276+
fastdds discovery -l 127.0.0.1 -p 11811
279277
280-
In another terminal run the second server listening in localhost in port another port, in this case 11888.
278+
In another terminal run the second server listening in localhost on another port, in this case 11888.
281279

282280
.. code-block:: console
283281
284-
fastdds discovery -i 1 -l 127.0.0.1 -p 11888
282+
fastdds discovery -l 127.0.0.1 -p 11888
285283
286284
Now, run each node in a different terminal. Use the *environment variable* ``ROS_DISCOVERY_SERVER`` to decide which
287-
server they are connected to. Be aware that the ids must match (:ref:`env_vars`).
285+
server they are connected to.
288286

289287
.. code-block:: console
290288
@@ -360,19 +358,19 @@ First of all, instantiate a Discovery Server using :ref:`Fast DDS CLI<cli_discov
360358

361359
.. code-block:: console
362360
363-
fastdds discovery -i 0 -l 127.0.0.1 -p 11811
361+
fastdds discovery -l 127.0.0.1 -p 11811
364362
365363
Run a talker and a listener that will discover each other through the Server (notice that ``ROS_DISCOVERY_SERVER``
366364
configuration is the same as the one in `super_client_configuration_file.xml`).
367365

368366
.. code-block:: console
369367
370-
export ROS_DISCOVERY_SERVER="127.0.0.1:11811"
368+
export ROS_DISCOVERY_SERVER=127.0.0.1:11811
371369
ros2 run demo_nodes_cpp listener --ros-args --remap __node:=listener
372370
373371
.. code-block:: console
374372
375-
export ROS_DISCOVERY_SERVER="127.0.0.1:11811"
373+
export ROS_DISCOVERY_SERVER=127.0.0.1:11811
376374
ros2 run demo_nodes_cpp talker --ros-args --remap __node:=talker
377375
378376
Then, instantiate a ROS 2 Daemon using the **Super Client** configuration (remember to source ROS 2 installation in
@@ -408,18 +406,18 @@ First, run a **Server**:
408406

409407
.. code-block:: console
410408
411-
fastdds discovery -i 0 -l 127.0.0.1 -p 11811
409+
fastdds discovery -l 127.0.0.1 -p 11811
412410
413411
Then, run the talker and listener is separate terminals:
414412

415413
.. code-block:: console
416414
417-
export ROS_DISCOVERY_SERVER="127.0.0.1:11811"
415+
export ROS_DISCOVERY_SERVER=127.0.0.1:11811
418416
ros2 run demo_nodes_cpp listener --ros-args --remap __node:=listener
419417
420418
.. code-block:: console
421419
422-
export ROS_DISCOVERY_SERVER="127.0.0.1:11811"
420+
export ROS_DISCOVERY_SERVER=127.0.0.1:11811
423421
ros2 run demo_nodes_cpp talker --ros-args --remap __node:=talker
424422
425423
Continue using the ROS 2 CLI with ``--no-daemon`` option with the new configuration.

docs/fastdds/ros2/discovery_server/super_client_configuration_file.xml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,12 @@
77
<discovery_config>
88
<discoveryProtocol>SUPER_CLIENT</discoveryProtocol>
99
<discoveryServersList>
10-
<RemoteServer prefix="44.53.00.5f.45.50.52.4f.53.49.4d.41">
11-
<metatrafficUnicastLocatorList>
12-
<locator>
13-
<udpv4>
14-
<address>127.0.0.1</address>
15-
<port>11811</port>
16-
</udpv4>
17-
</locator>
18-
</metatrafficUnicastLocatorList>
19-
</RemoteServer>
10+
<locator>
11+
<udpv4>
12+
<address>127.0.0.1</address>
13+
<port>11811</port>
14+
</udpv4>
15+
</locator>
2016
</discoveryServersList>
2117
</discovery_config>
2218
</builtin>

0 commit comments

Comments
 (0)