Skip to main content

A physics engine in reduced coordinates implemented with JAX.

Project description

JaxSim

JaxSim is a differentiable physics engine and multibody dynamics library designed for applications in control and robot learning, implemented with JAX.

Its design facilitates research and accelerates prototyping in the intersection of robotics and artificial intelligence.

Features

  • Physics engine in reduced coordinates supporting fixed-base and floating-base robots.
  • Multibody dynamics library providing all the necessary components for developing model-based control algorithms.
  • Completely developed in Python with google/jax following a functional programming paradigm.
  • Transparent support for running on CPUs, GPUs, and TPUs.
  • Full support for JIT compilation for increased performance.
  • Full support for automatic vectorization for massive parallelization of open-loop and closed-loop architectures.
  • Support for SDF models and, upon conversion with sdformat, URDF models.
  • Visualization based on the passive viewer of Mujoco.

JaxSim as a simulator

  • Wide range of fixed-step explicit Runge-Kutta integrators.
  • Support for variable-step integrators implemented as embedded Runge-Kutta schemes.
  • Improved stability by optionally integrating the base orientation on the $\text{SO}(3)$ manifold.
  • Soft contacts model supporting full friction cone and sticking-slipping transition.
  • Collision detection between points rigidly attached to bodies and uneven ground surfaces.

JaxSim as a multibody dynamics library

  • Provides rigid body dynamics algorithms (RBDAs) like RNEA, ABA, CRBA, and Jacobians.
  • Provides all the quantities included in the Euler-Poincarè formulation of the equations of motion.
  • Supports body-fixed, inertial-fixed, and mixed velocity representations.
  • Exposes all the necessary quantities to develop controllers in centroidal coordinates.

JaxSim for robot learning

  • Being developed with JAX, all the RBDAs support automatic differentiation both in forward and reverse modes.
  • Support for automatically differentiating against kinematics and dynamics parameters.
  • All fixed-step integrators are forward and reverse differentiable.
  • All variable-step integrators are forward differentiable.
  • Ideal for sampling synthetic data for reinforcement learning (RL).
  • Ideal for designing physics-informed neural networks (PINNs) with loss functions requiring model-based quantities.
  • Ideal for combining model-based control with learning-based components.

[!WARNING] This project is still experimental, APIs could change between releases without notice.

[!NOTE] JaxSim currently focuses on locomotion applications. Only contacts between bodies and smooth ground surfaces are supported.

Documentation

The JaxSim API documentation is available at jaxsim.readthedocs.io.

Installation

With conda

You can install the project using conda as follows:

conda install jaxsim -c conda-forge

You can enforce GPU support, if needed, by also specifying "jaxlib = * = *cuda*".

With pip

You can install the project using pypa/pip, preferably in a virtual environment, as follows:

pip install jaxsim

Check setup.cfg for the complete list of optional dependencies. You can obtain a full installation using jaxsim[all].

If you need GPU support, follow the official installation instructions of JAX.

Contributors installation

If you want to contribute to the project, we recommend creating the following jaxsim conda environment first:

conda env create -f environment.yml

Then, activate the environment and install the project in editable mode:

conda activate jaxsim
pip install --no-deps -e .

Credits

The RBDAs are based on the theory of the Rigid Body Dynamics Algorithms book by Roy Featherstone. The algorithms and some simulation features were inspired by its accompanying code.

The development of JaxSim started in late 2021, inspired by early versions of google/brax. At that time, Brax was implemented in maximal coordinates, and we wanted a physics engine in reduced coordinates. We are grateful to the Brax team for their work and showing the potential of JAX in this field.

Brax v2 was later implemented reduced coordinates, following an approach comparable to JaxSim. The development then shifted to MJX, which today provides a JAX-based implementation of the Mujoco APIs.

The main differences between MJX/Brax and JaxSim are as follows:

  • JaxSim supports out-of-the-box all SDF models with Pose Frame Semantics.
  • JaxSim only supports collisions between points rigidly attached to bodies and a compliant ground surface. Our contact model requires careful tuning of its spring-damper parameters, but being an instantaneous
    function of the state $(\mathbf{q}, \boldsymbol{\nu})$, it doesn't require running any optimization algorithm when stepping the simulation forward.
  • JaxSim mitigates the stiffness of the contact-aware system dynamics by providing variable-step integrators.

Contributing

We welcome contributions from the community. Please read the contributing guide to get started.

Citing

@software{ferigo_jaxsim_2022,
  author = {Diego Ferigo and Filippo Luca Ferretti and Silvio Traversaro and Daniele Pucci},
  title = {{JaxSim}: A Differentiable Physics Engine and Multibody Dynamics Library for Control and Robot Learning},
  url = {http://github.com/ami-iit/jaxsim},
  year = {2022},
}

People

Author Maintainers

License

BSD3

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jaxsim-0.2.dev425.tar.gz (183.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jaxsim-0.2.dev425-py3-none-any.whl (119.0 kB view details)

Uploaded Python 3

File details

Details for the file jaxsim-0.2.dev425.tar.gz.

File metadata

  • Download URL: jaxsim-0.2.dev425.tar.gz
  • Upload date:
  • Size: 183.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for jaxsim-0.2.dev425.tar.gz
Algorithm Hash digest
SHA256 191fd26a19c4fa5a597ed07138d01886e579c81fc7d9a2a78c2f82a71d015627
MD5 1e8d6a93d7d8831dbb5717e3024d5b17
BLAKE2b-256 29ab29fe7e648b3dbb6c291dd698bf6b94ad0aa4cf6280dbff6c1f55519db317

See more details on using hashes here.

File details

Details for the file jaxsim-0.2.dev425-py3-none-any.whl.

File metadata

  • Download URL: jaxsim-0.2.dev425-py3-none-any.whl
  • Upload date:
  • Size: 119.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for jaxsim-0.2.dev425-py3-none-any.whl
Algorithm Hash digest
SHA256 1bff320c5543032407041452048679e52baafe9dd40c692f15b720b83638faf9
MD5 592fbd3587a6f95836294299d162eeff
BLAKE2b-256 a76967faac95632d3b5eda0be17b422a966fee96e4b3048a3a589b4c8f344c25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page