Skip to content

Allocate GRiD topology helpers in fixed-base dynamics - #21

Merged
plancherb1 merged 1 commit into
A2R-Lab:mainfrom
felixmueh:fix/native-joint-axes
Oct 24, 2026
Merged

plancherb1 merged 1 commit into
A2R-Lab:mainfrom
felixmueh:fix/native-joint-axes

Conversation

@felixmueh

@felixmueh felixmueh commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Mixed-axis serial arms can require GRiD helper storage, but the fixed-base
adapter passed null pointers. A three-joint +Z/-Z/+X arm produces a CUDA launch
failure.
Reserve aligned scratch for the helpers and thread it through dynamics, derivatives,
contact and exact-Hessian compositions. Zero-helper scratch sizes stay unchanged.

Validation: four registration host checks pass. The new three-joint test checks
the device step and SQP linearization against Pinocchio; it fails on the baseline
and passes with the fix.

I also use this on working MPC on a robot model of TIAGo Pro.

No performance impact:

Timing: aeacf16 → 639320b, GTX1070/sm61, i7-7700K, CUDA12.9, GRiD0.5.1,
Release/fast-math. Three separate repeats per source, each using:

python examples/benchmarks/sweep_batch_iiwa_fig8.py --robot indy7 --N 32 --batches 1,16 --solves 1010 --record-call-boundary --out <fresh.csv>

Mean repeat-median native solve-wall time: B1 0.414 → 0.400 ms;
B16 4.899 → 4.877 ms. Two matched-clock B16 pairs give 4.893 → 4.884 ms
(−0.18%); B1 clocks vary.

developed with codex everything reviewed by me

@cherti

Reserve aligned helper storage in the dynamics and gradient scratch arenas, including contact and exact-Hessian compositions. Keep zero-helper models unchanged and propagate the existing scalar type through scratch-size calculations.

Compare a three-joint signed/mixed-axis robot against Pinocchio for the device step and discrete A/B linearization. Its helper-index/sign path exercises the missing buffer in ordinary Release builds.
@plancherb1

Copy link
Copy Markdown
Member

Thank you for finding this and for the Pinocchio check. The fix is merged on our development line with one addition: the exact-Hessian path now carves the helper block at the end of the numeric arena with a static_assert that the sum fits the sizer, instead of subtracting from the arena end. The vendored arms have a zero helper count, so their modules and goldens are unchanged, and your mixed-axis test runs in the slow tier and the signed receipt (512 tests).

Timing of the release: we are batching this with a set of GRiD changes (the sizing rule, 5n+1 helpers for branching plus n for any non +Z axis with n = max(nq, NJ), goes into GRiD's integration docs, and GRiD will emit the rounded T-element count next to the COUNT constants so adapters stop computing it by hand) and will ship everything together in one release, soon but not immediately. The PR will show as merged when that line is pushed.

@plancherb1

Copy link
Copy Markdown
Member

Thank you for finding this and for the Pinocchio check. The fix is merged on our development line with one addition: the exact-Hessian path now carves the helper block at the end of the numeric arena with a static_assert that the sum fits the sizer, instead of subtracting from the arena end. The vendored arms have a zero helper count, so their modules and goldens are unchanged, and your mixed-axis test runs in the slow tier and the signed receipt.

On the GRiD side the rule is now in grid-rbd 0.5.4 (released): the count is 5n+1 helpers for branching plus n for any non +Z axis with n = max(nq, NJ), stated in the integration docs, and the header emits TOPOLOGY_HELPERS_T_COUNT<T>(), which GATO's adapter now reads instead of computing the footprint itself. The GATO release carrying all of this is batched with the other October changes; the updates land in the next few days, once the GRiD side is pushed and integrated, and the PR will show as merged when that line is pushed.

@plancherb1
plancherb1 merged commit 7d58563 into A2R-Lab:main Oct 24, 2026
1 of 2 checks passed
@plancherb1

Copy link
Copy Markdown
Member

Merged and released in 0.1.4 with the exact-Hessian helper carve under a static_assert;
credited in the changelog. Thank you.

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.

2 participants