Closed KamatMayur closed 3 days ago
Never-mind it seems that the current version installed from pip isn't updated and the issue was on line 435, 436, 437. In the io.py file in mjx/_src. These lines were initializing the numpy arrays as int instead of np.int32. This is apparently fixed on the GitHub version but not present in the pip version so adding just that solved the issue..
Thanks for posting this! I also ran into this problem with the get_data_into
function, which is the same thing, but It took me a while to find this issue. So I'll post some of the error message here as well to make this post more searchable.
python3.10/site-packages/mujoco/mjx/_src/io.py", line 439, in get_data_into
mujoco.mju_dense2sparse(
TypeError: mju_dense2sparse(): incompatible function arguments. The following argument types are supported:
1. (res: numpy.ndarray[numpy.float64[m, 1], flags.writeable], mat: numpy.ndarray[numpy.float64[m, n], flags.c_contiguous], rownnz: numpy.ndarray[numpy.int32[m, 1], flags.writeable], rowadr: numpy.ndarray[numpy.int32[m, 1], flags.writeable], colind: numpy.ndarray[numpy.int32[m, 1], flags.writeable]) -> int
Invoked with: array([0., 0., 0., ..., 0., 0., 0.]), array([[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
...,
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.],
[0., 0., 0., ..., 0., 0., 0.]], dtype=float32), array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0]), array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0]), array([0, 0, 0, ..., 0, 0, 0])
Intro
Hi!
I am a graduate . I use MuJoCo for my research on Robotics.
My setup
mujoco version: 3.2.5 python api 64 bit Ubuntu 24.04.1 LTS
What's happening? What did you expect?
I was testing the humanoid model which comes by default with mujoco. I copied the model and stored in the xml file. Then i ran the simulation first with mujoco on cpu and it ran fine. Then i tried to run it using mujoco mjx and i was getting error pointing to
mj_data = mjx.get_data(mj_model, mjx_data)
Steps for reproduction
Just run the code below to reproduce the error
Minimal model for reproduction
Use the model that comes with mujoco called "humanoid.xml"
Code required for reproduction
Confirmations