Skip to content

fix(kinematics): preserve serial dependencies in higher partials - #984

Closed
Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/serial-kinematic-partials
Closed

Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/serial-kinematic-partials

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

ETS.partial_fkine0 applies the same cross-product recurrence to every pair of joints. This lets downstream joints change upstream angular axes and uses the wrong translational factors when the joint order is reversed.

Valid third-order calls differ from independent Hessian differences by about 0.98 on a Panda. A planar arm also gives an incorrect Cartesian jerk when the tensor is contracted with constant joint rates.

Change

Retain the existing higher-order product rule, but start it from the ordered translational Hessian factors: the angular column of the earlier joint and the linear column of the later joint. Angular terms remain zero when the differentiated joint does not precede the output joint. Each factor keeps its assigned derivative indices.

Numerical change: higher kinematic derivatives now respect serial-chain dependencies. The tensor layout and public signatures are unchanged; the layout is documented.

The old 2,400-line expected tensor encoded the incorrect recurrence. Replace it with independent central differences of the existing Hessian, retaining coverage of both ETS and Robot entry points.

Validation

  • 38 regressions cover closed-form third through fifth derivatives of planar R/P/R and noncoplanar R/R chains, flipped joints, offsets, base/tool transforms, sparse joint indices, and zero higher derivatives for prismatic chains.
  • Actual Puma/Panda third derivatives are compared with independent Hessian differences. A separate closed-form trajectory checks Cartesian jerk.
  • Unchanged main: 35 failed, 3 passed.
  • New tests plus existing ETS and ETS2 modules: 131 passed, 31 subtests passed.
  • mypy: all 166 source files passed. New-test Ruff lint/format and git diff --check pass.
  • The full repository/platform matrix was not run locally.

Prior work

Checked all 109 prior fork heads and relevant upstream searches/patches. No earlier fork implementation changes this recurrence. #833 changes its documentation and comments; the mutation-cache change in #957 is separate.

Primary contributor: Afloat16.

Prepared with ChatGPT (GPT-6 Astra Pro) assistance.

Keep the ordered translational Hessian factors and the upstream-only
angular dependency while applying the existing higher-order product rule.
Replace the obsolete tensor fixture with independent Hessian differences
and add closed-form third through fifth derivative regressions.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 113 complexity · 125 duplication

Metric Results
Complexity 113
Duplication 125

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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