Skip to content

fix(ets): preserve joint coordinates and serial kinematic derivatives - #957

Open
Afloat16 wants to merge 9 commits into
petercorke:mainfrom
Afloat16:fix/ets-mutation-joint-cache
Open

Afloat16 wants to merge 9 commits into
petercorke:mainfrom
Afloat16:fix/ets-mutation-joint-cache

Conversation

@Afloat16

@Afloat16 Afloat16 commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Batch the related ETS fixes from #957, #956, #958, #974 and #984 in response to the request to consolidate fixes within the same module. The original commits remain parents of the integration commit, and all component regressions are retained.

Mutable transform sequences can keep stale joint indices, while several full-chain operations disagree about coordinate order. Empty planar sequences raise an exception instead of evaluating to identity, and higher kinematic derivatives fail to respect serial-chain dependencies.

Changes and numerical behavior

  • Invalidate the joint-index and compiled-kinematics caches together after supported list edits in ETS and ETS2.
  • Evaluate an empty ETS2 as the 3-by-3 identity before applying the existing base, tool and trajectory processing.
  • Place random configurations in joint-index order for full chains. Preserve compact ET order for sparse subchains, including the existing output shapes and uniform distribution.
  • Align planar IK Jacobian columns, limits and revolute flags with the solver's accepted coordinate order; document the convention for initial and returned configurations.
  • Preserve serial dependencies in higher kinematic partials by differentiating the ordered translational Hessian factors and retaining the applicable angular dependencies. The tensor layout and public signatures are unchanged.

Public behavior and numerical results change for edited sequences, empty planar chains, explicitly permuted coordinates and affected higher derivatives. The old large expected tensor encoded the incorrect recurrence; independent central differences of the Hessian replace it while retaining ETS and Robot entry-point coverage. That test replacement is part of #984 and is preserved by this integration.

Validation

Revalidated after merging upstream main at bceb42c18877840280037539dac036f21d4fefe5 in commit f3fc039ac0916df467e20263ade3ed071aa67929. The contribution source and regression files are unchanged by this update.

PYTHONPATH=src python -m pytest \
  tests/test_ets_mutation.py tests/test_ETS.py tests/test_ETS2.py \
  tests/test_random_q_indices.py tests/test_ets2_ik_coordinate_order.py \
  tests/test_serial_kinematic_partials.py \
  --timeout=50 --timeout_method=thread -q

Result: 193 passed and 35 subtests passed.

Validation used Linux, Python 3.12.14, NumPy 2.5.5, SciPy 1.18.1 and Matplotlib 3.11.2, with the source tree on PYTHONPATH=src. The Python kinematics/dynamics fallbacks were used. The compiled extension, other operating systems and the complete repository/platform matrix were not run locally.

python -m mypy passed for all 166 source files using upstream main's Python 3.11 target. git diff --check passed. The regression files are unchanged from the integration revision, where Ruff lint and format checks passed.

Contribution

Primary contributor: @Afloat16.

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

Afloat16 and others added 3 commits November 18, 2026 15:57
Handle empty ETS2 sequences produced by constant folding while retaining base, tool and trajectory behavior. Add regression coverage for empty and compiled identity sequences.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
Use the existing change invalidation helper for item edits, data replacement and insertions. Verify edited ETS and ETS2 forward kinematics and Jacobians against equivalent fresh sequences.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
Map sampled joint limits to full-chain joint indices while preserving compact subchain coordinates. Cover ETS, ETS2, Robot and Robot2 with asymmetric limits.

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

codacy-production Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 61 complexity · 15 duplication

Metric Results
Complexity 61
Duplication 15

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.

Afloat16 and others added 4 commits November 18, 2026 16:26
Declare the existing NDArray return buffer type so NumPy shape-aware stubs accept both single poses and pose trajectories.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
Check the optional joint index directly so NumPy indexing is type safe under the CI stubs.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
Order Jacobian columns, joint limits and revolute flags consistently with full jindex-addressed vectors while preserving sparse compact inputs. Cover cyclic permutations, mixed joint units and trajectory solutions.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
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>
Combine the related fixes from PRs petercorke#957, petercorke#956, petercorke#958, petercorke#974 and petercorke#984 for a single ETS review. Preserve each original commit as a parent and keep its regression coverage.

Refresh joint caches after mutations, evaluate empty planar sequences as identity, align random configurations and planar IK with accepted coordinate order, and preserve serial dependencies in higher kinematic partials.

Validation: 193 tests and 35 subtests passed; mypy passed for all 166 source files. Regression-test Ruff lint/format and git diff --check passed. Tested with Python 3.12 and the Python kinematics fallback; compiled/platform CI was not run locally.

Co-Authored-By: ChatGPT (GPT-6 Astra Pro) <noreply@openai.com>
@Afloat16 Afloat16 changed the title fix(ets): refresh joint index caches after list edits fix(ets): preserve joint coordinates and serial kinematic derivatives Nov 19, 2026
Integrate upstream main bceb42c without changing the contribution files.
Revalidate the related regression suites and mypy against Python 3.11
configuration while retaining the existing commit history.

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

This branch has not been deployed

No deployments
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