rmw-zerodds-shim — ROS 2 RMW implementation

Ships librmw_zerodds.{so,dylib,dll} so that rclcpp/rclpy can use ZeroDDS as the RMW backend via RMW_IMPLEMENTATION=rmw_zerodds_cpp.

Architecture

  rclcpp / rclpy / rclrs
      │  rmw API (REP-2007)
      ▼
  librmw_zerodds.{so,dylib,dll}    ◀── this crate
      │  ZeroDDS C-API (zerodds.h)
      ▼
  libzerodds.{so,dylib,dll}        (crates/zerodds-c-api)
      │  RTPS over UDP/TCP/SHM/UDS
      ▼
  Wire

The REP-2007 mapping (topic mangling, QoS profiles, identifier constraints) comes from crates/ros2-rmw. The wire path is the ZeroDDS DCPS runtime over zerodds-c-api. Discovery runs automatically via SPDP/SEDP.

Capabilities

The shim implements the RMW surface rclcpp drives: initialization, nodes, pub/sub, the service layer (client + service, request/response), wait-sets and guard conditions, and the REP-2009 type hash. No exported entry point returns RMW_RET_UNSUPPORTED.

Build

Standalone (without ROS)

cargo build -p rmw-zerodds-shim --release
ls target/release/librmw_zerodds.*
ls crates/rmw-zerodds-shim/include/rmw_zerodds.h

In a ROS 2 workspace

# 1) Rust build in the ZeroDDS repo
cd ~/zerodds
cargo build -p rmw-zerodds-shim --release

