google-deepmind / mujoco

Multi-Joint dynamics with Contact. A general purpose physics simulator.
https://mujoco.org
Apache License 2.0
8.19k stars 818 forks source link

The formula of `diagApprox` #1858

Closed YilingQiao closed 2 months ago

YilingQiao commented 3 months ago

Hi,

I'm a student and working on physics simulation.

I'm looking for some help with the formula of diagApprox. Specifically, I am curious about the rationale behind its computation as follows:

(invweight + f * f * invweight) * 2 * f * f / m.opt.impratio

Could you please direct me to any papers or other references that explain the meaning behind this formula?

The relevant MuJoCo code is here: https://github.com/google-deepmind/mujoco/blob/5ac5cfb618c11ff4aa0199b25c3856da3d194703/src/engine/engine_core_constraint.c#L1207

Or the equivalent MJX code here: https://github.com/google-deepmind/mujoco/blob/5ac5cfb618c11ff4aa0199b25c3856da3d194703/mjx/mujoco/mjx/_src/constraint.py#L386

Thank you so much for your time!