Skip to content

Commit e396cb0

Browse files
authored
Fix get_inertia_matrix for MuJoCo >= 3.3.4. (#102)
1 parent 0709d20 commit e396cb0

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ All notable changes to this project will be documented in this file.
88

99
- `solve_ik` now raises a new exception, `NoSolutionFound`, when the QP solver fails to find a solution.
1010

11+
### Bugfix
12+
13+
- Fix `Configuration.get_inertia_matrix` for MuJoCo versions >= 3.3.4.
14+
1115
## [0.0.11] - 2025-05-22
1216

1317
### Added

mink/configuration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ def get_inertia_matrix(self) -> np.ndarray:
250250
"""
251251
# Run the composite rigid body inertia (CRB) algorithm to populate the joint
252252
# space inertia matrix data.qM.
253-
mujoco.mj_crb(self.model, self.data)
253+
if mujoco.mj_version() >= 334:
254+
mujoco.mj_makeM(self.model, self.data)
255+
else:
256+
mujoco.mj_crb(self.model, self.data)
254257
# data.qM is stored in a custom sparse format and can be converted to dense
255258
# format using mujoco.mj_fullM.
256259
M = np.empty((self.nv, self.nv), dtype=np.float64)

0 commit comments

Comments
 (0)