Deploying a Zenoh router on each host isn’t always necessary. In some cases, you may prefer a direct connection between your robot and a single remote Node (e.g., rviz2
).
This can be achieved by configuring the Node’s Zenoh session to connect directly to the robot’s router, as shown below:
Partner with another attendee and decide who will connect their container (A) to the other’s container (B). The attendee with container B needs to create a configuration file for the Listener Node to connect to the router in container A:
zenoh_confs/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5
to zenoh_confs/SESSION_CONFIG.json5
Edit zenoh_confs/SESSION_CONFIG.json5
and set a connect.endpoints
configuration as follows (Replace <host_A_IP>
with the IP address of the host running container A):
connect: {
endpoints: [
"tcp/<host_A_IP>:7447"
],
},
The attendee with container A has nothing to do. By default the Zenoh router is listening to incoming TCP connections on port 7447 via any network interface.
Now, run the following commands in each container:
ros2 run rmw_zenoh_cpp rmw_zenohd
ros2 run demo_nodes_cpp talker
ZENOH_SESSION_CONFIG_URI=/ros_ws/zenoh_confs/SESSION_CONFIG.json5 ros2 run demo_nodes_cpp listener
What happens if you stop the router in container A, and why ?
How to fix this ?