Skip to content

fix: reject mismatched operational acceleration trajectories - #908

Draft
Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/operational-acceleration-row-counts-20261030
Draft

Afloat16 wants to merge 1 commit into
petercorke:mainfrom
Afloat16:fix/operational-acceleration-row-counts-20261030

Conversation

@Afloat16

Copy link
Copy Markdown
Contributor

Summary

accel_x iterates q, xd and wrench with zip. Different trajectory row counts silently truncate the computation and can leave output rows uninitialised.

Reject mismatched trajectory row counts immediately after input normalisation, before allocating or evaluating the operational acceleration.

Numerical results and public behaviour: Mismatched q, xd and wrench trajectories now raise ValueError instead of silently truncating. Valid single-row, multi-row and empty inputs retain their numerical behaviour and shapes; public signatures are unchanged.

The implementation, regression tests and this description were prepared with ChatGPT (GPT-6 Astra Pro). Afloat16 requested the work and authorised submission; human review of this diff has not yet been confirmed, so this PR is a draft.

Related issue

Found through code inspection; no specific issue is linked. The current open PRs were checked for competing fixes.

Validation

The new regressions on the unchanged base report 12 failed, 6 passed (18 new regression cases on the unchanged base). With this change: 18 new regression cases pass; selected dynamics/robot suites: 255 passed, 1 skipped.

All six unequal row-count permutations for Puma560 and Panda, valid single/multiple rows, empty batches, and the existing independent closed-form operational dynamics controls.

Tested on 9f282d8ff952a6ca95d340ae6a62b04e545a302f using Linux/Python 3.12.14 and the actual package with matching native extensions enabled.

PYTHONPATH=src python -m pytest -q tests/test_accel_x_row_counts.py tests/test_DHRobot.py tests/test_coriolis_x.py tests/test_gravload_x.py tests/test_operational_space_closed_form.py

New test files pass Ruff lint and format checks; git diff --check passes. Existing production-file Ruff diagnostics are unchanged. Mypy reports the same existing Link.py:327 return-type error on the unchanged base and this branch (165 source files checked), with no additional diagnostics. It does not pass cleanly.

Focused suites only; the complete repository suite, docs build and cross-platform CI were not rerun. One existing dynamics-suite skip and one dependency deprecation warning remain.

Checklist

  • Issue claimed, if a corresponding issue is identified.
  • PR title follows Conventional Commits.
  • Full repository tests pass locally (focused results are reported above).
  • Added regression tests for this change.
  • The PR is limited to this fix and its tests.
  • Numerical and public behaviour changes are stated above.
  • The contributor has personally read, run and understood the diff.
  • Required CI checks pass.

Prepared with ChatGPT (GPT-6 Astra Pro).

Co-Authored-By: ChatGPT (GPT-6 Astra Pro)
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 10 complexity · 0 duplication

Metric Results
Complexity 10
Duplication 0

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.

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