ROS 2 Communication

rmw_zenoh_cpp for communication between robot-side nodes, Docker containers, and external PCs. Use this guide to connect an external PC to the robot and understand how rmw_zenoh_cpp fits into the ROS 2 communication stack.External PC Control
To control AI Sapiens from an external PC, set up the ai_sapiens Docker container on the external PC. Then connect the container's Zenoh client to the Zenoh router running on the robot.
Inside the external PC's ai_sapiens container, set the following environment variable:
export ZENOH_CONFIG_OVERRIDE='transport/shared_memory/enabled=true;mode="client";connect/endpoints=["tcp/robot_ip:7447"]'
Replace robot_ip with the real IP address of the AI Sapiens robot. Use the robot's Wi-Fi IP address when both devices are connected over Wi-Fi, or use the robot's LAN IP address when the external PC is connected through Ethernet.
For example, if the robot's IP address is 192.168.0.42:
export ZENOH_CONFIG_OVERRIDE='transport/shared_memory/enabled=true;mode="client";connect/endpoints=["tcp/192.168.0.42:7447"]'
The ai_sapiens Docker image enables rmw_zenoh_cpp by default. You can check or manually set it with:
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
Keep ROS_DOMAIN_ID consistent across terminals and containers when the AI Sapiens environment expects a specific ROS domain. Even though Zenoh does not rely on DDS multicast discovery, the ROS 2 process environment should remain consistent across the robot-side stack.
What is rmw_zenoh_cpp?
rmw_zenoh_cpp is the ROS 2 RMW (ROS Middleware) implementation package for Zenoh. It maps the ROS 2 middleware API onto Zenoh APIs, so existing ROS 2 publishers, subscribers, services, clients, parameters, and command-line tools can keep using normal ROS 2 interfaces while Zenoh handles discovery and transport. The upstream GitHub repository is named ros2/rmw_zenoh.
Zenoh is a pub/sub/query protocol designed to move data efficiently across local processes, robot networks, edge computers, and cloud systems. For AI Sapiens, this means the robot control software can use normal ROS 2 topics while Zenoh provides a lightweight communication layer that is easier to route across containers and hosts than multicast-heavy DDS discovery.
Main Components
| Component | Role |
|---|---|
rmw_zenoh_cpp | ROS 2 RMW implementation selected by RMW_IMPLEMENTATION=rmw_zenoh_cpp. |
rmw_zenohd | Zenoh router executable packaged with rmw_zenoh_cpp. It provides discovery information and host-to-host routing. |
| Zenoh session | Communication session used internally by ROS 2 contexts. Publishers, subscribers, services, and clients share the session. |
| Zenoh router configuration | Controls how routers listen, connect, and bridge communication between containers, the robot, and remote PCs. |
How Communication Works
- ROS 2 nodes continue to publish and subscribe to normal topics such as
/joint_states,/tf, or controller command topics. rmw_zenoh_cppconverts the ROS 2 middleware calls into Zenoh operations.- A local Zenoh router is normally started so nodes can discover each other.
- On the same host, message data can use direct peer-to-peer paths instead of forcing every sample through the router.
- Across multiple hosts, configure the external PC container as a Zenoh client connected to the robot's Zenoh router endpoint.
Quick Checks
Use these commands inside the ai_sapiens container to confirm that rmw_zenoh_cpp is active and that the ROS graph is visible:
echo $RMW_IMPLEMENTATION
echo $ZENOH_CONFIG_OVERRIDE
ros2 node list
ros2 topic list
ros2 topic echo /joint_states
If topics appear but messages are not flowing, check that:
ZENOH_CONFIG_OVERRIDEuses the robot's real IP address.- The robot and external PC are on the same reachable network.
- Port
7447is reachable from the external PC. - The
ai_sapienscontainer is running with the expected network configuration. - Old ROS 2 daemon state has been stopped with
ros2 daemon stop.