Skip to main content

franka-rs for Python

import franka: drive a Franka FR3 (FCI v10) or Franka Emika Robot / Panda (FCI v5) from a program that runs at its own rate -- a policy at 5 to 30 Hz, a script, a keyboard. The 1 kHz control loop is franka-rs's target control on a Rust thread; the GIL is never on the 1 kHz path. move_to / move_by are one write into that loop's seqlock slot, follow hands a chunk of targets to a Rust timer thread, and state() is a copy out of a mutex.

import franka

robot = franka.Robot("192.168.0.1")   # FRANKA_REALTIME=ignore for franka-sim

with robot.cartesian_targets(max_velocity=0.3, max_acceleration=0.5, max_jerk=20.0) as arm:
    while not done:
        obs = arm.state().flat()      # 1-D float64 in the order of franka.FLAT_LAYOUT
        action = policy(obs)
        arm.move_by(action[:3])       # metres, relative to the current target
        # or: arm.move_to([x, y, z]); arm.follow(chunk, dt=0.02)  # chunk: (N, 3) absolute

robot.joint_targets(fraction=0.2) is the same over the seven joints. __exit__ stops the loop; an exception inside the block still stops the motion and is re-raised. Errors are franka.FrankaError; a motion the robot aborted is a franka.ControlException with the reflex reason. robot.gripper() drives the Franka Hand, releasing the GIL while it waits.

A Cartesian target of 7 elements (move_to, the rows of follow) sets the orientation too, as a unit quaternion x, y, z, w after the position; a move_by of 6 elements appends a rotation vector (axis times angle, rad) composed onto the target orientation in the base frame. arm.target() is that 7-vector, arm.target_pose() the 4x4 matrix. examples/policy_loop.py is a jittery 6-10 Hz loop with a circle, a yaw and tilt sweep and a follow chunk, as run on a Panda; examples/rotate.py is the rotation alone, and examples/quickstart.ipynb a notebook that connects, moves, and replays the motion inline with Franka's meshes. robot.model() is the kinematics and dynamics over numpy (pose, body_jacobian, zero_jacobian, mass, coriolis, gravity, link_poses, hand_pose).

Install

pip install franka-rs

The wheel is named franka-rs, the package franka. To build from the source tree into a virtualenv instead (prefix with env -u CONDA_PREFIX under an active conda env):

pip install maturin
maturin develop --release -m crates/franka-py/Cargo.toml

The crate is publish = false on crates.io; its tests are

flock .sim.lock env FRANKA_SIM_IMAGE=franka-sim:dev pytest crates/franka-py/tests

against the simulator (see the book's Testing with franka-sim).

Download files

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

Source Distribution

franka_rs-0.2.0.tar.gz (1.3 MB view details)

Uploaded Source

Built Distributions

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

franka_rs-0.2.0-cp39-abi3-manylinux_2_34_x86_64.whl (748.6 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.34+ x86-64

franka_rs-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (693.5 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

File details

Details for the file franka_rs-0.2.0.tar.gz.

File metadata

  • Download URL: franka_rs-0.2.0.tar.gz
  • Upload date:
  • Size: 1.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for franka_rs-0.2.0.tar.gz
Algorithm Hash digest
SHA256 98deec42858e390de99a3b424f0c7034259b403f9e0da73de1e1f5fd91e464f9
MD5 508f11c1e2b685e3928cc797a7d874e3
BLAKE2b-256 e33996b68273bf0f17f2ab0738a0e611630e206f34bc270d9695fdf1ad5910c3

See more details on using hashes here.

Provenance

The following attestation bundles were made for franka_rs-0.2.0.tar.gz:

Publisher: release.yml on BarisYazici/franka-rs

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

File details

Details for the file franka_rs-0.2.0-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for franka_rs-0.2.0-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d72951eca4fdbf01980caaaebad0ef318162d09a291be40d31a3a17621ebba87
MD5 8be0b0f24678856dc957bb2f7fa3ddaf
BLAKE2b-256 42899a3f8e9f4c5d911becdfbb22f45d7b5edd9cfc9cb36803c00fe87de3ae1c

See more details on using hashes here.

Provenance

The following attestation bundles were made for franka_rs-0.2.0-cp39-abi3-manylinux_2_34_x86_64.whl:

Publisher: release.yml on BarisYazici/franka-rs

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

File details

Details for the file franka_rs-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for franka_rs-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 928ab2ffda0b9e4c7b0ada6a45d14728760c8d7baaff94355afc6a121b432a53
MD5 563d6f426542843ea9250d17b9724181
BLAKE2b-256 7896a1060a4e9c8b074769a18be29f188ac337702e2e217dd17fea474389be6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for franka_rs-0.2.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: release.yml on BarisYazici/franka-rs

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

Release history Release notifications | RSS feed

0.3.0

3 files

This release

0.2.0 This release

3 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page