All Projects → ami-iit → ADAM

ami-iit / ADAM

Licence: LGPL-2.1 license
ADAM implements a collection of algorithms for calculating rigid-body dynamics in Jax, CasADi, PyTorch, and Numpy.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to ADAM

bayex
Bayesian Optimization in JAX
Stars: ✭ 24 (-52.94%)
Mutual labels:  automatic-differentiation, jax
Robotics-Object-Pose-Estimation
A complete end-to-end demonstration in which we collect training data in Unity and use that data to train a deep neural network to predict the pose of a cube. This model is then deployed in a simulated robotic pick-and-place task.
Stars: ✭ 153 (+200%)
Mutual labels:  motion-planning, urdf
omd
JAX code for the paper "Control-Oriented Model-Based Reinforcement Learning with Implicit Differentiation"
Stars: ✭ 43 (-15.69%)
Mutual labels:  automatic-differentiation, jax
Pinocchio
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
Stars: ✭ 432 (+747.06%)
Mutual labels:  automatic-differentiation, motion-planning
graphsignal
Graphsignal Python agent
Stars: ✭ 158 (+209.8%)
Mutual labels:  jax
Qml
Introductions to key concepts in quantum machine learning, as well as tutorials and implementations from cutting-edge QML research.
Stars: ✭ 174 (+241.18%)
Mutual labels:  automatic-differentiation
Galacticoptim.jl
Local, global, and beyond optimization for scientific machine learning (SciML)
Stars: ✭ 155 (+203.92%)
Mutual labels:  automatic-differentiation
Taylorseries.jl
A julia package for Taylor polynomial expansions in one and several independent variables.
Stars: ✭ 151 (+196.08%)
Mutual labels:  automatic-differentiation
Virtual-Lane-Boundary-Generation
Virtual Lane Boundary Generation for Human-Compatible Autonomous Driving
Stars: ✭ 22 (-56.86%)
Mutual labels:  motion-planning
lqRRT
Kinodynamic RRT implementation
Stars: ✭ 76 (+49.02%)
Mutual labels:  motion-planning
MASA
Method of Manufactured Solutions Repository
Stars: ✭ 46 (-9.8%)
Mutual labels:  automatic-differentiation
Mitgcm
M.I.T General Circulation Model master code and documentation repository
Stars: ✭ 177 (+247.06%)
Mutual labels:  automatic-differentiation
dwl
The Dynamic Whole-body Locomotion library (DWL)
Stars: ✭ 70 (+37.25%)
Mutual labels:  motion-planning
Chainrules.jl
forward and reverse mode automatic differentiation primitives for Julia Base + StdLibs
Stars: ✭ 162 (+217.65%)
Mutual labels:  automatic-differentiation
Tullio.jl
Stars: ✭ 231 (+352.94%)
Mutual labels:  automatic-differentiation
Backprop
Heterogeneous automatic differentiation ("backpropagation") in Haskell
Stars: ✭ 154 (+201.96%)
Mutual labels:  automatic-differentiation
admc
Infinite order automatic differentiation for Monte Carlo with unnormalized probability distribution
Stars: ✭ 17 (-66.67%)
Mutual labels:  automatic-differentiation
Aerosandbox
Aircraft design optimization made fast through modern automatic differentiation. Plug-and-play analysis tools for aerodynamics, propulsion, structures, trajectory design, and much, much more.
Stars: ✭ 193 (+278.43%)
Mutual labels:  automatic-differentiation
Tangent
Source-to-Source Debuggable Derivatives in Pure Python
Stars: ✭ 2,209 (+4231.37%)
Mutual labels:  automatic-differentiation
gennav
Python Package for Robot Navigation
Stars: ✭ 24 (-52.94%)
Mutual labels:  motion-planning

ADAM

Adam

Automatic Differentiation for rigid-body-dynamics AlgorithMs

