Skip to content

feat(zenoh): inbound ros2:// links (design 053 s10) - #312

Merged
lxsaah merged 2 commits into
feat/aimdb-zenoh-connectorfrom
feat/053-s10-ros2-inbound
Oct 9, 2026
Merged

lxsaah merged 2 commits into
feat/aimdb-zenoh-connectorfrom
feat/053-s10-ros2-inbound

Conversation

@lxsaah

@lxsaah lxsaah commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Stage s10 of docs/design/053-implementation-plan.md: inbound ros2:// (053 §4.3). It removes s09's temporary "inbound not supported yet" refusal.

What it does

builder.configure::<SpindleCommand>("cell4.spindle.cmd", |reg| {
    reg.buffer(BufferCfg::Mailbox).linked_from("ros2://cell4/spindle_cmd");
});
  • Routes: InboundDispatch::new(db, "ros2", &ExactGrammar), with each route's facts read from routes(), the API from s04.
  • One subscription token (MS) per inbound link, carrying that link's QoS. Entity ids continue after the publishers'.
  • One Zenoh subscriber per distinct topic, on its rmw_zenoh data key and remote-only. Its callback dispatches each put under the link topic, so core's exact router hands the value to every record linked to that topic. Deletes are ignored, and the attachment isn't needed on the way in.
  • Shared checks: link() holds what both directions verify: a valid ROS topic name, a registered type, CDR on the wire, and the QoS overrides. Outbound adds its topic-writer refusal; inbound adds the two below.

Refusals (criterion 9, inbound rows)

Mistake Result
A {…} pattern on ros2:// ExactGrammar refuses it in InboundDispatch::new
Two links on one topic with different ROS types build() error naming both types
Non-CDR inbound codec (linked_from_with(url, Json)) build() error
Unregistered type build() error
Custom deserializer builds, with a warning: the escape hatch

The custom-serializer and custom-deserializer warning is now a value that the planning step returns and build() logs once the configuration is valid. A unit test covers it for both cases, with the serializer alone and after a codec verb (whose recorded format it clears). No log capture is needed.

Tests

  • tests/ros2_inbound.rs:

    • Against an in-process router: two records linked from one topic, in domain 7 under /cell4. Both MS tokens are present (entity ids 1 and 2, default QoS). A remote delete() followed by a CDR put delivers the value to both records, and the delete delivers nothing.
    • Every refusal above.
    • A custom deserializer builds.
  • Unit test: codec_warning returns nothing for cdr, a warning when no format is recorded, and an error for any other format.

  • Live ROS, with the new examples/ros2_listener.rs against Jazzy's and Lyrical's rmw_zenohd:

    • ros2 topic info -v /aimdb_cmd lists the subscription: node listener, namespace /aimdb, the type hash, KEEP_LAST (10);
    • all three messages from ros2 topic pub --times 3 arrive at the record.

    The first attempt looked empty only because the ROS CLI containers need about 20 s; I'd waited 16.

Checks

The full matrix runs in CI on this PR. Locally, as a quick signal only: the library tests (22 passed), ros2_inbound (3) and ros2_outbound (5), and cargo fmt --all -- --check.

🤖 Generated with Claude Code

lxsaah and others added 2 commits October 9, 2026 19:05
Each inbound link gets a subscription token (MS) with its QoS, after
the publishers' entity ids. One remote-only Zenoh subscriber per
distinct topic, on its rmw_zenoh data key, dispatches every put under
the link topic, so every record linked to the topic receives it;
deletes are ignored.

Both directions share one set of checks (topic name, registered type,
CDR, QoS). Inbound adds: a `{...}` pattern is refused by ExactGrammar,
and two types on one topic fail the build. A custom serializer or
deserializer still warns; the warning is now a value, unit-tested.

Verified live with `examples/ros2_listener.rs` against Jazzy and
Lyrical: `ros2 topic info -v` lists the subscription and every
`ros2 topic pub` message arrives.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lxsaah
lxsaah merged commit b29dbe2 into feat/aimdb-zenoh-connector Oct 9, 2026
8 checks passed
@lxsaah
lxsaah deleted the feat/053-s10-ros2-inbound branch October 9, 2026 19:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant