Skip to content

feat(dynamics): effective joint inertia with the other joints free - #49

Merged
gabrielfrasantos merged 3 commits into
mainfrom
ccr-7574d68f-btpm0a-effective-inertia
Nov 21, 2026
Merged

gabrielfrasantos merged 3 commits into
mainfrom
ccr-7574d68f-btpm0a-effective-inertia

Conversation

@gabrielfrasantos

Copy link
Copy Markdown
Contributor

What

New header: robotics/dynamics/EffectiveJointInertia.hpp.

EffectiveJointInertia(M) returns 1/(M⁻¹)ᵢᵢ for every joint. This is the inertia joint i feels when every other joint is free. It never exceeds the locked inertia Mᵢᵢ.

M is never inverted. It is factored once (Cholesky, M = L·Lᵀ), and each joint uses (M⁻¹)ᵢᵢ = ‖L⁻¹·eᵢ‖², which is one forward substitution and a squared norm. A mass matrix that isn't positive definite gives std::nullopt.

Why

Two consumers need this value:

  • Controller sizing: a joint's gains, or an impedance stiffness, should be sized from its effective inertia when its neighbours are not held. This is also the value a single-joint step test measures.
  • Simulated plants: a plant should report this as each joint's load.

e-robot-arm computes it twice today, in different ways:

  • the simulated plant's ApparentInertias does one Cholesky solve per unit vector;
  • the joint-impedance controller takes the diagonal of a full Gaussian-elimination inverse.

Tests (TestEffectiveJointInertia)

  • Uncoupled joints feel their own inertia.
  • Coupled joints feel less than their locked inertia: M = [[2, 1], [1, 1]] gives (1, 0.5), which the doc also works through by hand.
  • Non-positive-definite input is rejected.

Docs

  • New doc/dynamics/EffectiveJointInertia.md, following the template.
  • New row in doc/dynamics/README.md.
  • New entry in the root README.md Documentation table.

Testing

  • cmake --build --preset host-single-Debug: builds clean.
  • ctest --preset host-single-Debug: 7/7 suites pass, and the dynamics suite passes 76/76.
  • EffectiveJointInertia.cpp compiles with -DROBOTICS_TOOLBOX_COVERAGE_BUILD.

Note

#48 also adds a cell to the root README.md Documentation table. Whichever of the two merges second will hit a small table conflict, and I'll resolve it on that branch.


Generated by Claude Code

EffectiveJointInertia returns 1/(M^-1)_ii for every joint: the inertia a
joint feels when the others are free, at most its locked inertia M_ii.
It factors M once (Cholesky) and uses (M^-1)_ii = |L^-1 e_i|^2, one
forward substitution per joint, so M is never inverted. A mass matrix
that is not positive definite gives no result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WUWh8Fw5EhcfvNuXz3jjU
@github-actions

github-actions Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

✅⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ ACTION actionlint 7 0 0 0.76s
✅ CPP clang-format 218 0 0 0 2.43s
✅ CPP cppcheck 218 0 0 4.76s
✅ DOCKERFILE hadolint 1 0 0 0.43s
✅ JSON jsonlint 8 0 0 0.11s
✅ JSON prettier 8 2 0 0 0.35s
✅ MARKDOWN markdownlint 86 0 0 0 2.62s
✅ MARKDOWN markdown-table-formatter 86 0 0 0 0.24s
⚠️ SPELL lychee 134 1 0 2.35s
✅ YAML prettier 12 0 0 0 0.57s
✅ YAML yamllint 12 0 0 0.71s

Detailed Issues

⚠️ SPELL / lychee - 1 error
📝 Summary
---------------------
🔍 Total..........389
🔗 Unique.........132
✅ Successful.....378
⏳ Timeouts.........0
🔀 Redirected.......5
👻 Excluded.........9
❓ Unknown..........0
🚫 Errors...........1
⛔ Unsupported......1

Errors in .github/workflows/static-analysis.yml
[403] https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$ (at 37:21) | Rejected status code: 403 Forbidden

Hint: Followed 5 redirects. You might want to consider replacing redirecting URLs with the resolved URLs. Use verbose mode (`-v`/`-vv`) to see redirection details.
Hint: You can configure accepted/rejected response codes with `-a` or `--accept`

Notices

⚠️ Your configuration references items that have been removed from MegaLinter and are ignored: REPOSITORY_GITLEAKS, REPOSITORY_KICS. See Removed linters to find their replacements.

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.2.0 --custom-flavor-setup --custom-flavor-linters ACTION_ACTIONLINT,CPP_CPPCHECK,CPP_CLANG_FORMAT,DOCKERFILE_HADOLINT,JSON_JSONLINT,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,SPELL_LYCHEE,YAML_PRETTIER,YAML_YAMLLINT

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

…namespace

Shorten the root README entry so the table stays within markdownlint's
400-column limit, and write the explicit instantiations with qualified
names so no namespace block is left holding only them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014WUWh8Fw5EhcfvNuXz3jjU
@sonarqubecloud

Copy link
Copy Markdown

@gabrielfrasantos
gabrielfrasantos merged commit 17e84a2 into main Nov 21, 2026
12 checks passed
@gabrielfrasantos
gabrielfrasantos deleted the ccr-7574d68f-btpm0a-effective-inertia branch November 21, 2026 14:48
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