hdds-router
DDS Routing Service for domain bridging, topic remapping, and QoS transformation.
Overview
hdds-router enables communication between isolated DDS domains by forwarding messages across domain boundaries. Use cases include:
- Domain Bridging: Connect domains 0 and 1 (e.g., sensor network → control system)
- Topic Remapping: Rename topics during routing (e.g.,
rt/cmd_vel→robot/velocity) - QoS Transformation: Adapt QoS policies between domains (e.g., BestEffort → Reliable)
- Network Segmentation: Selective routing of specific topics
Installation
hdds-router ships in the HDDS repository and is built from a clone of the source:
git clone https://git.hdds.io/hdds/hdds.git
cd hdds
cargo build --release -p hdds-router
The binary is written to target/release/hdds-router in the clone. To install it into ~/.cargo/bin instead:
cargo install --path crates/hdds-router
crates.io carries version 1.1.2 of hdds-router, which predates this release and does not match this page. Build from source as above.
Quick Start
Basic Domain Bridge
Route all topics from domain 0 to domain 1:
hdds-router --from-domain 0 --to-domain 1
Bidirectional Routing
Route topics in both directions:
hdds-router --from-domain 0 --to-domain 1 --bidirectional
Selective Topics
Route only specific topics:
hdds-router --from-domain 0 --to-domain 1 --topics "sensor/*,rt/cmd_vel"
Topic Remapping
Rename topics during routing:
hdds-router --from-domain 0 --to-domain 1 \
--remap "rt/cmd_vel:robot/velocity,sensor/temp:environment/temperature"
CLI Reference
hdds-router [OPTIONS] [COMMAND]
Options:
-c, --config <CONFIG> Configuration file path
--from-domain <FROM_DOMAIN> Source domain ID
--to-domain <TO_DOMAIN> Destination domain ID
-b, --bidirectional Enable bidirectional routing
-t, --topics <TOPICS> Topics to route (comma-separated, or patterns with *)
-r, --remap <REMAP> Topic remappings (format: "from:to", can repeat)
--exclude <EXCLUDE> Exclude topics (comma-separated)
--discovery-server <DOMAIN:ADDR> Discovery Server for a domain (format: "domain_id:host:port", can repeat)
--stats-interval <STATS_INTERVAL> Statistics reporting interval (seconds, 0 to disable) [default: 10]
--log-level <LOG_LEVEL> Log level (trace, debug, info, warn, error) [default: info]
-h, --help Print help
-V, --version Print version
Commands:
gen-config Generate example configuration file
validate Validate a configuration file
status Show routing status (requires running router)
Notes on the options:
--configcannot be combined with--from-domainor--to-domain. Without--config, both domains are required, and they must differ: a route from a domain to itself is refused (Route 0 has same source and destination domain).--topicsand--excludeare alternatives: when both are given,--topicsis used and--excludeis ignored.- A route given on the command line has no QoS transformation: it is available from a configuration file only (see below). Verbosity is set with
--log-level.
Topic Filters
Glob patterns are supported:
| Pattern | Matches |
|---|---|
sensor/* | sensor/temp, sensor/humidity |
rt/*_vel | rt/cmd_vel, rt/linear_vel |
?obot/state | robot/state, Robot/state |
Configuration File
For complex setups, use a TOML configuration file:
# hdds-router.toml
name = "sensor-bridge"
enable_stats = true
stats_interval_secs = 10
log_level = "info"
[[routes]]
from_domain = 0
to_domain = 1
bidirectional = false
[routes.topics]
type = "Include"
value = ["sensor/*", "status/*"]
[[routes.remaps]]
from = "sensor/temperature"
to = "environment/temp_celsius"
[[routes.remaps]]
from = "sensor/humidity"
to = "environment/humidity_pct"
[routes.qos_transform]
reliability = "reliable"
durability = "transient_local"
history_depth = 10
[[routes]]
from_domain = 1
to_domain = 0
bidirectional = false
[routes.topics]
type = "Pattern"
value = "rt/cmd_*"
[routes.qos_transform]
reliability = "reliable"
deadline_us = 100000
lifespan_us = 500000
# Optional: reach a domain through a Discovery Server (same as --discovery-server 1:host:port)
[domains.1]
discovery_server = "192.0.2.10:7400"
The top-level keys are name (default hdds-router), enable_stats (default true), stats_interval_secs (default 10) and log_level (default info). A route needs from_domain and to_domain; bidirectional, topics, remaps and qos_transform are optional.
Topic Selection Modes
The [routes.topics] table selects topics with a type and, except for All, a value:
type | value | Description |
|---|---|---|
All | none | Route all discovered topics (default) |
Include | list, e.g. ["sensor/*", "rt/*"] | Only the listed topics or globs |
Exclude | list, e.g. ["internal/*"] | All except the listed topics or globs |
Pattern | string, e.g. "*_status" | Single glob pattern |
* matches any run of characters and ? exactly one; both are case sensitive.
QoS Transformation
Transform QoS policies during routing:
| Parameter | Type | Description |
|---|---|---|
reliability | "best_effort" | "reliable" | Delivery guarantee |
durability | "volatile" | "transient_local" | Data persistence ("transient" and "persistent" are accepted and applied as transient_local, with a warning) |
history_depth | u32 | Sample history depth |
deadline_us | u64 | Deadline period (microseconds) |
lifespan_us | u64 | Sample lifespan (microseconds) |
Commands
Generate Config
Create an example configuration file:
hdds-router gen-config -o hdds-router.toml
The file is written to -o (default router.toml) and the command prints Generated configuration file: <path> on standard output, so a shell redirect would capture that line, not the TOML.
Validate Config
Check configuration file for errors:
hdds-router validate -c hdds-router.toml
Show Status
hdds-router status does not report anything yet: it prints that the command needs a running router with an admin interface and is planned for a future release. A running router prints its own statistics every --stats-interval seconds (and once more when it stops):
--- Route Statistics ---
Domain 0 -> 1: 12456 msgs (13.8 msg/s), 1.2 MB bytes, 0 dropped, 0 errors
Examples
ROS 2 Domain Bridge
Bridge ROS 2 traffic between robots on different domains:
# Robot 1 (domain 10) <-> Robot 2 (domain 20)
hdds-router --from-domain 10 --to-domain 20 --bidirectional \
--topics "rt/tf,rt/cmd_vel,rt/odom,rt/scan"
Sensor Network Gateway
Route sensor data with QoS upgrade:
# sensor-gateway.toml
[[routes]]
from_domain = 100 # Sensor network (unreliable WiFi)
to_domain = 0 # Control system (wired)
[routes.topics]
type = "Include"
value = ["sensor/*"]
[routes.qos_transform]
reliability = "reliable"
durability = "transient_local"
history_depth = 100
hdds-router -c sensor-gateway.toml
Topic Namespace Migration
Rename legacy topic namespaces while bridging two domains (a route needs two different domains, so a rename inside one domain is not possible):
hdds-router --from-domain 0 --to-domain 1 \
--remap "old/sensor/temp:sensor/temperature,old/sensor/hum:sensor/humidity"
Architecture
Domain 0 Domain 1
┌─────────────┐ ┌─────────────┐
│ Publisher │ │ Subscriber │
│ (sensor/t) │ │ (env/temp) │
└──────┬──────┘ └──────▲──────┘
│ │
│ ┌─────────────────┐ │
└───►│ hdds-router │──────┘
│ │
│ ┌─────────────┐ │
│ │ Route │ │
│ │ - remap │ │
│ │ - qos xform│ │
│ └─────────────┘ │
└─────────────────┘
Limitations
- Same host only: Routes between domains on the same machine
- No cross-network: WAN bridging requires an external gateway; the standalone Discovery Server does not turn this router into a WAN data path
- Type compatibility: Source and destination types must match
Related
- Domain Concepts - DDS domain architecture
- Discovery Server - Automatic UDP-locator rendezvous
- QoS Policies - QoS configuration