ADAM implements a collection of algorithms for calculating rigid-body dynamics for floating-base robots, in mixed representation (see Traversaro's A Unified View of the Equations of Motion used for Control Design of Humanoid Robots) using:

ADAM employs the automatic differentiation capabilities of these frameworks to compute, if needed, gradients, Jacobian, Hessians of rigid-body dynamics quantities. This approach enables the design of optimal control and reinforcement learning strategies in robotics.

ADAM is based on Roy Featherstone's Rigid Body Dynamics Algorithms.


⚠️ REPOSITORY UNDER DEVELOPMENT ⚠️
We cannot guarantee stable API


🐍 Dependencies

Other requisites are:

  • urdf_parser_py
  • jax
  • casadi
  • pytorch
  • numpy

They will be installed in the installation step!

💾 Installation

The installation can be done either using the Python provided by apt (on Debian-based distros) or via conda (on Linux and macOS).

Installation with pip

Install python3, if not installed (in Ubuntu 20.04):

sudo apt install python3.8

Create a virtual environment, if you prefer. For example:

pip install virtualenv
python3 -m venv your_virtual_env
source your_virtual_env/bin/activate

Inside the virtual environment, install the library from pip:

  • Install Jax interface:

    pip install adam-robotics[jax]
  • Install CasADi interface:

    pip install adam-robotics[casadi]
  • Install PyTorch interface:

    pip install adam-robotics[pytorch]
  • Install ALL interfaces:

    pip install adam-robotics[all]

If you want the last version:

pip install adam-robotics[selected-interface]@git+https://github.com/ami-iit/ADAM

or clone the repo and install:

git clone https://github.com/ami-iit/ADAM.git
cd ADAM
pip install .[selected-interface]

Installation with conda

Install in a conda environment the required dependencies:

  • Jax interface dependencies:

    mamba create -n adamenv -c conda-forge -c robostack jax numpy lxml prettytable matplotlib ros-noetic-urdfdom-py
  • CasADi interface dependencies:

    mamba create -n adamenv -c conda-forge -c robostack casadi numpy lxml prettytable matplotlib ros-noetic-urdfdom-py
  • PyTorch interface dependencies:

    mamba create -n adamenv -c conda-forge -c robostack pytorch numpy lxml prettytable matplotlib ros-noetic-urdfdom-py
  • ALL interfaces dependencies:

    mamba create -n adamenv -c conda-forge -c robostack jax casadi pytorch numpy lxml prettytable matplotlib ros-noetic-urdfdom-py

Activate the environment, clone the repo and install the library:

mamba activate adamenv
git clone https://github.com/dic-iit/ADAM.git
cd ADAM
pip install --no-deps .

🚀 Usage

The following are small snippets of the use of ADAM. More examples are arriving! Have also a look at te tests folder.

Jax interface

from adam.jax import KinDynComputations
import icub_models
import numpy as np

# if you want to icub-models https://github.com/robotology/icub-models to retrieve the urdf
model_path = icub_models.get_model_file("iCubGazeboV2_5")
# The joint list
joints_name_list = [
    'torso_pitch', 'torso_roll', 'torso_yaw', 'l_shoulder_pitch',
    'l_shoulder_roll', 'l_shoulder_yaw', 'l_elbow', 'r_shoulder_pitch',
    'r_shoulder_roll', 'r_shoulder_yaw', 'r_elbow', 'l_hip_pitch', 'l_hip_roll',
    'l_hip_yaw', 'l_knee', 'l_ankle_pitch', 'l_ankle_roll', 'r_hip_pitch',
    'r_hip_roll', 'r_hip_yaw', 'r_knee', 'r_ankle_pitch', 'r_ankle_roll'
]
# Specify the root link
root_link = 'root_link'
kinDyn = KinDynComputations(model_path, joints_name_list, root_link)
w_H_b = np.eye(4)
joints = np.ones(len(joints_name_list))
M = kinDyn.mass_matrix(w_H_b, joints)
print(M)

CasADi interface

from adam.casadi import KinDynComputations
import icub_models
import numpy as np

# if you want to icub-models https://github.com/robotology/icub-models to retrieve the urdf
model_path = icub_models.get_model_file("iCubGazeboV2_5")
# The joint list
joints_name_list = [
    'torso_pitch', 'torso_roll', 'torso_yaw', 'l_shoulder_pitch',
    'l_shoulder_roll', 'l_shoulder_yaw', 'l_elbow', 'r_shoulder_pitch',
    'r_shoulder_roll', 'r_shoulder_yaw', 'r_elbow', 'l_hip_pitch', 'l_hip_roll',
    'l_hip_yaw', 'l_knee', 'l_ankle_pitch', 'l_ankle_roll', 'r_hip_pitch',
    'r_hip_roll', 'r_hip_yaw', 'r_knee', 'r_ankle_pitch', 'r_ankle_roll'
]
# Specify the root link
root_link = 'root_link'
kinDyn = KinDynComputations(model_path, joints_name_list, root_link)
w_H_b = np.eye(4)
joints = np.ones(len(joints_name_list))
M = kinDyn.mass_matrix_fun()
print(M(w_H_b, joints))

PyTorch interface

from adam.pytorch import KinDynComputations
import icub_models
import numpy as np

# if you want to icub-models https://github.com/robotology/icub-models to retrieve the urdf
model_path = icub_models.get_model_file("iCubGazeboV2_5")
# The joint list
joints_name_list = [
    'torso_pitch', 'torso_roll', 'torso_yaw', 'l_shoulder_pitch',
    'l_shoulder_roll', 'l_shoulder_yaw', 'l_elbow', 'r_shoulder_pitch',
    'r_shoulder_roll', 'r_shoulder_yaw', 'r_elbow', 'l_hip_pitch', 'l_hip_roll',
    'l_hip_yaw', 'l_knee', 'l_ankle_pitch', 'l_ankle_roll', 'r_hip_pitch',
    'r_hip_roll', 'r_hip_yaw', 'r_knee', 'r_ankle_pitch', 'r_ankle_roll'
]
# Specify the root link
root_link = 'root_link'
kinDyn = KinDynComputations(model_path, joints_name_list, root_link)
w_H_b = np.eye(4)
joints = np.ones(len(joints_name_list))
M = kinDyn.mass_matrix(w_H_b, joints)
print(M)

🦸‍♂️ Contributing

ADAM is an open-source project. Contributions are very welcome!

Open an issue with your feature request or if you spot a bug. Then, you can also proceed with a Pull-requests! 🚀

Todo

  • Center of Mass position
  • Jacobians
  • Forward kinematics
  • Mass Matrix via CRBA
  • Centroidal Momentum Matrix via CRBA
  • Recursive Newton-Euler algorithm (still no acceleration in the algorithm, since it is used only for the computation of the bias force)
  • Articulated Body algorithm
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].