raisimGym is an example of a gym environment using raisim. It uses stable-baselines (https://github.com/hill-a/stable-baselines) for training and pybind11 (https://github.com/pybind/pybind11) for wrapping raisim in python.
- There was a bug in the examples. The P gain was set to a wrong dimension. This is fixed as of v0.3.2. Please update to the latest version. If you used the example as a template for your project, please fix your project as well.
- Linux only. support ubuntu 16.04 and 18.04 but might work on other distributions
- g++, gcc > 6 (how to install?)
- cmake > 3.10 (how to install?)
Please install/save everything locally to prevent corrupting your system files. We will assume that you have a single workspace where you save all repos related to raisim.
Here we introduce two variables
- WORKSPACE: workspace where you clone your git repos
- LOCAL_BUILD: build directory where you install exported cmake libraries
You can check out our docker file if you are stuck.
- Install python3
- For Ubuntu18.04 (sudo apt-get install -y cmake python3.6-dev python3-pip libpython3.6-dev)
- For Ubuntu16.04 (sudo apt-get install -y cmake python3.5-dev python3-pip libpython3.5-dev)
- Setup your python environment (virtualenv or conda) with Python > 3.5
Install the following dependencies
- Raisim (https://github.com/leggedrobotics/raisimLib)
- RaisimOgre (https://github.com/leggedrobotics/raisimOgre)
- yaml-cpp (sudo apt-get install libyaml-cpp-dev)
Now install pybind11 as following
cd $WORKSPACE
git clone https://github.com/pybind/pybind11.git
cd pybind11 && git checkout v2.3 && mkdir build && cd build
cmake .. -DCMAKE_INSTALL_PREFIX=$LOCAL_BUILD -DPYBIND11_TEST=OFF
make install -j4
You might have to add LOCAL_BUILD/lib to your $LD_LIBRARY_PATH to ensure that ld finds Ogre3D shared objects.
- Compile your c++ environment (instructions followed)
- Run your learning script (instructions followed)
or use the dockerfile provided (instruction below)
Set your compiler to g++>6.0 as following
export CXX=/usr/bin/g++-8 && export CC=/usr/bin/gcc-8
Now compile raisimGym as
python3 setup.py install --CMAKE_PREFIX_PATH LOCAL_BUILD --env /WHERE/YOUR/CUSTOM/ENVIRONMENT/IS
The "--env" directory should include a file called "Environment.hpp" which contains ENVIRONMENT class.
We provide a shortcut for building examples. Replace $EXAMPLE_NAME
by one of the following names: anymal, laikago, and quadrotor
python3 setup.py install --CMAKE_PREFIX_PATH $LOCAL_BUILD --env $EXAMPLE_NAME
You can make your own runner. To use the example runner,
python3 scripts/anymal_blind_locomotion.py
- Install docker and Nvidia-docker2 (instruction).
- Build an image
docker build -t raisim_gym $WORKSPACE/raisimGym/dockers/gpu
- Create a container using the provided docker runner
$WORKSPACE/raisimGym/dockers/gpu/runner.bash
- Inside the container, compile your environment and execute your runner
Dr. Inkyu Sa kindly provided a comphensive tutorial on raisimGym here
- Trained with RTX 2080 + Intel 8700K + PPO [1]
- 18 dof quadrupedal robot, 34-dimentional observation space
Initial policy | 38 seconds of training |
---|---|
76 seconds of training | 112 seconds of training |
---|---|
This quadrotor example is not fully tuned for real applications. Please feel free to optimize the example
- Due to conversion between numpy and eigen, the interface class (e.g., VectorizedEnv) should use row major matrices only.
- When build fails, try again after deleting the
build
folder
raisimGym is meant to be a minimal example. Please do not submit a pull request that contains features targeting specific applications. Bug fix/code clean-up are welcome.
Fork the repo, make changes and then send a pull request. Instructions can be found here
[1] Schulman, John, et al. "Proximal policy optimization algorithms." arXiv preprint arXiv:1707.06347 (2017).
Jemin Hwangbo is developing/manaing raisimGym with help from the followig contributors
- Inkyu Sa
- Haloted