Expose mj_makeM as a sub-component.

PiperOrigin-RevId: 763662068
Change-Id: I55ced456dca751c1de09fb35e2f73c60ffc0d626
This commit is contained in:
Yuval Tassa
2025-05-27 00:33:27 -07:00
committed by Copybara-Service
parent 4a102c37bc
commit 89e39dc0a7
12 changed files with 58 additions and 10 deletions
+13 -2
View File
@@ -748,8 +748,7 @@ Compare forward and inverse dynamics, save results in fwdinv.
Sub components
^^^^^^^^^^^^^^
These are sub-components of the simulation pipeline, called internally from the components above. It is very unlikely
that the user will need to call them.
These are sub-components of the simulation pipeline, called internally from the components above.
.. _mj_sensorPos:
@@ -886,6 +885,18 @@ Compute actuator transmission lengths and moments.
Run composite rigid body inertia algorithm (CRB).
.. _mj_makeM:
`mj_makeM <#mj_makeM>`__
~~~~~~~~~~~~~~~~~~~~~~~~
.. mujoco-include:: mj_makeM
Compute the composite rigid body inertia with :ref:`mj_crb`, add terms due
to :ref:`tendon armature<tendon-spatial-armature>`. The joint-space inertia matrix is stored in both ``mjData.qM`` and
``mjData.M``. These arrays represent the same quantity using different layouts (parent-based and compressed sparse row,
respectively).
.. _mj_factorM:
`mj_factorM <#mj_factorM>`__
+8 -2
View File
@@ -113,8 +113,14 @@ Integrates the simulation state using an implicit-in-velocity integrator (either
.. _Subcomponents:
These are sub-components of the simulation pipeline, called internally from the components above. It is very unlikely
that the user will need to call them.
These are sub-components of the simulation pipeline, called internally from the components above.
.. _mj_makeM:
Compute the composite rigid body inertia with :ref:`mj_crb`, add terms due
to :ref:`tendon armature<tendon-spatial-armature>`. The joint-space inertia matrix is stored in both ``mjData.qM`` and
``mjData.M``. These arrays represent the same quantity using different layouts (parent-based and compressed sparse row,
respectively).
.. _mj_factorM:
+2 -2
View File
@@ -2918,8 +2918,8 @@ Attributes may be applied or ignored depending on the lighting model being used.
.. _body-light-directional:
:at:`directional`: :at-val:`[false, true], "false"`
This is a deprecated legacy attribute. Please use :ref:`light <light-type>` type instead. If set to "true", and no
type is specified, this will change the light type to be directional.
This is a deprecated legacy attribute. Please use :ref:`light <body-light-type>` type instead. If set to "true", and
no type is specified, this will change the light type to be directional.
.. _body-light-castshadow:
+3
View File
@@ -14,6 +14,9 @@ General
- Replaced the :ref:`directional<body-light-directional>` (boolean) field for lights with a
:ref:`type<body-light-type>` field (of type :ref:`mjtLightType<mjtLightType>`) to allow for additional lighting
types.
- Added new sub-component :ref:`mj_makeM` which combines the :ref:`mj_crb` call with additional logic to support the
introduction in 3.3.1 of :ref:`tendon armature<tendon-spatial-armature>`. In addition to the traditional
``mjData.qM``, :ref:`mj_makeM` also computes ``mjData.M``, a CSR representation of the same matrix.
Simulate
^^^^^^^^
+1 -1
View File
@@ -1692,7 +1692,7 @@ The stages below compute quantities that depend on the generalized positions ``m
4. Compute quantities related to :ref:`flex<deformable-flex>` objects: :ref:`mj_flex`
5. Compute the tendon lengths and moment arms. This includes the computation of minimal-length paths for spatial
tendons: :ref:`mj_tendon`
6. Compute the composite rigid body inertias and joint-space inertia matrix: :ref:`mj_crb`
6. Compute the composite rigid body inertias and joint-space inertia matrix: :ref:`mj_makeM`
7. Compute the sparse factorization of the joint-space inertia matrix: :ref:`mj_factorM`
8. Construct the list of active contacts. This includes both broad-phase and near-phase collision detection:
:ref:`mj_collision`
+2 -1
View File
@@ -267,7 +267,7 @@ struct mjData_ {
int* moment_colind; // column indices in sparse Jacobian (nJmom x 1)
mjtNum* actuator_moment; // actuator moments (nJmom x 1)
// computed by mj_fwdPosition/mj_crb
// computed by mj_fwdPosition/mj_makeM
mjtNum* crb; // com-based composite inertia and mass (nbody x 10)
mjtNum* qM; // inertia (sparse) (nM x 1)
mjtNum* M; // reduced inertia (compressed sparse row) (nC x 1)
@@ -3068,6 +3068,7 @@ void mj_flex(const mjModel* m, mjData* d);
void mj_tendon(const mjModel* m, mjData* d);
void mj_transmission(const mjModel* m, mjData* d);
void mj_crb(const mjModel* m, mjData* d);
void mj_makeM(const mjModel* m, mjData* d);
void mj_factorM(const mjModel* m, mjData* d);
void mj_solveM(const mjModel* m, mjData* d, mjtNum* x, const mjtNum* y, int n);
void mj_solveM2(const mjModel* m, mjData* d, mjtNum* x, const mjtNum* y,