Skip to main content

nros/guide/
ros2_interop.rs

1//! # ROS 2 Interoperability
2//!
3//! nros communicates with standard ROS 2 nodes via `rmw_zenoh_cpp`.  Both
4//! sides connect to the same zenohd router (or peer directly).
5//!
6//! ## Quick start (3 terminals)
7//!
8//! ```bash
9//! # 1. Router
10//! zenohd --listen tcp/127.0.0.1:7447
11//!
12//! # 2. nros talker
13//! cd examples/native/rust/talker
14//! RUST_LOG=info cargo run --features zenoh
15//!
16//! # 3. ROS 2 listener
17//! source /opt/ros/humble/setup.bash
18//! export RMW_IMPLEMENTATION=rmw_zenoh_cpp
19//! ros2 topic echo /chatter std_msgs/msg/Int32 --qos-reliability best_effort
20//! ```
21//!
22//! ## Common issues
23//!
24//! - **Topic not visible** in `ros2 topic list` — nros must declare
25//!   liveliness tokens (handled automatically by the transport layer).
26//!   Verify zenohd is reachable.
27//! - **No messages received** — check that the data key expression uses
28//!   `TypeHashNotSupported` (Humble) not `RIHS01_…` in the data topic.
29//! - **QoS mismatch** — nros defaults to BEST_EFFORT; pass
30//!   `--qos-reliability best_effort` on the ROS 2 subscriber.
31//! - **rmw_zenoh not connecting** — force client mode on the ROS 2 side:
32//!   `export ZENOH_CONFIG_OVERRIDE='mode="client";connect/endpoints=["tcp/127.0.0.1:7447"]'`
33//! - **Humble vs Iron** — Humble uses `TypeHashNotSupported`; Iron+ uses
34//!   `RIHS01_<sha256>` (requires the `ros-iron` feature).