pin-pink
Python inverse kinematics using Pinocchio and QP solvers
Science Score: 44.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (12.7%) to scientific vocabulary
Keywords
Repository
Python inverse kinematics using Pinocchio and QP solvers
Basic Info
Statistics
- Stars: 538
- Watchers: 4
- Forks: 34
- Open Issues: 3
- Releases: 20
Topics
Metadata Files
README.md
Pink
Python inverse kinematics for articulated robot models, based on Pinocchio.

Installation
For best performance we recommended installing Pink from Conda:
console
conda install -c conda-forge pink
You can also install it from PyPI:
console
pip install pin-pink
Usage
Pink solves differential inverse kinematics by weighted tasks. A task is defined by a residual function $e(q)$ of the robot configuration $q \in \mathcal{C}$ to be driven to zero. For instance, putting a foot position $p{foot}(q)$ at a given target $p{foot}^{\star}$ can be described by the position residual:
$$ e(q) = p{foot}^{\star} - p{foot}(q) $$
In differential inverse kinematics, we compute a velocity $v \in \mathfrak{c}$ that satisfies the first-order differential equation:
$$ J_e(q) v = \dot{e}(q) = -\alpha e(q) $$
where $J_e(q) := \frac{\partial e}{\partial q}$ is the task Jacobian. We can define multiple tasks, but some of them will come into conflict if they can't be all fully achieved at the same time. Conflicts are resolved by casting all objectives to a common unit, and weighing these normalized objectives relative to each other. We also include configuration and velocity limits, making our overall optimization problem a quadratic program:
$$ \begin{align} \underset{v \in \mathfrak{c}}{\text{minimize}} \ & \sum{\text{task } e} \Vert Je(q) v + \alpha e(q) \Vert^2{We} \ \text{subject to} \ & v{\text{min}}(q) \leq v \leq v{\text{max}}(q) \end{align} $$
Pink provides an API to describe the problem as tasks with targets, and automatically build and solve the underlying quadratic program.
Task costs
Here is the example of a biped robot that controls the position and orientation of its base, left and right contact frames. A fourth "posture" task, giving a preferred angle for each joint, is added for regularization:
```python from pink.tasks import FrameTask, PostureTask
tasks = { "base": FrameTask( "base", positioncost=1.0, # [cost] / [m] orientationcost=1.0, # [cost] / [rad] ), "leftcontact": FrameTask( "leftcontact", positioncost=[0.1, 0.0, 0.1], # [cost] / [m] orientationcost=0.0, # [cost] / [rad] ), "rightcontact": FrameTask( "rightcontact", positioncost=[0.1, 0.0, 0.1], # [cost] / [m] orientationcost=0.0, # [cost] / [rad] ), "posture": PostureTask( cost=1e-3, # [cost] / [rad] ), } ```
Orientation (similarly position) costs can be scalars or 3D vectors. They specify how much each radian of angular error "costs" in the overall normalized objective. When using 3D vectors, components are weighted anisotropically along each axis of the body frame.
Task targets
Aside from their costs, most tasks take a second set of parameters called target. For example, a frame task aims for a target transform, while a posture task aims for a target configuration vector. Targets are set by the set_target function:
python
tasks["posture"].set_target(
[1.0, 0.0, 0.0, 0.0] + # floating base quaternion
[0.0, 0.0, 0.0] + # floating base position
[0.0, 0.2, 0.0, 0.0, -0.2, 0.0] # joint angles
)
Body tasks can be initialized, for example, from the robot's neutral configuration:
```python import pink from robotdescriptions.loaders.pinocchio import loadrobot_description
robot = loadrobotdescription("upkiedescription") configuration = pink.Configuration(robot.model, robot.data, robot.q0) for body, task in tasks.items(): if type(task) is FrameTask: task.settarget(configuration.gettransformframetoworld(body)) ```
A task can be added to the inverse kinematics once both its cost and target (if applicable) are defined.
Differential inverse kinematics
Pink solves differential inverse kinematics, meaning it outputs a velocity that steers the robot towards achieving all tasks at best. If we keep integrating that velocity, and task targets don't change over time, we will converge to a stationary configuration:
python
dt = 6e-3 # [s]
for t in np.arange(0.0, 42.0, dt):
velocity = solve_ik(configuration, tasks.values(), dt, solver="quadprog")
configuration.integrate_inplace(velocity, dt)
time.sleep(dt)
If task targets are continuously updated, there will be no stationary solution to converge to, but the model will keep on tracking each target at best. Note that solve_ik will take care of both configuration and velocity limits read from the robot model.
Examples
Illustrated examples showcase how Pink performs on various robot morphologies:
- Arm: UR5 and UR5 with end-effector limits
- Dual arms: Flying dual-arm UR3
- Dual arms: Yumi with spherical self-collision avoidance
- Dual arms: Iiwa with whole-body self-collision avoidance
- Humanoid: Draco 3
- Mobile base: Stretch R1
- Quadruped: Go2 squatting with floating-base limits
- Wheeled biped: Upkie rolling without slipping
There are also more basic examples to get started:
Check out the examples directory for more.
Frequently Asked Questions
- Can I solve global inverse kinematics?
- Can I make velocities smoother?
- My configuration gets stuck somewhere and does not solve the task, what is going on?
Global inverse kinematics
Pink implements differential inverse kinematics, a first-order algorithm that converges to the closest optimum of its cost function. It is a local method that does not solve the more difficult problem of global inverse kinematics. That is, it may converge to a global optimum, or to a local one stuck to some configuration limits. This behavior is illustrated in the simple pendulum with configuration limit example.
How can I help?
Install the library and use it! Report bugs in the issue tracker. If you are a developer with some robotics experience looking to hack on open source, check out the contribution guidelines.
Citation
If you use Pink in your scientific works, please cite it e.g. as follows:
bibtex
@software{pink,
title = {{Pink: Python inverse kinematics based on Pinocchio}},
author = {Caron, Stéphane and De Mont-Marin, Yann and Budhiraja, Rohan and Bang, Seung Hyeon and Domrachev, Ivan and Nedelchev, Simeon, and @peterd-NV and Vaillant, Joris},
license = {Apache-2.0},
url = {https://github.com/stephane-caron/pink},
version = {3.4.0},
year = {2025}
}
Don't forget to add yourself to the BibTeX above and to CITATION.cff if you contribute to this repository.
See also
Software:
- mink: differential inverse kinematics in Python, based on the MuJoCo physics engine.
- Jink.jl: Julia package for differential multi-task inverse kinematics.
- PlaCo: C++ inverse kinematics based on Pinocchio.
- pymanoid: precursor to Pink based on OpenRAVE.
- TSID: C++ inverse kinematics based on Pinocchio.
Technical notes:
- Inverse kinematics: a general introduction to differential inverse kinematics.
- Jacobian of a kinematic task and derivatives on manifolds.
- Control Barrier Functions.
Owner
- Name: Stéphane Caron
- Login: stephane-caron
- Kind: user
- Location: Paris
- Company: Inria
- Website: https://scaron.info
- Repositories: 77
- Profile: https://github.com/stephane-caron
Likes open source robots.
Citation (CITATION.cff)
cff-version: 1.2.0 message: "If you find this code helpful, please cite it as below." title: "Pink: Python inverse kinematics based on Pinocchio" version: 3.4.0 date-released: 2025-04-22 url: "https://github.com/stephane-caron/pink" license: "Apache-2.0" authors: - family-names: "Caron" given-names: "Stéphane" orcid: "https://orcid.org/0000-0003-2906-692X" - family-names: "De Mont-Marin" given-names: "Yann" orcid: "https://orcid.org/0000-0002-5446-595X" - family-names: "Budhiraja" given-names: "Rohan" - family-names: "Bang" given-names: "Seung Hyeon" - family-names: "Domrachev" given-names: "Ivan" - family-names: "Nedelchev" given-names: "Simeon" orcid: "https://orcid.org/0000-0003-1588-8260" - family-names: "@peterd-NV" - family-names: "Vaillant" given-names: "Joris"
GitHub Events
Total
- Create event: 15
- Issues event: 16
- Release event: 4
- Watch event: 228
- Delete event: 13
- Issue comment event: 25
- Push event: 83
- Pull request event: 30
- Fork event: 12
Last Year
- Create event: 15
- Issues event: 16
- Release event: 4
- Watch event: 228
- Delete event: 13
- Issue comment event: 25
- Push event: 83
- Pull request event: 30
- Fork event: 12
Committers
Last synced: 11 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Stéphane Caron | s****n@n****g | 871 |
| Ivan Domrachev | d****3@m****u | 171 |
| simeon | s****d@g****m | 37 |
| Yann Mont-Marin | y****n@g****m | 29 |
| Rohan Budhiraja | 1****n | 12 |
| shbang91 | b****8@g****m | 2 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 21
- Total pull requests: 54
- Average time to close issues: 2 months
- Average time to close pull requests: 3 days
- Total issue authors: 14
- Total pull request authors: 6
- Average comments per issue: 1.38
- Average comments per pull request: 1.87
- Merged pull requests: 52
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 11
- Pull requests: 25
- Average time to close issues: 3 days
- Average time to close pull requests: 2 days
- Issue authors: 9
- Pull request authors: 3
- Average comments per issue: 0.73
- Average comments per pull request: 1.16
- Merged pull requests: 24
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- stephane-caron (4)
- dbdxnuliba (4)
- DiomandLEE (3)
- frankchan12138 (1)
- abuibaid (1)
- damounayman (1)
- rima1881 (1)
- 15906185391 (1)
- elevenjiang1 (1)
- ashwinvkNV (1)
- longwoo (1)
- NoePity2 (1)
- huiwenzhang (1)
- ddliu365 (1)
- domrachev03 (1)
Pull Request Authors
- stephane-caron (65)
- domrachev03 (7)
- simeon-ned (2)
- peterd-NV (2)
- ymontmarin (2)
- jorisv (2)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- pypi 41,645 last-month
-
Total dependent packages: 0
(may contain duplicates) -
Total dependent repositories: 1
(may contain duplicates) - Total versions: 24
- Total maintainers: 1
pypi.org: pin-pink
Inverse kinematics for articulated robot models, based on Pinocchio.
- Homepage: https://stephane-caron.github.io/pink/
- Documentation: https://stephane-caron.github.io/pink/
- License: Apache Software License
-
Latest release: 3.4.0
published 7 months ago
Rankings
Maintainers (1)
pypi.org: pink-dm-fork
Inverse kinematics for articulated robot models, based on Pinocchio.
- Homepage: https://stephane-caron.github.io/pink/
- Documentation: https://stephane-caron.github.io/pink/
- License: Apache Software License
-
Latest release: 3.1.2
published 8 months ago
Rankings
Dependencies
- actions/checkout v3 composite
- mamba-org/provision-with-micromamba main composite
- peaceiris/actions-gh-pages v3 composite
- actions/checkout v3 composite
- actions/setup-python v4 composite
- pin-pink *
- sphinx >=7.2.2
- sphinx-autodoc-typehints *
- sphinx-favicon *
- sphinx-mathjax-offline *
- sphinx_rtd_theme *
- loop-rate-limiters >=0.1.0
- numpy >=1.19.0
- pin >=2.6.3
- qpsolvers >=2.5.0
- quadprog >=0.1.11