feat(units): SI-array seam (SpatialSi6 + to_si_3/6), Stewart IK onto it #41

Merged
patman merged 1 commit from patman/uom-si-seam into main 2026-07-09 23:11:48 +00:00
Owner

What this does

Adds the SI-array seam between the typed layer (Ring 1/2) and the raw-f64 matrix kernel (Ring 3), and refactors Stewart IK onto it.

  • Macro-generated to_si_3()/from_si_3() on all seven *Vec3 types (Ring-2→Ring-3 bridge).
  • New SpatialSi6 { linear: [f64;3], angular: [f64;3] } — a named-field struct, not a bare [f64;6], so a future mechanism using a different (e.g. Featherstone [ω;v]) block ordering cannot silently mis-pack a Jacobian and still type-check.
  • to_si_6()/from_si_6() on Twist, SpatialAcceleration, SpatialJerk.
  • stewart::platform_twist_to_leg_rates refactored to consume twist.to_si_6() via .linear/.angular by name (behavior-preserving; the [Velocity;6] homogeneous re-wrap is unchanged).

Why named blocks (critique C6)

The seam is "the new AngleKind": a bare [f64;6] records nothing about which half is linear vs angular, so a convention mismatch would type-check as [Velocity;6] while being wrong. The named-field struct + a seam-ordering pin test prevent that.

Verification

buck2 test //common:common-tests95 passed (6 new: to_si_3/to_si_6 round-trips + the ordering pin). The existing Stewart FD proptests pass unchanged (the behavior-preserving guarantee). Two independent adversarial reviews found no bugs (high confidence). No quaternion.rs/transform.rs drift.

Stack position

PR 1 of the typed-vector/CAM series → base #40 (the Vec3 macro). Night-session build; see docs/superpowers/cam-typed-layer-design.md.

Note: to_si_6/from_si_6 could also be const (a non-blocking consistency polish flagged in review); deferred.

## What this does Adds the **SI-array seam** between the typed layer (Ring 1/2) and the raw-`f64` matrix kernel (Ring 3), and refactors Stewart IK onto it. - Macro-generated `to_si_3()`/`from_si_3()` on all seven `*Vec3` types (Ring-2→Ring-3 bridge). - New **`SpatialSi6 { linear: [f64;3], angular: [f64;3] }`** — a **named-field** struct, not a bare `[f64;6]`, so a future mechanism using a different (e.g. Featherstone `[ω;v]`) block ordering cannot silently mis-pack a Jacobian and still type-check. - `to_si_6()`/`from_si_6()` on `Twist`, `SpatialAcceleration`, `SpatialJerk`. - `stewart::platform_twist_to_leg_rates` refactored to consume `twist.to_si_6()` via `.linear`/`.angular` by name (behavior-preserving; the `[Velocity;6]` homogeneous re-wrap is unchanged). ## Why named blocks (critique C6) The seam is "the new AngleKind": a bare `[f64;6]` records nothing about which half is linear vs angular, so a convention mismatch would type-check as `[Velocity;6]` while being wrong. The named-field struct + a **seam-ordering pin test** prevent that. ## Verification `buck2 test //common:common-tests` → **95 passed** (6 new: `to_si_3`/`to_si_6` round-trips + the ordering pin). The existing Stewart FD proptests pass unchanged (the behavior-preserving guarantee). Two independent adversarial reviews found no bugs (high confidence). No `quaternion.rs`/`transform.rs` drift. ## Stack position PR 1 of the typed-vector/CAM series → base #40 (the Vec3 macro). Night-session build; see `docs/superpowers/cam-typed-layer-design.md`. _Note: `to_si_6`/`from_si_6` could also be `const` (a non-blocking consistency polish flagged in review); deferred._
Promote the open-coded Ring-2->Ring-3 seam (the six .as_mps()/.as_rad_per_s()
calls in platform_twist_to_leg_rates) to named, tested methods. The seam target
is SpatialSi6 { linear: [f64;3], angular: [f64;3] } — a named-field struct, NOT a
bare [f64;6], so a future mechanism using a different (e.g. Featherstone [w;v])
ordering cannot silently type-check as [Velocity;6].

Co-authored-by: patman-assist <patrick-ai@kgroo.co>
patman changed target branch from patman/uom-vec-macro to main 2026-07-09 23:11:43 +00:00
patman merged commit d534093a83 into main 2026-07-09 23:11:48 +00:00
Sign in to join this conversation.
No description provided.