Skip to content

test(dynamics): validate operational-space methods against closed-form dynamics - #837

Merged
petercorke merged 2 commits into
petercorke:mainfrom
kVinsom:test/804-operational-space
Oct 21, 2026
Merged

petercorke merged 2 commits into
petercorke:mainfrom
kVinsom:test/804-operational-space

Conversation

@kVinsom

@kVinsom kVinsom commented Oct 18, 2026

Copy link
Copy Markdown
Contributor

Summary

The operational-space dynamics methods need an independent mathematical reference: comparing them with values generated by RTB can miss shared errors. Add closed-form TwoLink tests for inertia_x, coriolis_x, gravload_x and accel_x, using Spong's joint-space equations and hand-differentiated analytical kinematics.

The tests check individual force terms, the complete equation of motion and distinct trajectory rows, across standard/modified DH, zero/nonzero link inertia, and Python/compiled backends. The module docstring derives the equations and explains TwoLink's sign convention, world XZ plane and rpy/xyz coordinate ordering. Compiled cases explicitly fail if RNE silently falls back to Python.

Related issue

Closes #804

Validation

  • Linux / Python 3.14: all 128 new cases pass, exercising both backends; the final run with the existing Coriolis/gravity tests passes 152 tests. A broader dynamics/fallback run passed 313 tests, 1 skipped. Native extensions were loaded from the matching RTB 1.4.4 wheel.
  • Windows / Python 3.12: 64 new cases pass, 64 compiled cases skip because the extensions are unavailable. Full suite: 1490 passed, 39 failed, 230 skipped, versus 1426 passed, 39 failed, 166 skipped without this module; the failing test IDs are identical.
  • Ruff lint/format checks and repository-wide mypy pass; the new module parses with Python 3.10 syntax.
  • Sensitivity checks detect the pre-fix(dynamics): transform operational Coriolis terms consistently #796 Coriolis implementation and an omitted Jacobian-rate term. Injecting a native RNE argument error also confirms the compiled-backend guard fails while the Python case still passes.

Checklist

  • PR title follows Conventional Commits
  • Full test suite passes locally (existing Windows failures noted above)
  • Added tests for this change
  • New code uses modern type hints and the project's array alias
  • Added derivation, explanatory comments and reST helper docstrings
  • Focused on Rigorous testing of operational-space methods #804; one test module
  • No personal-project data, notebooks or other assets added

AI assistance: developed and checked with Codex.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 13 complexity · 0 duplication

Metric Results
Complexity 13
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.

@codecov

codecov Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (67ea1a1) to head (14494cf).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #837   +/-   ##
=====================================
  Coverage   0.00%   0.00%           
=====================================
  Files        146     146           
  Lines      17068   17068           
=====================================
  Misses     17068   17068           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@petercorke

Copy link
Copy Markdown
Owner

Thank you for these tests. Checking the operational-space methods against an independent closed-form derivation is the right kind of test, since it would catch an error that a comparison between two of our own implementations would not, and 128 cases in a third of a second is cheap to keep. I'll update the branch with main and merge it once CI is green.

@petercorke
petercorke enabled auto-merge (squash) October 21, 2026 07:32
@petercorke
petercorke merged commit ee872d7 into petercorke:main Oct 21, 2026
23 checks passed
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.

Rigorous testing of operational-space methods

2 participants