What • Why • How • Demo • Setup • Citation
Gym-Ignition provides the capability of creating reproducible robotics environments for reinforcement learning research.
The project is composed of the following components:
Component | Description |
---|---|
ignition |
A set of classes to interface gympp with the new Ignition Gazebo simulator, part of the Ignition Robotics suite. |
plugins |
Ignition Gazebo plugins. |
gym_ignition |
Python package for creating OpenAI Gym environments. Environments can be implemented either in C++ using gympp or in Python using the SWIG binded classes of the ignition component. |
gym_ignition_data |
SDF and URDF models and Gazebo worlds. |
gympp |
An experimental C++ port of the OpenAI Gym interfaces, used to create pure C++ environments. |
Refer to the Citation for the extended rationale behind this project.
TL;DR
We designed Gym-Ignition driven by the following reasons:
- Advances in RL research are pushed by the development of more complex environments, and vice versa.
- There's no standard framework in the robotics community for creating simulated robotic environments.
- Environments that can be transferred from simulation to reality with minimal changes do not exist.
- Alternative solutions are not developed by roboticists for roboticist, and therefore they do not use familiar tools.
- Existing robotics environments are typically difficult to adapt to run on different physics engines and different robotic platforms.
- Only few solutions offer realistic rendering capabilities.
This project interfaces with the new generation of the Gazebo simulator, called Ignition Gazebo. It is part of the new Ignition Robotics suite developed by Open Robotics.
Ignition Robotics is currently under heavy development and is not yet stable. Though, it already offers enough functionalities for this project's aims:
- Simulator-as-a-library
- New modular architecture
- C++ utilities developed with a robotic mindset
- New abstractions of physics engines and rendering engines that exploit runtime plugins
- Full support of DART and coming support of bullet3
- Support of distributed simulations
- Well maintained and packaged
- Ignition Fuel database to download models and worlds
At the time of writing, Gym-Ignition offers the following features:
- Environments compatible with OpenAI Gym
- Worlds and models are SDF descriptions
- Reproducibility guarantees
- Accelerated and multiprocess execution
- Environments are a combination of three elements:
- Task: the logic of the decision-making problem. It defines how to process the given action, how to calculate the reward, how to structure the observation, and how to reset the environment. Task objects are robot-independent and runtime-independent.
- Robot: unified interface to access to robot resources. It is used to gather data and send commands to either simulated or real robot in a seamless way.
- Runtime: implements the actual step of the environment. Simulated runtimes step the simulator, real-time runtimes deal with real-time execution constraints. A Task object can be executed by any runtime without any change.
- Experimental support to create C++ environments
We provide two different methods to test Gym-Ignition without the need to install it locally:
- Colab notebook:
and run the example
- Docker image:
docker pull diegoferigo/gym-ignition:latest pip3 install rocker # Intel GPU rocker --x11 diegoferigo/gym-ignition ./github/examples/python/launch_cartpole.py # Nvidia GPU rocker --x11 --nvidia diegoferigo/gym-ignition ./github/examples/python/launch_cartpole.py
The setup instructions expect a Ubuntu distribution with at least Python 3.6. Gym-Ignition is compatible also with other distributions (and, also, other OSs) under the assumption that the Ignition Robotics suite can be installed either from repos or source. Though, to keep the instructions simple, we only report the steps for the Ubuntu distro.
The process is different whether you're an user that wants to create environments using Gym-Ignition or you are a developer that wants to edit the Python and C++ upstream code.
Execute all the setup commands in the same terminal.
-
Install the supported version of Ignition Gazebo:
sudo sh -c 'echo "deb http://packages.osrfoundation.org/gazebo/ubuntu-stable `lsb_release -cs` main" > /etc/apt/sources.list.d/gazebo-stable.list' wget http://packages.osrfoundation.org/gazebo.key -O - | sudo apt-key add - sudo apt update sudo apt install ignition-blueprint
We currently require the development version, that will be ABI-compatible with the Blueprint release. Refer to the official documentation for more detailed information.
-
Create a Python virtual environment as follows:
sudo apt install virtualenv virtualenv -p python3.6 $HOME/venv source $HOME/venv/bin/activate
pip3 install gym-ignition
You can now run the example launch_cartpole.py
.
-
Install gcc 8 with
apt install gcc-8
. Export the following environment variables to enable it temporarily:export CC=gcc-8 export CXX=g++-8
-
Install SWIG with
apt install swig
-
Clone this repository
-
Build and install the CMake project
mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=<installprefix> .. cmake --build . cmake --build . --target install
-
Install the Python package in editable mode:
pip3 install -e .
-
Export the following environment variable:
# C++ bindings export PYTHONPATH=<installprefix>/lib/python3.6/site-packages
After these steps, you can run the example launch_cartpole.py
.
Gym-Ignition still doesn't have a steady release cycle strategy. This project targets mainly research, and its development is very active. In order to quickly deliver new features, we do our best to have a fast release cycle.
If you find interesting PRs that are not yet included in the most recent release, you can get the latest unstable version as follows:
-
User installation:
pip3 install gym-ignition-nightly
-
Developer installation: check-out the
devel
branch after cloning the repository and follow the remaining steps
@inproceedings{ferigoGymIgnition2019,
title = {Gym-Ignition: Reproducible Robotic Simulations for Reinforcement Learning},
author = {Ferigo, Diego and Traversaro, Silvio and Pucci, Daniele},
booktitle = {RSS 2019 Workshop on Closing the Reality Gap in Sim2real Transfer for Robotic Manipulation},
year = {2019},
}
Disclaimer: Gym-Ignition is an independent project and is not related by any means to OpenAI and Open Robotics.