Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Running Examples

Once you've added ros-z to your project, you can run the included examples to see it in action.

Important

All examples require a Zenoh router to be running first (see Networking for why ros-z uses router-based architecture by default):

cargo run --example zenoh_router

Leave this running in a separate terminal, then run any example in another terminal.

Available Examples

# Pure Rust example with custom messages (no ros-z-msgs needed)
cargo run --example z_custom_message -- --mode status-pub

# Examples using bundled messages (requires ros-z-msgs)
cargo run --example z_pubsub          # Publisher/Subscriber with std_msgs
cargo run --example twist_pub         # Publishing geometry_msgs
cargo run --example battery_state_sub # Receiving sensor_msgs
cargo run --example z_srvcli          # Service example with example_interfaces

See the Networking chapter for router setup details and alternative configurations.