Migrate mjd_inverseFD mass Jacobian from qM to M

PiperOrigin-RevId: 942268237
Change-Id: I0ecfe161867ce9930cd6366d778077df2cd3197f
This commit is contained in:
Yuval Tassa
2026-07-03 15:35:16 -07:00
committed by Copybara-Service
parent 4b345457a8
commit 7e9ac58ff9
12 changed files with 24 additions and 21 deletions
+1 -1
View File
@@ -1508,7 +1508,7 @@ Euler integrator, semi-implicit in velocity.
ds_dq = np.zeros((self.model.nv, self.model.nsensordata), dtype=DTYPE)
ds_dv = np.zeros((self.model.nv, self.model.nsensordata), dtype=DTYPE)
ds_da = np.zeros((self.model.nv, self.model.nsensordata), dtype=DTYPE)
dm_dq = np.zeros((self.model.nv, self.model.nM), dtype=DTYPE)
dm_dq = np.zeros((self.model.nv, self.model.nC), dtype=DTYPE)
mujoco.mjd_inverseFD(
self.model,
self.data,
+2 -2
View File
@@ -1640,8 +1640,8 @@ PYBIND11_MODULE(_functions, pymodule, pybind11::mod_gil_not_used()) {
throw py::type_error("DsDa should be of shape (nv, nsensordata)");
}
if (DmDq.has_value() &&
(DmDq->rows() != m->nv || DmDq->cols() != m->nM)) {
throw py::type_error("DmDq should be of shape (nv, nM)");
(DmDq->rows() != m->nv || DmDq->cols() != m->nC)) {
throw py::type_error("DmDq should be of shape (nv, nC)");
}
return InterceptMjErrors(::mjd_inverseFD)(
m, d, eps, flg_actuation,
+1 -1
View File
@@ -9533,7 +9533,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
nullable=True,
),
),
doc='Finite differenced Jacobians of (force, sensors) = mj_inverse(state, acceleration) All outputs are optional. Output dimensions (transposed w.r.t Control Theory convention): DfDq: (nv x nv) DfDv: (nv x nv) DfDa: (nv x nv) DsDq: (nv x nsensordata) DsDv: (nv x nsensordata) DsDa: (nv x nsensordata) DmDq: (nv x nM) single-letter shortcuts: inputs: q=qpos, v=qvel, a=qacc outputs: f=qfrc_inverse, s=sensordata, m=qM notes: optionally computes mass matrix Jacobian DmDq flg_actuation specifies whether to subtract qfrc_actuator from qfrc_inverse', # pylint: disable=line-too-long
doc='Finite differenced Jacobians of (force, sensors) = mj_inverse(state, acceleration) All outputs are optional. Output dimensions (transposed w.r.t Control Theory convention): DfDq: (nv x nv) DfDv: (nv x nv) DfDa: (nv x nv) DsDq: (nv x nsensordata) DsDv: (nv x nsensordata) DsDa: (nv x nsensordata) DmDq: (nv x nC) single-letter shortcuts: inputs: q=qpos, v=qvel, a=qacc outputs: f=qfrc_inverse, s=sensordata, m=M notes: optionally computes mass matrix Jacobian DmDq flg_actuation specifies whether to subtract qfrc_actuator from qfrc_inverse', # pylint: disable=line-too-long
)),
('mjd_subQuat',
FunctionDecl(