feat: rust transform support - #2816
Conversation
…sform-get # Conflicts: # dimos/robot/unitree/go2/blueprints/navigation/unitree_go2_nav_3d.py
Codecov Report❌ Patch coverage is @@ Coverage Diff @@
## main #2816 +/- ##
==========================================
+ Coverage 75.37% 75.46% +0.08%
==========================================
Files 1153 1157 +4
Lines 110948 111276 +328
Branches 10047 10073 +26
==========================================
+ Hits 83631 83972 +341
+ Misses 24462 24416 -46
- Partials 2855 2888 +33
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 8 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Greptile SummaryThis PR adds transform (tf) support for Rust native modules, mirroring the existing Python tf API. It introduces
Confidence Score: 5/5Safe to merge; the transform graph, BFS composition, and Python pose-resolution logic are all well-tested and the previously-raised concerns are confirmed resolved. The Rust tf crate has comprehensive unit and async tests covering direct/reverse/multi-hop edges, tie-breaking, tolerance filtering, out-of-order insertion, publish round-trips, and decode errors. The Python OdomBasePose helper is similarly well-covered. The BFS visited-before-edge-check issue flagged in a previous review is confirmed fixed in the current diff. No data-loss or incorrect-behavior paths were found after tracing the -leg inversion math, the stamp encoding overflow guard, and the lazy tf handle construction. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant P as Python TfProducer
participant T as /tf topic
participant R as Rust TfRoute (TfRoute.try_dispatch)
participant B as MultiTBuffer (BFS graph)
participant M as Rust Module (#[tf] Tf handle)
participant G as GoalRelay (OdomBasePose)
P->>T: publish Transform (a→b, b→c)
T->>R: LCM TFMessage bytes
R->>B: buffer.receive(parent, child, ts, iso)
Note over B: TBuffer.add() inserts sorted,<br/>prunes outside window_secs
M->>B: tf.get_latest("a","d")
B->>B: BFS over edge graph
B-->>M: composed Transform (a→d)
Note over G: OdomBasePose.resolve(odometry)
G->>B: tf.get("mid360_link","base_link")
B-->>G: cached static leg (once)
G->>G: odom + leg → base_link PoseStamped
G->>G: "start.position.z -= base_height_above_ground"
G-->>G: publish start_pose
Reviews (12): Last reviewed commit: "Merge branch 'andrew/feat/rust-transform..." | Re-trigger Greptile |
Problem
We need transforms with Rust
Closes DIM-XXX
Solution
Add
#[tf]attribute to subscribe a module to the transform topicget_latest()-> get the latest transform between two frames.at()to set source time for a transform.tolerance()for max allowed gap between time set by.at().within()for how long to wait for a valid transform on the topic before just returning NoneOther
IOportsbase_linktf from go2 for when we are setting base_link from mid360 or other sourceTransforms are collected in a hash map and inter-frame transforms are built on demand
How to Test
uv run python examples/native-modules/rust_tf.pyContributor License Agreement