Skip to content

feat(ros-z): simplify backend by removing ZMessage wrapper boilerplate#320

Open
YuanYuYuan wants to merge 2 commits intoRosLibRust:masterfrom
YuanYuYuan:feat/ros-z-serdes-param
Open

feat(ros-z): simplify backend by removing ZMessage wrapper boilerplate#320
YuanYuYuan wants to merge 2 commits intoRosLibRust:masterfrom
YuanYuYuan:feat/ros-z-serdes-param

Conversation

@YuanYuYuan
Copy link
Contributor

@YuanYuYuan YuanYuYuan commented Mar 9, 2026

Summary

Simplifies the ros-z backend in roslibrust_ros2 by removing wrapper boilerplate that was required to work around ZMessage::Serdes. With the ZSerdes<T> refactor in ZettaScaleLabs/ros-z#131, message types can now specify their wire format at the call site, so T: RosMessageType can be used directly without needing an intermediate wrapper type.

Depends on: ZettaScaleLabs/ros-z#131 (or main once that PR merges)

Key Changes

  • Remove RosMessageWrapper<T> — the newtype wrapper that existed solely to satisfy ZMessage::Serdes is no longer needed
  • Remove WrapperSerdes<T> — the custom ZSerializer/ZDeserializer impl delegating to CdrSerdes<T> is replaced by CdrCompatSerdes directly
  • ZenohPublisher<T> now wraps ZPub<T, CdrCompatSerdes> instead of ZPub<RosMessageWrapper<T>, WrapperSerdes<T>>
  • ZenohSubscriber<T> now wraps ZSub<T, Sample, CdrCompatSerdes>recv() returns T directly, no .0 unwrap
  • advertise / subscribe use node.create_pub_impl / create_sub_impl with .with_serdes::<CdrCompatSerdes>() and type info built from T::ROS2_TYPE_NAME / T::ROS2_HASH
  • Fake<T> retained for services — the orphan rule still prevents impl ZService for T: RosServiceType in a downstream crate; the shim is kept but now only handles type routing, not serialization logic

Breaking Changes

None for downstream users of roslibrust_ros2 — the public API (TopicProvider, ServiceProvider impls on ZenohClient) is unchanged.

…erSerdes

Replace the wrapper boilerplate required by the old ZMessage::Serdes
associated type with direct use of SerdeCdrSerdes via the new ZSerdes<T>
builder API introduced in ZettaScaleLabs/ros-z dev/serdes-param.

- Remove RosMessageWrapper<T> and WrapperSerdes<T>
- ZenohPublisher<T> wraps ZPub<T, SerdeCdrSerdes> directly
- ZenohSubscriber<T> wraps ZSub<T, Sample, SerdeCdrSerdes> directly
- advertise/subscribe use create_pub_impl/create_sub_impl + .with_serdes()
- Fake<T> retained for orphan-rule ZService shim (services only)
@YuanYuYuan YuanYuYuan changed the title feat(ros-z): simplify ros2 backend — drop RosMessageWrapper and WrapperSerdes feat(ros-z): simplify backend by removing ZMessage wrapper boilerplate Mar 9, 2026
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