# 2) ament_cmake wrapper in the ROS 2 workspace
mkdir -p ~/ros2_ws/src/rmw_zerodds
cp -r crates/rmw-zerodds-shim/ament/* ~/ros2_ws/src/rmw_zerodds/
cd ~/ros2_ws
ZERODDS_HOME=$HOME/zerodds \
  colcon build --packages-select rmw_zerodds

Usage

. ~/ros2_ws/install/setup.bash
RMW_IMPLEMENTATION=rmw_zerodds_cpp \
  ros2 topic pub /chatter std_msgs/String "data: hello"

# in a second terminal:
RMW_IMPLEMENTATION=rmw_zerodds_cpp \
  ros2 topic echo /chatter std_msgs/String

Distro targets

  • ROS 2 Humble — ament_cmake 1.5.x (Ubuntu 22.04 LTS)
  • ROS 2 Iron — ament_cmake 2.x (Ubuntu 22.04 LTS)
  • ROS 2 Jazzy — ament_cmake 2.x (Ubuntu 24.04 LTS)

The CI job ci/jobs/rmw-distro-build.yml builds all three distros in separate Docker layers.

Symbols

The library exports rmw_zerodds_*-prefixed functions; rclcpp calls them via the ament_cmake plugin wrapper and RMW discovery. Implemented surface:

  • ..._get_implementation_identifier / ..._get_serialization_format
  • ..._init / _shutdown, ..._create_node / _destroy_node
  • ..._create_publisher / _publish, ..._create_subscription / _take
  • ..._create_client / _create_service, _send_request / _take_request / _send_response / _take_response
  • ..._create_wait_set / _wait + guard conditions
  • zero-copy loaning: ..._borrow_loaned_message / _publish_loaned_message / _return_loaned_message
  • ..._compute_type_hash (REP-2009), ..._buffer_free

Tests

cargo test -p rmw-zerodds-shim

14 unit tests (return codes, implementation identifier, serialization format, NULL tolerance, type-hash determinism + collision-resistance).

Status

  • ✅ crate skeleton, cdylib + staticlib + rlib
  • ✅ cbindgen-generated rmw_zerodds.h
  • ✅ ament_cmake wrapper files (ament/CMakeLists.txt + package.xml)
  • ✅ pub/sub pipeline live (against the zerodds-c-api runtime)
  • ✅ service layer + wait-sets + guard conditions
  • ✅ type hash (REP-2009)
  • 🔲 multi-distro live smoke in CI (Humble / Iron / Jazzy ament build)

rmw-zerodds-shim — ROS 2 RMW Implementation

Liefert librmw_zerodds.{so,dylib,dll} so dass rclcpp/rclpy ueber RMW_IMPLEMENTATION=rmw_zerodds_cpp ZeroDDS als RMW-Backend nutzen kann.

Architektur

  rclcpp / rclpy / rclrs
      │  rmw API (REP-2007)
      ▼
  librmw_zerodds.{so,dylib,dll}    ◀── diese Crate
      │  ZeroDDS C-API (zerodds.h)
      ▼
  libzerodds.{so,dylib,dll}        (crates/zerodds-c-api)
      │  RTPS over UDP/TCP/SHM/UDS
      ▼
  Wire

REP-2007-Mapping (Topic-Mangling, QoS-Profile, Identifier-Constraints) kommt aus crates/ros2-rmw. Wire-Pfad ist die ZeroDDS-DCPS-Runtime ueber zerodds-c-api. Discovery laeuft via SPDP/SEDP automatisch.

Fähigkeiten

Der Shim implementiert die RMW-Oberfläche, die rclcpp ansteuert: Initialisierung, Nodes, Pub/Sub, den Service-Layer (Client + Service, Request/Response), Wait-Sets und Guard-Conditions sowie den REP-2009-Type-Hash. Kein exportierter Entry-Point liefert noch RMW_RET_UNSUPPORTED.

Build

Standalone (ohne ROS)

cargo build -p rmw-zerodds-shim --release
ls target/release/librmw_zerodds.*
ls crates/rmw-zerodds-shim/include/rmw_zerodds.h

In einem ROS-2-Workspace

# 1) Rust-Build im ZeroDDS-Repo
cd ~/zerodds
cargo build -p rmw-zerodds-shim --release

# 2) ament_cmake-Wrapper im ROS-2-Workspace
mkdir -p ~/ros2_ws/src/rmw_zerodds
cp -r crates/rmw-zerodds-shim/ament/* ~/ros2_ws/src/rmw_zerodds/
cd ~/ros2_ws
ZERODDS_HOME=$HOME/zerodds \
  colcon build --packages-select rmw_zerodds

Verwendung

. ~/ros2_ws/install/setup.bash
RMW_IMPLEMENTATION=rmw_zerodds_cpp \
  ros2 topic pub /chatter std_msgs/String "data: hello"

# In einem zweiten Terminal:
RMW_IMPLEMENTATION=rmw_zerodds_cpp \
  ros2 topic echo /chatter std_msgs/String

Distro-Targets

  • ROS 2 Humble — ament_cmake 1.5.x (Ubuntu 22.04 LTS)
  • ROS 2 Iron — ament_cmake 2.x (Ubuntu 22.04 LTS)
  • ROS 2 Jazzy — ament_cmake 2.x (Ubuntu 24.04 LTS)

CI-Job ci/jobs/rmw-distro-build.yml baut alle drei Distros in separaten Docker-Layern.

Symbole

Die Library exportiert rmw_zerodds_*-präfixierte Funktionen; rclcpp ruft sie via ament_cmake-Plugin-Wrapper und RMW-Discovery durch. Implementierte Oberfläche:

  • ..._get_implementation_identifier / ..._get_serialization_format
  • ..._init / _shutdown, ..._create_node / _destroy_node
  • ..._create_publisher / _publish, ..._create_subscription / _take
  • ..._create_client / _create_service, _send_request / _take_request / _send_response / _take_response
  • ..._create_wait_set / _wait + Guard-Conditions
  • Zero-Copy-Loaning: ..._borrow_loaned_message / _publish_loaned_message / _return_loaned_message
  • ..._compute_type_hash (REP-2009), ..._buffer_free

Tests

cargo test -p rmw-zerodds-shim

14 Unit-Tests (Return-Codes, Implementation-Identifier, Serialization-Format, NULL-Toleranz, Type-Hash-Determinismus + Kollisions-Resistenz).

Status

  • ✅ Crate-Skeleton, cdylib + staticlib + rlib
  • ✅ cbindgen-generierte rmw_zerodds.h
  • ✅ ament_cmake-Wrapper-Files (ament/CMakeLists.txt + package.xml)
  • ✅ Pub-Sub-Pipeline live (gegen zerodds-c-api-Runtime)
  • ✅ Service-Layer + Wait-Sets + Guard-Conditions
  • ✅ Type-Hash (REP-2009)
  • 🔲 Multi-Distro-Live-Smoke in CI (Humble / Iron / Jazzy ament-Build)