Env setup: for Ubuntu 20.04
Build
sudo apt-get update && sudo apt-get install cmake libgl1-mesa-dev libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev ninja-build zlib1g-dev clang-12
mkdir build
cd build
For Ubuntu 22.04, according to [this issue](sudo apt-get install libstdc++-12-dev), should fix for clang 12:
sudo apt-get install libstdc++-12-dev
cmake .. -DCMAKE_BUILD_TYPE:STRING=Release -G Ninja -DCMAKE_C_COMPILER:STRING=clang-12 -DCMAKE_CXX_COMPILER:STRING=clang++-12 -DMJPC_BUILD_GRPC_SERVICE:BOOL=ON
Note: gRPC is a large dependency and can take 10-20 minutes to initially download.
cmake --build . --config=Release
Run GUI application
cd bin
./mjpc
Python API
- Build MJPC (see instructions above).
- Python 3.10
- (Optionally) Create a conda environment with Python 3.10:
conda create -n mjpc python=3.10
conda activate mjpc
- Install MuJoCo
pip install mujoco
Next, change to the python directory:
cd python
Install the Python module:
python setup.py install
Test that installation was successful:
python "mujoco_mpc/agent_test.py"
Example scripts are found in python/mujoco_mpc/demos
. For example from python/
:
python mujoco_mpc/demos/agent/cartpole_gui.py
will run the MJPC GUI application using MuJoCo's passive viewer via Python.