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

Networking

Configure ros-z's Zenoh transport layer for optimal performance in your deployment environment. ros-z uses router-based architecture by default, matching ROS 2's official rmw_zenoh_cpp middleware for production-ready scalability.

Router-Based Architecture

ros-z uses a centralized Zenoh router for node discovery and communication, providing:

BenefitDescription
ScalabilityCentralized discovery handles large deployments efficiently
Lower Network OverheadTCP-based discovery instead of multicast broadcasts
ROS 2 CompatibilityMatches rmw_zenoh_cpp behavior for seamless interoperability
Production ReadyBattle-tested configuration used in real robotics systems

Quick Start

The simplest way to get started is using the built-in router example:

Terminal 1 - Start the Router:

cargo run --example zenoh_router

Terminal 2 - Run Your Application:

use ros_z::context::ZContextBuilder;
use ros_z::Builder;

// Uses default ROS session config (connects to tcp/localhost:7447)
let ctx = ZContextBuilder::default().build()?;
let node = ctx.create_node("my_node").build()?;

Success

That's it! The default configuration automatically connects to the router on tcp/localhost:7447.

Running the Zenoh Router

Option 1: Built-in Router Example

ros-z provides a built-in router example that's ROS-compatible out of the box.

cargo run --example zenoh_router

Listens on tcp/[::]:7447 (all interfaces, port 7447).

Option 2: Official Zenoh Router

You can also use the official Zenoh router: https://zenoh.io/docs/getting-started/installation/#installing-the-zenoh-router.

Next Steps

Choose the configuration approach that fits your needs:

Ready to optimize your deployment? Experiment with different configurations and measure performance impact.