jc-bao / mujoco_mpc-fork

Real-time behaviour synthesis with MuJoCo, using Predictive Control

Home Page:https://github.com/deepmind/mujoco_mpc

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

  1. Build MJPC (see instructions above).
  2. Python 3.10
  3. (Optionally) Create a conda environment with Python 3.10:
conda create -n mjpc python=3.10
conda activate mjpc
  1. Install MuJoCo
pip install mujoco

Install API

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.

About

Real-time behaviour synthesis with MuJoCo, using Predictive Control

https://github.com/deepmind/mujoco_mpc

License:Apache License 2.0


Languages

Language:C++ 81.0%Language:Python 15.0%Language:CMake 3.3%Language:Jupyter Notebook 0.5%Language:Objective-C++ 0.1%