duburcqa / jiminy

Jiminy: a fast and portable Python/C++ simulator of poly-articulated robots with OpenAI Gym interface for reinforcement learning
https://duburcqa.github.io/jiminy
MIT License
230 stars 26 forks source link
c-plus-plus machine-learning openai-gym python robotics simulator

License Version Python Downloads Try it in Binder Try it in Colab Try in in Deepnote Linux CI MacOS CI Windows CI

Jiminy is a cross-platform open-source simulator for poly-articulated systems. It was built with two ideas in mind:

Jiminy is built around Pinocchio, an open-source fast and efficient kinematics and dynamics library. Jiminy thus uses minimal coordinates and Lagrangian dynamics to simulate an articulated system: this makes Jiminy as close as numerically possible to an analytical solution, without the risk of joint violation.

Beside a strong focus on performance to answer machine learning's need for running computationally demanding distributed simulations, Jiminy offers convenience tools for learning via a dedicated module Gym-Jiminy. It is fully compliant with gym standard API and provides a highly customizable wrapper to interface any robotics system with state-of-the-art learning frameworks.

Key features

General

Physics

A more complete list of features is available on the wiki.

The documentation is available on Github.io, or locally in docs/html/index.html if built from source.

Gym Jiminy

Gym Jiminy is an interface between Jiminy simulator and reinforcement learning frameworks. It is fully compliant with now standard Open AI Gym API. Additionally, it offers a generic and easily configurable learning environment for learning locomotion tasks, with minimal intervention from the user, who usually only needs to provide the robot's URDF file. Furthermore, Gym Jiminy enables easy modification of many aspects of the simulation to provide richer exploration and ensure robust learning. This ranges from external perturbation forces to sensor noise and bias, including randomization of masses and inertias, ground friction model or even gravity itself. Note that learning can easily be done on any high-level dynamics features, or restricted to mock sensor data for end-to-end learning.

Gym is cross-platform and compatible with most Reinforcement Learning frameworks implementing standard algorithms. For instance, Stable Baselines 3, Tianshou, or Rllib. Stable Baselines 3 and Tianshou use its counterpart Pytorch, and Rllib supports both. A few learning examples relying on those packages are also provided.

Pre-configured environments for some well-known toys models and reference robotics platforms are provided: cartpole, acrobot, pendulum, Ant, ANYmal, and Cassie, and Atlas.

Demo

Getting started

Jiminy and Gym Jiminy support Linux, Mac and Windows, and is compatible with Python3.10+. Pre-compiled binaries are distributed on PyPi. They can be installed using pip>=20.3:

# For installing Jiminy
python -m pip install --prefer-binary jiminy_py[meshcat,plot]

# For installing Gym Jiminy
python -m pip install --prefer-binary gym_jiminy[all]

Detailed installation instructions, including building from source, are available here.