Repository navigation
feat(zenoh): Ros2Connector for outbound ros2:// links (design 053 s09) - #311
Merged
Merged
Conversation
`Ros2Connector::new(endpoint, Ros2Node::new(name).namespace(ns))` with `.domain_id(n)` (else ROS_DOMAIN_ID, else 0) and `.register::<T: RosMessage>()`. Each outbound link becomes a ROS publisher: rmw_zenoh data key, node and publisher liveliness tokens declared before the first put, and the 33-byte attachment (sequence from 1, wall-clock timestamp, GID). `Ros2LinkExt` sets depth and advertised reliability. build() refuses: an unregistered type, a type whose Linkable is not CDR or whose names are malformed, a non-CDR link codec, a topic writer, ROS name violations, a bad ROS_DOMAIN_ID, and inbound ros2:// links (s10). A custom serializer warns. `register` on a non-RosMessage type is a compile error, now with an `on_unimplemented` message. The profile's tokens are built in one allocation each (Display adapters). Verified live with `examples/ros2_talker.rs` against Jazzy and Lyrical. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Stage PRs are checked in CI instead of a local `make check`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
clippy::for_unbounded_range. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ability From the #311 review: - An empty or blank ROS_DOMAIN_ID means unset, as in rcl: domain 0. - A domain above 232, from domain_id(..) or ROS_DOMAIN_ID, fails the build and names its source. - `Reliability` is the profile's own enum, public in every build; the duplicate in ros2.rs and its string round trip are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage s09 of
docs/design/053-implementation-plan.md: outboundros2://(053 §4.2–4.4, §5.1, §6).The connector
Ros2Node: a name and a namespace. The namespace is part of the node's identity, not its topics.Ros2Connector:domain_id(n)takes precedence; without it the connector readsROS_DOMAIN_ID, and without that it uses 0.register::<T: RosMessage>()recordsT's ROS type name, hash and wire format.with_zenoh_config(..)is available, and the connector owns theros2scheme. It opens its own session for now; sharing a session withZenohConnectorcomes in s11.Ros2LinkExton both link builders:with_depth(n), andwith_reliability(Reliability::BestEffort), which is advertised only (see below). Both are parsed once at build time, so an invalid value fails the build.<domain>/<topic>/<type>/<hash>;put;putcarries the 33-byte attachment: a sequence number per publisher starting at 1, a wall-clock timestamp, and the GID of its token;Drop, and publications are remote-only, as in s08.Build-time refusals (criterion 9, outbound rows)
register::<T>()on a non-RosMessagetypeNotRosis not a ROS 2 message type", with a hint to derive it. The new#[diagnostic::on_unimplemented]onRosMessagein data-contracts produces this messageRosMessagewhoseLinkableisn't CDRbuild()error naming the typebuild()error naming the type and the hashbuild()errorlinked_to_with(url, Json))build()errorros2://linkbuild()errorbuild()error, using the profile'srmwrulesROS_DOMAIN_IDthat isn't an integerbuild()error. The precedence is tested as a pure function, so tests don't race on the environmentros2://with noRos2ConnectorInbound
ros2://links fail the build with "not supported yet" until s10.Design notes
reliability()on Zenoh publishers is#[unstable]in 1.10.1, and I didn't enablezenoh/unstablefor it. ABEST_EFFORTlink advertises best-effort in its token and travels on Zenoh's default reliable path. Zenoh never refuses a match on QoS (053 §6). 053 §5.1 now says this.mangleand the QoS field areDisplayadapters, so each token is a single allocation. The golden tests from s07 are unchanged and pass.Tests
tests/ros2_outbound.rs, against an in-process router, with a node in domain 7 under/cell4. It checks the node token, publisher tokens for the default QoS (::,10:…) and depth 1 (::,1:…), the data key, that the payload decodes as CDR, and attachments with sequence numbers n then n+1, a sane timestamp, and the GID of the publisher's token. It also covers every refusal above.tests/compile_fail.rs(trybuild): theregisterbound.examples/ros2_talker.rsagainst Jazzy's and Lyrical'srmw_zenohd:ros2 node listshows/aimdb/talker;ros2 topic info -vshowsstd_msgs/msg/String, the right hash, KEEP_LAST (10), RELIABLE, VOLATILE, and a GID;ros2 topic echodecodesdata: aimdb N.CI
The second commit (
7ee775b) addsfeat/aimdb-zenoh-connectortoci.yml'spull_requestbranches, so this PR and later stage PRs run the full matrix instead of a localmake check. It stays until you want it reverted.Run locally:
cargo fmt --all -- --check. Before the target-directory cleanup, these had passed: theros2_outboundtests, the trybuild case and the library tests, plus the live ROS check. CI covers everything else, including clippy on the new code, which I have not run locally.🤖 Generated with Claude Code