Skip to content

feat(tf): add hiroz-tf crate with TF2 listener, broadcaster, and buffer#191

Open
YuanYuYuan wants to merge 17 commits into
mainfrom
feat/hiroz-tf
Open

feat(tf): add hiroz-tf crate with TF2 listener, broadcaster, and buffer#191
YuanYuYuan wants to merge 17 commits into
mainfrom
feat/hiroz-tf

Conversation

@YuanYuYuan
Copy link
Copy Markdown
Collaborator

Summary

  • Add hiroz-tf crate: pure-Rust TF2 transform listener, buffer, and broadcaster built on hiroz pub/sub
  • Implement Buffer with time-series frame storage, LCA traversal, and slerp/lerp interpolation for lookup_transform
  • Add TransformBroadcaster and StaticTransformBroadcaster (TransientLocal replay for late joiners)
  • 8 integration tests covering round-trip broadcasts, static transforms, interpolation, and wait_for_transform

Key Changes

  • crates/hiroz-tf/ — new crate: Buffer, TransformBroadcaster, StaticTransformBroadcaster, LookupError, WaitError
  • crates/hiroz-tests/tests/tf_integration.rs — integration test suite (feature: tf-tests)
  • crates/hiroz-msgs/ — add tf2_msgs/TFMessage to generated messages
  • crates/hiroz/src/pubsub.rs — expose AdvancedPublisher/AdvancedSubscriber needed by the broadcaster
  • crates/hiroz-codegen/ — fix prost naming word-boundary replication and remove unnecessary tf2_msgs exclusion

Breaking Changes

None

YuanYuYuan added 14 commits May 26, 2026 12:50
Introduces `ros-z-tf`, a pure-Rust TF2 listener and transform buffer
that subscribes to `/tf` and `/tf_static`, maintains a frame tree, and
provides `lookup_transform` with multi-hop LCA traversal and
linear/slerp interpolation.

Public API:
- `Buffer::new(node)` — subscribes to /tf (Volatile) and /tf_static (TransientLocal)
- `Buffer::lookup_transform(target, source, time)` — LCA-based chain composition
- `Buffer::can_transform(target, source, time)` — non-panicking availability check
- `Buffer::all_frames()` — enumerate known frame IDs
- `LookupError` — UnknownFrame, NoCommonAncestor, ExtrapolationError

Also adds `tf2_msgs` message definitions to ros-z-codegen assets and
extends `GeneratorConfig` with `protobuf_excluded_packages` to handle
packages whose cross-package array fields cannot be represented in
protobuf (e.g. `geometry_msgs/TransformStamped[]` in TFMessage).
…sform, lookup_transform_full

- ros-z core: declare PublicationCache alongside ZPub for TransientLocal
  publishers; use QueryingSubscriber (FetchingSubscriber) for TransientLocal
  subscribers so late joiners receive previously published data
- ros-z-tf: add TransformBroadcaster (/tf, Volatile) and
  StaticTransformBroadcaster (/tf_static, TransientLocal)
- ros-z-tf: add wait_for_transform (async, notified on each add_message)
  with WaitError::Timeout and WaitError::Lookup variants
- ros-z-tf: add lookup_transform_full for fixed-frame two-time lookups
- remove #[ignore] from tf_static_transient_local_replayed_on_connect
- 8 integration tests pass, 28 unit tests pass
…rder, optional wait timeout

- StaticTransformBroadcaster zeroes all timestamps before publishing
  (tf2 spec requires sec=0, nanosec=0 on /tf_static for ROS 2 interop)
- lookup_transform_full reordered to (target, target_time, source, source_time,
  fixed_frame) matching tf2 C++ and roslibrust APIs
- wait_for_transform now takes Option<Duration>; None falls back to the
  buffer's default duration (10 s)
- Document intentional separation of Buffer and broadcaster types
…y codegen filter

- QosHistory::KeepAll was mapped to usize::MAX for PublicationCache ring
  buffer capacity, which would OOM on first transient-local publisher;
  cap at 1000 entries to match tf2 buffer convention
- tf-tests feature no longer hardcodes ros-z-tf/jazzy; distro propagation
  uses '?' syntax so it only activates when the optional dep is enabled
- generate_protobuf_types always filters excluded packages via one-liner
  instead of a split-variable conditional
…t_naming

Adds digit→uppercase split so Int8MultiArray→Int8MultiArray and
ensures TFMessage→TfMessage matches what prost_build generates.
- Move crates/ros-z-tf/ to crates/hiroz-tf/
- Move tf2_msgs assets from crates/ros-z-codegen/ to crates/hiroz-codegen/
- Update all ros-z/ros_z references to hiroz/hiroz in crate source,
  Cargo.toml, README, and tf_integration tests
SubInner was added by the feat(tf) commit outside of any conflict zone,
but the ZSub struct field was resolved to HEAD's AdvancedSubscriber<()>
(from PR #183), leaving SubInner unreferenced. The follow-up
allow(dead_code) commit was suppressing a lint on code that should not
exist at all.
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 26, 2026

PR Preview Action v1.8.1

QR code for preview link

🚀 View preview at
https://ZettaScaleLabs.github.io/hiroz/pr-preview/pr-191/

Built to branch gh-pages at 2026-05-26 13:22 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

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