MuJoCo: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
(translation markup)
(Marked this version for translation)
 
(11 intermediate revisions by 3 users not shown)
Line 4: Line 4:


<!--T:1-->
<!--T:1-->
'''MuJoCo''' "''stands for Multi-Joint dynamics with Contact. It is a physics engine aiming to facilitate research and development in robotics, biomechanics, graphics and animation, and other areas where fast and accurate simulation is needed.''"
''MuJoCo stands for '''Mu'''lti-'''Jo'''int dynamics with '''Co'''ntact. It is a physics engine aiming to facilitate research and development in robotics, biomechanics, graphics and animation, and other areas where fast and accurate simulation is needed.<ref>http://www.mujoco.org/</ref>''


It is frequently used with the associated Python module <code>mujoco_py</code> as an environment for Reinforcement Learning research.
<!--T:4-->
It is frequently used with the associated Python bindings <code>mujoco</code> as an environment for reinforcement learning (RL) research.


__TOC__
<!--T:20-->
The module contains MuJoCo C/C++ library and its Python bindings.


==Installation==
== Library == <!--T:21-->
In order to access headers and binaries, load the module:
{{Command|module load mujoco}}


=== Base Files === <!--T:2-->
== Python bindings == <!--T:22-->
To discover which are the compatible Python versions, run
{{Command|module spider mujoco/2.2.2}}


First, the .mujoco folder in your home directory must be set up. MuJoCo '''requires a licence key''' to be placed in
<!--T:23-->
~/.mujoco/mjkey.txt. This key obtained by e-mail after registration.
1. Load the required modules.
{{Command|module load mujoco python}}


The appropriate (linux) MuJoCo distribution must also be downloaded and unzipped into the ~/.mujoco directory from the Download section of the [https://www.roboti.us/index.html MuJoCo website].
<!--T:24-->
2. Import MuJoCo.
{{Command|python -c "import mujoco"}}


Your ~/.mujoco folder should now look like this (the version might differ):
<!--T:25-->
{{Command
If the command displays nothing, the import was successful.
|ls ~/.mujoco
|result=
mjkey.txt mjproj150
}}
 
=== mujoco_py === <!--T:3-->
 
The python interface to MuJoCo is the <code>mujoco_py</code> module. Getting it to work re somequires special steps because library paths need to be patched.
 
After using <code>module</code> to load the desired python version, you should set up a clean virtualenv and install the <code>mujoco_py</code> module:
 
{{Commands
|mkdir mujoco_env
|virtualenv mujoco_env
|source mujoco_env/bin/activate
|pip install mujoco_py
}}
 
Now the paths need to be patched with setrpaths.sh. Use the appropriate python version in the commands below if it is not 3.5:
 
{{Commands
|setrpaths.sh --path $VIRTUAL_ENV/lib/python3.5/site-packages/mujoco_py
|setrpaths.sh --add_origin --path $HOME/.mujoco
|export LD_LIBRARY_PATH=$HOME/.mujoco/mjpro150/bin:$LD_LIBRARY_PATH
}}
 
Now run the following command:
 
{{Command|python -c "import mujoco_py"}}
 
It should have crashed. However, it created the necessary paths to run:
 
{{Command|setrpaths.sh --path $VIRTUAL_ENV/lib/python3.5/site-packages/mujoco_py}}
 
After that last command, mujoco_py should be ready to use in the virtual environment. If everything installed correctly, the command below should run without any errors:
{{Command|python -c "import mujoco_py"}}


</translate>
</translate>

Latest revision as of 17:57, 27 September 2022

Other languages:

MuJoCo stands for Multi-Joint dynamics with Contact. It is a physics engine aiming to facilitate research and development in robotics, biomechanics, graphics and animation, and other areas where fast and accurate simulation is needed.[1]

It is frequently used with the associated Python bindings mujoco as an environment for reinforcement learning (RL) research.

The module contains MuJoCo C/C++ library and its Python bindings.

Library

In order to access headers and binaries, load the module:

Question.png
[name@server ~]$ module load mujoco

Python bindings

To discover which are the compatible Python versions, run

Question.png
[name@server ~]$ module spider mujoco/2.2.2

1. Load the required modules.

Question.png
[name@server ~]$ module load mujoco python

2. Import MuJoCo.

Question.png
[name@server ~]$ python -c "import mujoco"

If the command displays nothing, the import was successful.