Skip to main content

Lightweight URDF kinematics (forward kinematics + Jacobian) with Rust speed and Python bindings.

Project description

literobo

Lightweight kinematics utilities for URDF robots, implemented in Rust with Python bindings.

Features

  • Parse URDF files and build a kinematic chain between any two links.
  • Forward kinematics that returns a homogeneous transform.
  • Geometric Jacobian for revolute and prismatic joints.
  • Python bindings powered by PyO3 and packaged with maturin.

Layout

  • src/chain.rs – core kinematics implementation
  • src/python.rs – PyO3 bindings exposed to Python
  • examples/ – ready-to-run assets (planar.urdf, quickstart.py)

Rust usage

use literobo::KinematicChain;

let chain = KinematicChain::from_urdf_file("robot.urdf", "base_link", "tool_link")?;
let pose = chain.forward_kinematics(&[0.0, 0.5, -1.0])?;
let jacobian = chain.jacobian(&[0.0, 0.5, -1.0])?;
println!("Pose:\n{}", pose.to_homogeneous());
println!("Jacobian:\n{}", jacobian);

Why provide base_link / end_link

  • A URDF describes a tree (or forest), so the loader must know which branch to treat as the active sub-chain.
  • Explicit base_link and end_link let the library search only between those two links and ignore unrelated branches when extracting the shortest path.
  • This also clarifies behavior for floating bases or multi–end-effector robots: callers can choose different start/end pairs from one URDF to construct multiple chains as needed.

Development commands

Rust:

cargo fmt
cargo test

Benchmark output (CI)

The Rust test suite includes lightweight benchmark-style tests that print timing results for forward kinematics and Jacobian computations. In CI, tests run with --nocapture so the benchmark lines appear in the GitHub Actions logs. To see the same output locally, run:

cargo test -- --nocapture

To capture Python benchmark output and compare runs, use the helper script:

uv run python benchmarks/python_benchmark.py --output benchmarks/python_baseline.txt
uv run python benchmarks/python_benchmark.py --output benchmarks/python_latest.txt --compare benchmarks/python_baseline.txt

Python (using uv):

uv venv
source .venv/bin/activate
uv run pip install maturin  # build backend
uv run pip install .        # build + install the wheel
uv run python examples/quickstart.py

Python usage

The project is configured for uv so you can manage dependencies and builds without a virtualenv toolchain mismatch.

# Create an isolated environment
uv venv
source .venv/bin/activate

# Install build dependency and compile the wheel
uv run pip install maturin
uv run pip install .
import numpy as np
import literobo

robot = literobo.from_urdf_file("robot.urdf", "base_link", "tool_link")
q = np.array([0.0, 0.5, -1.0])
pose = robot.forward_kinematics(q)
jacobian = robot.jacobian(q)

print("Pose:\n", pose)
print("Jacobian:\n", jacobian)

To publish, run uv build (which delegates to maturin under the hood) and upload the wheel to PyPI with uv publish.

Quick sample run (Python)

Below is a minimal end-to-end example you can run locally:

# 1. Prepare environment (inside repo root)
uv venv
source .venv/bin/activate
uv run pip install maturin  # build backend

# 2. Build & install the wheel from the checked-out source
uv run pip install .

# 3. Run the bundled sample
uv run python examples/quickstart.py

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

literobo-0.1.7.tar.gz (45.1 kB view details)

Uploaded Source

Built Distribution

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

literobo-0.1.7-cp38-abi3-macosx_11_0_arm64.whl (369.0 kB view details)

Uploaded CPython 3.8+macOS 11.0+ ARM64

File details

Details for the file literobo-0.1.7.tar.gz.

File metadata

  • Download URL: literobo-0.1.7.tar.gz
  • Upload date:
  • Size: 45.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.10.2

File hashes

Hashes for literobo-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b9cf559342e72e628a731062b6adaa9901a7521af670deee69695b3f81b86c32
MD5 70027b961c07fea54989d8191e24a3a1
BLAKE2b-256 f3b180d415908b57100cb8981ea1db7b64db6ce0a89955b3ecdf267bd9eee8e9

See more details on using hashes here.

File details

Details for the file literobo-0.1.7-cp38-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for literobo-0.1.7-cp38-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7151ea9437eaeb9df198e384b873ce06193741a1b7013e01bb4d9b033e0920f2
MD5 c1e6501100cc8e5fe9eeea66f6c185df
BLAKE2b-256 ab530930fe2500e2d663ab36d2164e091b28d0ca64cdfca1512c34db545857dd

See more details on using hashes here.

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