Add mjData.M, not yet used.

PiperOrigin-RevId: 758351796
Change-Id: I0786966b2f2c2e699db845cda6940a8821b23f49
This commit is contained in:
Yuval Tassa
2025-05-13 13:27:01 -07:00
committed by Copybara-Service
parent 1e02d66c3d
commit 79c74d7eae
7 changed files with 16 additions and 0 deletions
+1
View File
@@ -270,6 +270,7 @@ struct mjData_ {
// computed by mj_fwdPosition/mj_crb
mjtNum* crb; // com-based composite inertia and mass (nbody x 10)
mjtNum* qM; // total inertia (sparse) (nM x 1)
mjtNum* M; // total inertia (compressed sparse row) (nC x 1)
// computed by mj_fwdPosition/mj_factorM
mjtNum* qLD; // L'*D*L factorization of M (sparse) (nC x 1)
+1
View File
@@ -298,6 +298,7 @@ struct mjData_ {
// computed by mj_fwdPosition/mj_crb
mjtNum* crb; // com-based composite inertia and mass (nbody x 10)
mjtNum* qM; // total inertia (sparse) (nM x 1)
mjtNum* M; // total inertia (compressed sparse row) (nC x 1)
// computed by mj_fwdPosition/mj_factorM
mjtNum* qLD; // L'*D*L factorization of M (sparse) (nC x 1)
+1
View File
@@ -653,6 +653,7 @@
X ( mjtNum, actuator_moment, nJmom, 1 ) \
X ( mjtNum, crb, nbody, 10 ) \
X ( mjtNum, qM, nM, 1 ) \
X ( mjtNum, M, nC, 1 ) \
X ( mjtNum, qLD, nC, 1 ) \
X ( mjtNum, qLDiagInv, nv, 1 ) \
XMJV( mjtNum, bvh_aabb_dyn, nbvhdynamic, 6 ) \
+2
View File
@@ -509,6 +509,7 @@ def _make_data_jax(
'actuator_moment': (m.nu, m.nv, float_),
'crb': (m.nbody, 10, float_),
'qM': (m.nM, float_) if support.is_sparse(m) else (m.nv, m.nv, float_),
'M': (m.nC, float_),
'qLD': (m.nC, float_) if support.is_sparse(m) else (m.nv, m.nv, float_),
'qLDiagInv': (m.nv, float_) if support.is_sparse(m) else (0, float_),
'ten_velocity': (m.ntendon, float_),
@@ -618,6 +619,7 @@ def _make_data_c(
'flexedge_velocity': (nflexedge, float_),
'crb': (m.nbody, 10, float_),
'qM': (m.nM, float_),
'M': (m.nC, float_),
'qLD': (m.nC, float_),
'qH': (m.nC, float_),
'qHDiagInv': (m.nv, float_),
+2
View File
@@ -970,6 +970,7 @@ class DataC(PyTreeNode):
actuator_moment: jax.Array
crb: jax.Array
qM: jax.Array # pylint:disable=invalid-name
M: jax.Array # pylint:disable=invalid-name
qLD: jax.Array # pylint:disable=invalid-name
qLDiagInv: jax.Array # pylint:disable=invalid-name
bvh_aabb_dyn: jax.Array
@@ -1037,6 +1038,7 @@ class DataJAX(PyTreeNode):
actuator_moment: jax.Array
crb: jax.Array
qM: jax.Array # pylint:disable=invalid-name
M: jax.Array # pylint:disable=invalid-name
qLD: jax.Array # pylint:disable=invalid-name
qLDiagInv: jax.Array # pylint:disable=invalid-name
ten_velocity: jax.Array
+8
View File
@@ -5392,6 +5392,14 @@ STRUCTS: Mapping[str, StructDecl] = dict([
doc='total inertia (sparse)',
array_extent=('nM',),
),
StructFieldDecl(
name='M',
type=PointerType(
inner_type=ValueType(name='mjtNum'),
),
doc='total inertia (compressed sparse row)',
array_extent=('nC',),
),
StructFieldDecl(
name='qLD',
type=PointerType(
+1
View File
@@ -4929,6 +4929,7 @@ public unsafe struct mjData_ {
public double* actuator_moment;
public double* crb;
public double* qM;
public double* M;
public double* qLD;
public double* qLDiagInv;
public double* bvh_aabb_dyn;