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

nros-bridge.toml — bridge configuration schema

Consumed by nros::run_from_config (Rust) and the future C/C++ mirror (nros::run_from_config in nros-cpp).

Not the orchestration nros.toml. This is the bridge runtime config (multi-RMW byte forwarding). It is named nros-bridge.toml to avoid colliding with the orchestration nros.toml (component/system build config) — different lifecycle, different schema.

The file lives next to the binary (or anywhere the program can read it) and selects:

  1. Which RMW backends to open, under what locator / domain.
  2. How those backends are wired into bridge entries that forward traffic between them.

The binary’s Cargo.toml (or target_link_libraries) still selects which backends are linked — the TOML file selects which of the linked backends are used in this run. Backend names in the file that don’t match a linked backend surface as ConfigError::OpenSession.

Top-level structure

# nros-bridge.toml — sibling of the binary
[[node]]
name    = "field"
rmw     = "zenoh"
locator = "tcp/10.0.0.1:7447"

[[node]]
name    = "control"
rmw     = "cyclonedds"
locator = "domain=0"

[[bridge]]
type      = "std_msgs/Int32"
type_hash = "RIHS01_..."
from      = { node = "field",   topic = "/sensor/raw" }
to        = { node = "control", topic = "/sensor/raw" }

Run via:

fn main() -> Result<(), nros_bridge::ConfigError> {
    nros_bridge::run_from_config("nros-bridge.toml")
    // or, via the umbrella feature: nros::run_from_config("nros-bridge.toml")
}

[[node]]

One block per backend session. The first [[node]] becomes the primary session (extra_sessions[0] in Executor::open_multi); the rest open as extras keyed by rmw.

KeyTypeDefaultNotes
namestringrequiredLogical name. Bridge entries reference this.
rmwstringrequiredCanonical backend name: "zenoh", "xrce", "cyclonedds". Must match a backend the binary linked in.
locatorstring""Backend-specific locator. Zenoh uses tcp/..., udp4/..., serial/...; DDS uses domain=<n>; XRCE uses udp4://...:port.
domain_idu320ROS domain id passed to the backend.
namespacestring"/"Default namespace applied to handles created on this node.

Locator scheme grammar (zenoh)

SchemeExampleMeaning
tcp/<host>:<p>tcp/10.0.0.1:7447TCP unicast
udp/<host>:<p>udp/10.0.0.1:7447UDP unicast
serial/<dev>serial//dev/ttyUSB0UART (host-side) or board UART (bare-metal)
tls/<host>:<p>tls/router.example.org:7447TLS over TCP (requires link-tls on backend)

DDS / XRCE follow their native locator conventions; consult each backend’s docs for the exact form.

[[bridge]]

One block per topic forwarded between two [[node]]s. Each bridge creates a RawSubscription on the source side and an EmbeddedRawPublisher on the destination side and pumps bytes once per executor tick.

KeyTypeDefaultNotes
typestringrequiredROS type name ("std_msgs/Int32"). Backends use it for liveliness / discovery.
type_hashstring""ROS 2 RIHS type hash for the typed binding. May be left empty if both sides ignore it.
fromendpointrequired{ node = "<name>", topic = "<topic>" }. The source node + topic.
toendpointrequired{ node = "<name>", topic = "<topic>" }. The destination node + topic.

Bidirectional bridges are two [[bridge]] entries — one in each direction. The runtime stamps a bridge_origin attachment field on forwarded frames and drops on receive when the origin matches the local backend, so an echo pair does not loop.

Error semantics

run_from_config returns ConfigError:

VariantCause
IoFile read failed (missing / unreadable).
ParseTOML malformed or a required field missing.
UnknownNodeA [[bridge]] references a node name no [[node]] declared.
OpenSessionExecutor::open_multi rejected a spec — usually a backend name no RMW_INIT_ENTRIES entry registered under.
BuildNodecreate_node_on failed (registry exhausted, name too long, …).
BuildEntityCreating the source subscription or destination publisher failed (typically backend rejection of the topic name / type / QoS).

Any error short-circuits the runtime; bridges that opened cleanly before the failure are not pumped.

Linked-backend matrix

Backend nameCargo dep that contributes the RMW_INIT_ENTRIES entry
zenohnros-rmw-zenoh = { ... }
xrcenros-rmw-xrce-cffi = { ... }
cycloneddsnros-rmw-cyclonedds static lib (CMake side, --whole-archive)

Add a backend to your Cargo.toml (or target_link_libraries) to make its name available in the TOML; remove it to fence off use even when the TOML file lists it (yields OpenSession at startup).