Skip to content

Jepson2k/pinokin

Repository files navigation

pinokin

The core IK math from robotics-toolbox-python combined with Pinocchio FK, Jacobian, and SO3/SE3 math. C++ backend with nanobind Python bindings.

Maintains execution speed and zero allocation with lower import time (~ms vs ~1s for RTB) and a reduced dependency set.

Install

pip install pinokin

Pre-built wheels are available on GitHub Releases.

Usage

from pinokin import Robot, IKSolver
import numpy as np

robot = Robot("path/to/robot.urdf")
q = np.zeros(robot.nq)

# Forward kinematics
T = robot.fkine(q)  # 4x4 homogeneous transform

# World-frame Jacobian
J = robot.jacob0(q)  # 6 x nq, [linear; angular]

# Joint limits (2 x nq)
qlim = robot.qlim  # row 0: lower, row 1: upper

# Inverse kinematics
solver = IKSolver(robot)
solver.solve(T, q0=q)
print(solver.q, solver.success)

Zero-allocation variants for hot loops

# Eigen uses column-major (Fortran) order — output buffers must match
T_buf = np.empty((4, 4), dtype=np.float64, order="F")
J_buf = np.empty((6, robot.nq), dtype=np.float64, order="F")

robot.fkine_into(q, T_buf)
robot.jacob0_into(q, J_buf)

Build from source

Requires conda for the Pinocchio dependency:

conda env create -f environment.yml
conda activate pinokin
pip install -e ".[dev]" --no-build-isolation
pytest tests/ -v

Building a standalone wheel

To build a wheel that bundles all dependencies (works without conda):

conda activate pinokin

# Build raw wheel
pip wheel . --no-build-isolation --no-deps --wheel-dir raw-dist/

# Repair wheel to bundle shared libs (Linux)
pip install auditwheel patchelf
mkdir -p dist
LD_LIBRARY_PATH="$CONDA_PREFIX/lib" auditwheel repair -w dist/ --plat manylinux_2_41_aarch64 raw-dist/*.whl

# Install in another environment
pip install dist/pinokin-*.whl --force-reinstall

See CLAUDE.md for macOS/Windows commands.

Acknowledgments

  • IK algorithms (Gauss-Newton, Newton-Raphson, Levenberg-Marquardt with Chan/Wampler/Sugihara damping, angle_axis error) ported from robotics-toolbox-python by Peter Corke et al., MIT license.
  • FK, Jacobians, and URDF parsing powered by Pinocchio, BSD-2 license.
  • Python bindings via nanobind by Wenzel Jakob, BSD-3 license.

About

FK, Jacobians, and IK for URDF robots — Pinocchio C++ backend with nanobind Python bindings

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages