MJX step gives wrong results or fails to update the state (depending on init conditions) #2361
Open
2 tasks done
Labels
bug
Something isn't working
Intro
Hi!
I am a software engineer at Istituto Italiano di Tecnologia (IIT), we use MuJoCo for RL.
My setup
Mujoco version
OS
Kernel / arch
Output of `pip freeze`
``` absl-py==2.1.0 alabaster==0.7.12 appdirs==1.4.4 argcomplete==3.1.4 asttokens==2.4.1 attrs==23.2.0 Babel==2.10.3 bcc==0.29.1 beautifulsoup4==4.12.3 blinker==1.7.0 bloom==0.12.0 breezy==3.3.5 Brlapi==0.8.5 Brotli==1.1.0 catkin-pkg==1.0.0 catkin-pkg-modules==1.0.0 certifi==2023.11.17 chardet==5.2.0 click==8.1.6 cloud-init==24.4 colcon-argcomplete==0.3.3 colcon-bash==0.5.0 colcon-cd==0.2.1 colcon-cmake==0.2.29 colcon-common-extensions==0.3.0 colcon-core==0.18.4 colcon-defaults==0.2.9 colcon-devtools==0.3.0 colcon-installed-package-information==0.2.1 colcon-library-path==0.2.1 colcon-metadata==0.2.5 colcon-mixin==0.2.3 colcon-notification==0.3.0 colcon-output==0.2.13 colcon-override-check==0.0.1 colcon-package-information==0.4.0 colcon-package-selection==0.2.10 colcon-parallel-executor==0.3.0 colcon-pkg-config==0.1.0 colcon-powershell==0.4.0 colcon-python-setup-py==0.2.9 colcon-recursive-crawl==0.2.3 colcon-ros==0.5.0 colcon-test-result==0.3.8 colcon-zsh==0.5.0 colorama==0.4.6 command-not-found==0.3 configobj==5.0.8 contourpy==1.0.7 coverage==7.4.4 cryptography==41.0.7 cssselect==1.2.0 cupshelpers==1.0 cycler==0.11.0 dbus-python==1.3.2 decorator==5.1.1 defer==1.0.6 Deprecated==1.2.14 distlib==0.3.8 distro==1.9.0 distro-info==1.7+build1 docutils==0.20.1 dulwich==0.21.6 empy==3.3.4 etils==1.11.0 executing==2.0.1 fastbencode==0.2 fastimport==0.9.14 flake8==7.0.0 flake8-blind-except==0.2.1 flake8-builtins==2.1.0 flake8-class-newline==1.6.0 flake8-comprehensions==3.14.0 flake8-deprecated==2.2.1 flake8-docstrings==1.6.0 flake8-import-order==0.18.2 flake8-quotes==3.4.0 fonttools==4.46.0 fs==2.4.16 fsspec==2024.12.0 furo==0.0.0 glfw==2.8.0 gpg==1.18.0 html5lib==1.1 httplib2==0.20.4 idna==3.6 imagesize==1.4.1 importlib-metadata==4.12.0 importlib_resources==6.5.2 iniconfig==1.1.1 ipython==8.20.0 jax==0.4.38 jax-cuda12-pjrt==0.4.38 jax-cuda12-plugin==0.4.38 jaxlib==0.4.38 jedi==0.19.1 Jinja2==3.1.2 jsonpatch==1.32 jsonpointer==2.0 jsonschema==4.10.3 kiwisolver==0.0.0 language-selector==0.1 lark==1.1.9 launchpadlib==1.11.0 lazr.restfulclient==0.14.6 lazr.uri==1.0.6 louis==3.29.0 lxml==5.2.1 lz4==4.0.2+dfsg markdown-it-py==3.0.0 MarkupSafe==2.1.5 matplotlib==3.6.3 matplotlib-inline==0.1.6 mccabe==0.7.0 mdurl==0.1.2 mercurial==6.7.2 merge3==0.0.8 meson==1.3.2 ml_dtypes==0.5.1 more-itertools==10.2.0 mpi4py==3.1.5 mpmath==0.0.0 mujoco==3.2.7 mujoco-mjx==3.2.7 mypy==1.9.0 mypy-extensions==1.0.0 netaddr==0.8.0 netifaces==0.11.0 notify2==0.3 ntplib==0.3.3 numpy==1.26.4 nvidia-cublas-cu12==12.6.4.1 nvidia-cuda-cupti-cu12==12.6.80 nvidia-cuda-nvcc-cu12==12.6.85 nvidia-cuda-runtime-cu12==12.6.77 nvidia-cudnn-cu12==9.6.0.74 nvidia-cufft-cu12==11.3.0.4 nvidia-cusolver-cu12==11.7.1.2 nvidia-cusparse-cu12==12.5.4.2 nvidia-nccl-cu12==2.24.3 nvidia-nvjitlink-cu12==12.6.85 oauthlib==3.2.2 olefile==0.46 opt_einsum==3.4.0 packaging==24.0 parso==0.8.3 patiencediff==0.2.13 pexpect==4.9.0 pillow==10.2.0 pluggy==1.4.0 prompt-toolkit==3.0.43 protobuf==4.21.12 psutil==5.9.8 ptyprocess==0.7.0 pure-eval==0.0.0 PyAudio==0.2.13 pycairo==1.25.1 pycodestyle==2.11.1 pycups==2.0.1 pydocstyle==6.3.0 pydot==1.4.2 pyflakes==3.2.0 PyGithub==2.2.0 Pygments==2.17.2 PyGObject==3.48.2 PyJWT==2.7.0 PyNaCl==1.5.0 PyOpenGL==3.1.7 pyparsing==3.1.1 PyQt5==5.15.10 PyQt5-sip==12.13.0 pyrsistent==0.20.0 pyserial==3.5 pytest==7.4.4 pytest-cov==4.1.0 pytest-mock==3.12.0 pytest-repeat==0.9.3 pytest-rerunfailures==12.0 pytest-runner==2.11.1 pytest-timeout==2.2.0 python-apt==2.7.7+ubuntu3 python-dateutil==2.8.2 python-debian==0.1.49+ubuntu2 pytz==2024.1 pyxdg==0.28 PyYAML==6.0.1 requests==2.31.0 rich==13.7.1 roman==3.3 rosdep==0.25.1 rosdep-modules==0.25.1 rosdistro==1.0.1 rosdistro-modules==1.0.1 rospkg-modules==1.5.1 SciPy==1.11.4 screen-resolution-extra==0.0.0 semver==2.10.2 setuptools==68.1.2 six==1.16.0 snowballstemmer==2.2.0 soupsieve==2.5 Sphinx==7.2.6 sphinx-basic-ng==1.0.0b2 sphinx_inline_tabs==2023.4.21 ssh-import-id==5.11 stack-data==0.6.3 sympy==1.12 systemd-python==235 termcolor==1.1.0 terminator==2.1.3 tqdm==0.0.0 traitlets==5.5.0 transforms3d==0.4.1 trimesh==4.5.3 typeguard==4.1.5 types-aiofiles==23.2 types-aws-xray-sdk==2.12 types-beautifulsoup4==4.12 types-bleach==6.1 types-boltons==23.0 types-boto==2.49 types-braintree==4.24 types-cachetools==5.3 types-caldav==1.3 types-cffi==1.16 types-chevron==0.14 types-click-default-group==1.2 types-click-spinner==0.1 types-colorama==0.4 types-commonmark==0.9 types-console-menu==0.8 types-croniter==2.0 types-dateparser==1.1 types-decorator==5.1 types-Deprecated==1.2 types-dockerfile-parse==2.0 types-docopt==0.6 types-docutils==0.20 types-editdistance==0.6 types-entrypoints==0.4 types-ExifRead==3.0 types-first==2.0 types-flake8-2020==1.8 types-flake8-bugbear==23.9.16 types-flake8-builtins==2.2 types-flake8-docstrings==1.7 types-flake8-plugin-utils==1.3 types-flake8-rst-docstrings==0.3 types-flake8-simplify==0.21 types-flake8-typing-imports==1.15 types-Flask-Cors==4.0 types-Flask-Migrate==4.0 types-Flask-SocketIO==5.3 types-fpdf2==2.7.4 types-gdb==12.1 types-google-cloud-ndb==2.2 types-greenlet==3.0 types-hdbcli==2.18 types-html5lib==1.1 types-httplib2==0.22 types-humanfriendly==10.0 types-ibm-db==3.2 types-influxdb-client==1.38 types-inifile==0.4 types-JACK-Client==0.5 types-jmespath==1.0 types-jsonschema==4.19 types-keyboard==0.13 types-ldap3==2.9 types-libsass==0.22 types-Markdown==3.5 types-mock==5.1 types-mypy-extensions==1.0 types-mysqlclient==2.2 types-netaddr==0.9 types-oauthlib==3.2 types-openpyxl==3.1 types-opentracing==2.4 types-paho-mqtt==1.6 types-paramiko==3.3 types-parsimonious==0.10 types-passlib==1.7 types-passpy==1.0 types-peewee==3.17 types-pep8-naming==0.13 types-pexpect==4.8 types-pika-ts==1.3 types-Pillow==10.1 types-playsound==1.3 types-pluggy==1.2.0 types-polib==1.2 types-portpicker==1.6 types-protobuf==4.24 types-psutil==5.9 types-psycopg2==2.9 types-pyasn1==0.5 types-pyaudio==0.2 types-PyAutoGUI==0.9 types-pycocotools==2.0 types-pycurl==7.45.2 types-pyfarmhash==0.3 types-pyflakes==3.1 types-Pygments==2.16 types-pyinstaller==6.1 types-pyjks==20.0 types-PyMySQL==1.1 types-pynput==1.7 types-pyOpenSSL==23.3 types-pyRFC3339==1.1 types-PyScreeze==0.1.29 types-pyserial==3.5 types-pysftp==0.2 types-pytest-lazy-fixture==0.6 types-python-crontab==3.0 types-python-datemath==1.5 types-python-dateutil==2.8 types-python-gflags==3.1 types-python-jose==3.3 types-python-nmap==0.7 types-python-slugify==8.0 types-python-xlib==0.33 types-pytz==2023.3.post1 types-pywin32==306 types-pyxdg==0.28 types-PyYAML==6.0 types-qrcode==7.4 types-redis==4.6.0 types-regex==2023.10.3 types-requests==2.31 types-requests-oauthlib==1.3 types-retry==0.9 types-s2clientprotocol==5 types-seaborn==0.13 types-Send2Trash==1.8 types-setuptools==68.2 types-simplejson==3.19 types-singledispatch==4.1 types-six==1.16 types-slumber==0.7 types-stdlib-list==0.8 types-stripe==3.5 types-tabulate==0.9 types-tensorflow==2.12 types-toml==0.10 types-toposort==1.10 types-tqdm==4.66 types-translationstring==1.4 types-tree-sitter==0.20.1 types-tree-sitter-languages==1.8 types-ttkthemes==3.2 types-tzlocal==5.1 types-ujson==5.8 types-untangle==1.2 types-usersettings==1.1 types-uWSGI==2.0 types-vobject==0.9 types-waitress==2.1 types-WebOb==1.8 types-whatthepatch==1.0 types-workalendar==17.0 types-WTForms==3.1 types-xmltodict==0.13 types-zstd==1.5 types-zxcvbn==4.4 typing_extensions==4.10.0 tzlocal==5.2 ubuntu-drivers-common==0.0.0 ubuntu-pro-client==8001 ufoLib2==0.16.0 ufw==0.36.2 unattended-upgrades==0.1 unicodedata2==15.1.0 urllib3==2.0.7 vcstool==0.3.0 vcstools==0.1.42 wadllib==1.3.6 wcwidth==0.2.5 webencodings==0.5.1 wheel==0.42.0 wrapt==1.15.0 xdg==5 xkit==0.0.0 zipp==1.0.0 ```What's happening? What did you expect?
Depending on initial conditions, MJX's
mj_step
either gives wrong results (compared to plain Mujoco) or does not update the state (qpos, qvel) at all. The model is a plain cartpole, which I am attaching with the rest of the code / requirements.txt.The MRE is very simple as expected:
Output on my system:
As you can see, the MJX
qpos
does not change at all. But it gets more weird: if I uncomment the line that just launches a passive viewer (doing nothing in the background), then the result changes to the following:It is probably something specific to my system, yet I am failing to understand what it could be.
Steps for reproduction
Run the
run.py
script in the ZIP folder below. It also contains arequirements.txt
file for reproducing my pip env.Then, uncomment line 21 and run again.
mre_bug_noupdate.zip
Minimal model for reproduction
No response
Code required for reproduction
No response
Confirmations
The text was updated successfully, but these errors were encountered: