pycapacity: task-space capacity of robots and humans
pycapacity computes the physical capacity of robots and humans in the task space: the forces, velocities and accelerations they can produce, and the space they can reach, as polytopes and ellipsoids. Its algorithms bring most of these metrics to a few milliseconds, fast enough for online and interactive use. It takes plain matrices (Jacobians, mass matrices, limits), so it works with any robotics or biomechanics library: pinocchio, robotics-toolbox, mujoco, biorbd, opensim, ROS.
Documentation: https://auctus-team.github.io/pycapacity
📢 v3.0 is out - changelog
- Polytope operations:
P1 + P2,P1 & P2,A @ P,P + x,a * P,P.contains(x),P.volume(),P.reduce()- Exact conversions between the vertex and half-space representations, including flat (lower dimensional) polytopes
- Optional C++ acceleration
pycapacity-cpp: the same functions 6 to 50 times faster- Bug fixes in the HPSM (rank deficient Jacobians) and the ICHM (missed facets in some symmetric problems)
Installation
pip install pycapacity
Optional extras: pip install pycapacity[fast] for the C++ acceleration (pre-built for Linux, macOS and Windows, used automatically), pip install pycapacity[cvxopt] for faster small linear programs. See the installation docs.
Quick start
import numpy as np
from pycapacity.robot import force_polytope, velocity_polytope
J = np.random.rand(3, 7) # Jacobian of a 7-joint robot (position part)
t_max = 10 * np.ones(7) # joint torque limits [Nm]
dq_max = np.ones(7) # joint velocity limits [rad/s]
f_poly = force_polytope(J, t_max, -t_max) # forces the robot can apply
v_poly = velocity_polytope(J, dq_max, -dq_max) # velocities it can reach
print(f_poly) # a Polytope: vertices, half-spaces, faces
print(f_poly.contains([0, 0, 5])) # can it push 5 N along z?
print(v_poly.volume())
two_arms = f_poly + force_polytope(np.random.rand(3, 7), t_max, -t_max) # Minkowski sum
Polytopes can be combined (+, &, @, *), tested (contains) and measured (volume): see working with polytopes.
Capacity metrics
| Metric | Robot (pycapacity.robot) |
Human (pycapacity.human) |
Algorithm |
|---|---|---|---|
| Velocity, acceleration, force ellipsoids | *_ellipsoid |
*_ellipsoid |
SVD |
| Velocity polytope | velocity_polytope |
velocity_polytope |
HPSM / ICHM |
| Acceleration polytope | acceleration_polytope |
acceleration_polytope |
HPSM (or ICHM) |
| Force polytope | force_polytope |
force_polytope |
VEPOLI² / ICHM |
| Force polytope sum and intersection | force_polytope_sum, force_polytope_intersection |
- | VEPOLI² |
| Reachable space | reachable_space_approximation (convex), reachable_space_nonlinear (non-convex) |
- | ICHM / sampling |
| Joint torque polytope | - | joint_torques_polytope |
HPSM |
The formulas are in the capacity metrics docs, the algorithms and their timings in the algorithms docs, and a comparison with general methods (Qhull, cdd, Bretl and Lall) in comparison with other methods.
Tutorials
| Library | Tutorial |
|---|---|
| pinocchio | Tutorial |
| Robotics toolbox | Tutorial |
| MuJoCo | Tutorial |
| Robot Operating System (ROS) | Tutorial |
| pyomeca biorbd | Tutorial |
| OpenSim | Tutorial |
More in the tutorials and in the examples folder (scripts and notebooks).
Upgrading from v2
The functions keep their names, arguments and return types. What can change in the results:
- the half-space representations
H,dcomputed from vertices have one row per facet (v2 gave one row per triangle of the facet);face_indicesare still triangles for plotting - the Minkowski sum returns only the vertices of the sum (v2 could also return points on its boundary)
- the polytopes themselves are the same, except where v2 was wrong (rank deficient Jacobians in the HPSM, some symmetric problems in the ICHM)
Contributing
Questions, ideas and bug reports are welcome as issues or discussions. If you are not familiar with GitHub, just start a discussion and we will help.
Citing pycapacity
A short resume paper about pycapacity has been published in the Journal of Open Source Software:
pycapacity: a real-time task-space capacity calculation package for robotics and biomechanics
A. Skuric, V. Padois and D. Daney
Journal of Open Source Software, 8(89), 5670, https://doi.org/10.21105/joss.05670
If you are interested in citing pycapacity in your research, we suggest you to cite our paper:
@article{Skuric2023pycapacity,
author = {Skuric, Antun and Padois, Vincent and Daney, David},
doi = {10.21105/joss.05670},
journal = {Journal of Open Source Software},
month = sep,
number = {89},
pages = {5670},
title = {{Pycapacity: a real-time task-space capacity calculation package for robotics and biomechanics}},
url = {https://joss.theoj.org/papers/10.21105/joss.05670},
volume = {8},
year = {2023}
}
AI statement
Parts of pycapacity v3.0 were developed with the help of the AI assistant Claude (Anthropic):
mainly the extension of the compiled cpp backend pycapacity-cpp, some new polytope operations and conversions (*,@,+), and some optimisations of the existing algorithms. All the changes are tested against the existing Python implementation and the reference methods (cdd, pypoman).
Metadata
Release files for pycapacity 3.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pycapacity-3.0.0.tar.gz | 53.9 kB | With provenance | Details for pycapacity-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pycapacity-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for pycapacity-3.0.0-py3-none-any.whl |
Total release size: 99.0 kB
Release files / pycapacity-3.0.0.tar.gz
| Download URL | pycapacity-3.0.0.tar.gz |
|---|---|
| Size | 53.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1806d1c0a42ec49c9a849366c99b92825f1fe0c36b9e1c71bba69efd33adf3e5
|
|
BLAKE2b-256 checksum How to use checksums |
25bb664ee780333b0018880233794d8ab5411c912bf8fbf2d976b7f54b2c243f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logRelease files / pycapacity-3.0.0-py3-none-any.whl
| Download URL | pycapacity-3.0.0-py3-none-any.whl |
|---|---|
| Size | 45.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a711adf5fed2370c6ec6ed217939c8081d01fe399de881fec8cd92e1ee461bc4
|
|
BLAKE2b-256 checksum How to use checksums |
6477096b640fb5a3cc7dc4bcd92949f5b4f18e613927b08d7a765748cd087e2d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logSecurity for pycapacity 3.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pycapacity-3.0.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.