We also prepared a full tutorial within the ROS Docs:
I was re-reading this for a separate thing and I think you may find this interesting, specially Modifying remote servers list at run time. You can read more about it here.
Hi, what’s in the tutorial works in the localhost setting but not across multiple machines (in the same network). Can you guess what I am missing?
Hi @yjkim046,
I don’t know what exactly is that you’re doing but I can tell you what you’d need to modify to make the example work across machines:
- The discovery server should listen in an IP on the same LAN as the other machines. You can specify the server’s listening address with the
--ip-addressoption. - When setting the
ROS_DISCOVERY_SERVERenvironment variable, you should set it to the listening address of the server.
Let’s say you have 3 machines with the following IPs:
| Machine | IP | Application run |
|---|---|---|
| A | 192.168.1.10 | Discovery Server |
| B | 192.168.1.11 | talker |
| C | 192.168.1.12 | listener |
Then, you’d need to run:
Machine A
fastdds discovery -i 0 --ip-address 192.168.1.10
Machine B
export ROS_DISCOVERY_SERVER="192.168.1.10:11811"
ros2 run demo_nodes_cpp talker
Machine C
export ROS_DISCOVERY_SERVER="192.168.1.10:11811"
ros2 run demo_nodes_cpp listener
hi, i also use the same way to you(ros2 humble). but i run the Discovery Server and talker on same machine(like 192.168.1.10), run listener on another machine(192.168.1.11). but it cant communication. do you have any good idea?
