Skip to main content

An inverse kinematics library aiming performance and modularity

Project description

IKPy

PyPI

DOI

demo

IKPy on the baxter robot

Demo

Live demos of what IKPy can do (click on the image below to see the video):

Also, a presentation of IKPy: Presentation.

Features

With IKPy, you can:

  • Compute the Inverse Kinematics of every existing robot.
  • Compute the Inverse Kinematics in position, orientation, or both
  • Define your kinematic chain using arbitrary representations: DH (Denavit–Hartenberg), URDF, custom...
  • Automatically import a kinematic chain from a URDF file or a MuJoCo MJCF file.
  • Support for arbitrary joint types: revolute, prismatic and more to come in the future
  • Use pre-configured robots, such as baxter or the poppy-torso
  • IKPy is precise (up to 7 digits): the only limitation being your underlying model's precision, and fast: from 7 ms to 50 ms (depending on your precision) for a complete IK computation.
  • Plot your kinematic chain: no need to use a real robot (or a simulator) to test your algorithms!
  • Define your own Inverse Kinematics methods.
  • Utils to parse and analyze URDF files:

Moreover, IKPy is a pure-Python library: the install is a matter of seconds, and no compiling is required.

JAX Backend (Experimental)

IKPy now includes an optional JAX backend for accelerated inverse kinematics using automatic differentiation.

Benefits

Scenario Speedup vs NumPy
Single target (complex chains) 1.5-4x faster
Trajectory tracking (warm start) 2-3x faster
Cold start More robust (fewer local minima)

The JAX backend uses an analytical Jacobian computed via autodiff, which provides:

  • Faster convergence on difficult targets
  • Better robustness against local minima
  • Significant speedup on robots with 5+ joints

Installation

pip install 'ikpy[jax]'

Usage

from ikpy.chain import Chain

# Load your robot
chain = Chain.from_urdf_file("my_robot.urdf")

# Use JAX backend for IK
result = chain.inverse_kinematics(
    target_position=[0.5, 0.2, 0.3],
    backend="jax"  # Use JAX instead of NumPy
)

# Trajectory tracking with warm start (recommended)
current_joints = None
for target in trajectory:
    result = chain.inverse_kinematics(
        target_position=target,
        initial_position=current_joints,
        backend="jax"
    )
    current_joints = result  # Use solution as next initial guess

Configuration

The JAX backend uses scipy.optimize.least_squares with an analytical Jacobian. You can configure it:

chain.inverse_kinematics(
    target_position=target,
    backend="jax",
    # Scipy options
    scipy_method='trf',      # 'trf', 'dogbox', or 'lm'
    scipy_x_scale='jac',     # Auto-scaling (default, recommended)
    use_analytical_jacobian=True,  # Set False for finite differences
)

When to use JAX vs NumPy

Use Case Recommended Backend
Simple chains (≤4 joints), easy targets NumPy
Complex chains (≥5 joints) JAX
Trajectory tracking JAX
Real-time control JAX (after warmup)
One-off calculations NumPy (no compilation overhead)

Note: The first JAX call includes JIT compilation overhead (~1-5s). Subsequent calls are fast.

MuJoCo (MJCF) Support

In addition to URDF, IKPy can import kinematic chains directly from MuJoCo MJCF XML files:

from ikpy.chain import Chain

chain = Chain.from_mjcf_file("ur5e.xml", base_elements=["base"])

The parser supports MuJoCo compiler settings, default classes (including childclass inheritance), and provides helpers to inspect models (ikpy.mjcf.get_body_names, ikpy.mjcf.get_joint_names).

Installation

You have three options:

  1. From PyPI (recommended) - simply run:

    pip install ikpy
    

    If you intend to plot your robot, you can install the plotting dependencies (mainly matplotlib):

    pip install 'ikpy[plot]'
    

    If you want to use the JAX backend, install the JAX dependencies:

    pip install 'ikpy[jax]'
    
  2. From source - first download and extract the archive, then run:

    pip install ./
    

    NB: You must have the proper rights to execute this command

Quickstart

Follow this IPython notebook.

Guides and Tutorials

Go to the wiki. It should introduce you to the basic concepts of IKPy.

API Documentation

An extensive documentation of the API can be found here.

Dependencies and compatibility

Starting with IKPy v4, Python 3.10 or above is required. Starting with IKPy v3.1, only Python 3 is supported. For versions before v3.1, the library can work with both versions of Python (2.7 and 3.x).

In terms of dependencies, it requires numpy and scipy.

sympy is highly recommended, for fast hybrid computations, that's why it is installed by default.

matplotlib is optional: it is used to plot your models (in 3D).

Contributing

IKPy is designed to be easily customisable: you can add your own IK methods or robot representations (such as DH-Parameters) using a dedicated developer API.

Contributions are welcome: if you have an awesome patented (but also open-source!) IK method, don't hesitate to propose adding it to the library!

Links

  • If performance is your main concern, aversive++ has an inverse kinematics module written in C++, which works the same way IKPy does.

Citation

If you use IKPy as part of a publication, please use the Bibtex below as a citation:

@software{Manceron_IKPy,
author = {Manceron, Pierre},
doi = {10.5281/zenodo.6551105},
license = {Apache-2.0},
title = {{IKPy}},
url = {https://github.com/Phylliade/ikpy}
}

Project details


Download files

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

Source Distribution

ikpy-4.0.0.tar.gz (47.4 kB view details)

Uploaded Source

Built Distribution

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

ikpy-4.0.0-py3-none-any.whl (40.9 kB view details)

Uploaded Python 3

File details

Details for the file ikpy-4.0.0.tar.gz.

File metadata

  • Download URL: ikpy-4.0.0.tar.gz
  • Upload date:
  • Size: 47.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ikpy-4.0.0.tar.gz
Algorithm Hash digest
SHA256 240942264fea9a881cc31db89813a6532fb11c3bce21042291085f06ef800f15
MD5 42151358e1970478a3492da2435f7bb8
BLAKE2b-256 3b410669d4b911b14fb86fe41b0530355f0762317ead5946ae051e6bcb813ffc

See more details on using hashes here.

Provenance

The following attestation bundles were made for ikpy-4.0.0.tar.gz:

Publisher: ci.yml on Phylliade/ikpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ikpy-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: ikpy-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 40.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ikpy-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e2b5b0f479bfbb27210c728c2d29a7462ae3424a53cb1c1ce4be6cbf4ed415c
MD5 72900729f2c1a5237ff146706036ff04
BLAKE2b-256 a0e966d22da773397f31922a76d54aa788f6b4f99efd4e08a0d2c2b636f59cfe

See more details on using hashes here.

Provenance

The following attestation bundles were made for ikpy-4.0.0-py3-none-any.whl:

Publisher: ci.yml on Phylliade/ikpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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