This repository consists of a set of gymnasium "environments" which are essentially wrappers around pychrono. In order to install gym-chrono, we must first install its dependecies 1) pychrono 2) gymnasium 3) stable-baselines3[extra]
Before you begin the installation process, you will need to download the data
folder containing the simulation assets and place it in the right place:
1) Download the data files here, unzip if necessary, you should obtain a folder named data
.
2) Copy the data to DIR_OF_REPO/gym-chrono/envs
.
Once the data folder has been downloaded and placed in the right folder, it needs to be added to path:
For Linux or Mac users:
Replace bashrc with the shell your using. Could be .zshrc
.
export CHRONO_DATA_DIR=<Downloaded data directory path>' >> ~/.bashrc
home
, then, echo export CHRONO_DATA_DIR=/home/user/gym-chrono/gym-chrono/envs/data/' >> ~/.bashrc
source ~/.bashrc
For Windows users:
Link as reference: https://helpdeskgeek.com/how-to/create-custom-environment-variables-in-windows/
1) First you need to install pychrono from source. The Chrono source that needs to be cloned is linked here. Please use the feature/robot_model branch. We use this fork with this branch because it contains all the latest robot models that are not currently available in Chrono main. 2) Once you have the source cloned, build pychrono from source using instructions found here. Enable modules Chrono::Sensor, Chrono::Irrlicht, Chrono::SynChrono, Chrono::Vehicle, Chrono::Python, Chrono::OPENMP and Chrono::Parsers. For each of these modules, please look at the official Chrono documentation. 3) Make sure you add the appropriate numpy include directory (see linked instructions above) 4) If you are not doing a system wide install of pychrono, make sure you add to PYTHONPATH the path to the installed python libraries (see linked instructions above)
pip install gymnasium
[!NOTE] If you are using a conda environment, activate the conda environment and then use the same command above.
pip install stable-baselines3[extra]
[!NOTE]
stable-baselines3
installs nupmy as a dependency, so it is recomended to remove this installation and install your own version of numpy. Additionally,pychrono
requiresnumpy=1.24.0
, and it must be installed with conda, so it is necessary to runpip uninstall numpy
andconda install -c conda-forge numpy=1.24.0
to not get apychrono.sensor
error.Rough Edges
Adding gym-chrono to path
Due to the lack of a pip installer for this package currently, you must add gym-chrono to
PYTHONPATH
:echo 'export PYTHONPATH=$PYTHONPATH:<path to gym-chrono>' >> ~/.bashrc
Replace
~/.bashrc
with~/.zshrc
in case you are usingzsh
.
For Windows users, follow instructions from here.
This repository is structured as follows:
gym-chrono
folder is all that you need:
playground
folder contains scripts that do not use Chrono as a simulation engine. This folder is maintained just for experimentationimages
folder consists of images used in the readme
like the one below!