Add mjENBL_DIAGEXACT for exact constraint diagonal. Fixes #2472

PiperOrigin-RevId: 916932908
Change-Id: Id23ac39b5cd996afc52990719a4e07c0cc7de600
This commit is contained in:
Yuval Tassa
2026-05-17 16:47:20 -07:00
committed by Copybara-Service
parent 66d764a116
commit 71d1014e70
21 changed files with 234 additions and 57 deletions
+19
View File
@@ -1855,6 +1855,25 @@ in a visible way, and the energy fluctuates around the initial value instead of
</worldbody>
.. _CConstraintImpedance:
Constraint accuracy
~~~~~~~~~~~~~~~~~~~
MuJoCo's :ref:`constraint impedance<soParameters>` computation relies on an approximate diagonal of the constraint-space
inertia matrix, computed once at compile time from the initial configuration ``qpos0``.
In the vast majority of models this approximation is entirely adequate. However, in certain situations—such as models
with highly anisotropic inertias, complex kinematic chains, or bodies operating far from ``qpos0``—the approximation
may become inaccurate. This can occasionally manifest as unexplained solver divergence (``badqacc`` warnings),
excessive penetration, unrealistic slip, or poor solver convergence. A useful diagnostic is the
:ref:`fwdinv<option-flag-fwdinv>` flag: if the forward-inverse discrepancy is large, inaccurate constraint scaling may
be a contributing factor.
If you suspect that the compile-time approximation is insufficient for your model, you can enable the
:ref:`diagexact<option-flag-diagexact>` flag to compute the exact diagonal at runtime. See :ref:`Diagonal approximation
<soExactDiag>` for details on the underlying mechanics and performance implications.
.. |image3| image:: images/modeling/tendonwraps.png
:width: 500px
.. |image4| image:: images/modeling/particle.png