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.

The loop tracks the targets with the crate's own impedance torques by default, so the arm is a spring around the target: push it and it gives way, let go and it returns. cartesian_stiffness=400 softens the default 750 N/m (15 Nm/rad rotational); cartesian_damping, joint_stiffness, joint_damping, torque_limits, posture, leash and project_joint_gains are the other knobs, and backend='robot' has the robot's own controller track the targets instead, as the bindings did in 0.2.0. Target control sets no collision thresholds: with the default gains give robot.set_collision_behavior_simple(...) at least 40 N / 40 Nm. The law and the defaults are on the book's Python page.

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.3.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.3.0-cp39-abi3-manylinux_2_34_x86_64.whl (795.3 kB view details)

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

franka_rs-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (735.2 kB view details)

Uploaded CPython 3.9+manylinux: glibc 2.17+ ARM64

File details

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

File metadata

  • Download URL: franka_rs-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 dad7b11769ea801d602fe3e445159e70f9a3aa32593d8ce0e1f10a8f8d1f51b6
MD5 3ccf4b92ff0d27c0773fc3648df30e10
BLAKE2b-256 7321a2e721eb69764ff188b3105d201dd8043e0b545471e4837abb3aae44da60

See more details on using hashes here.

Provenance

The following attestation bundles were made for franka_rs-0.3.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.3.0-cp39-abi3-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for franka_rs-0.3.0-cp39-abi3-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d44c8fb3b72183431e11f2a86160b39b6aa321f2f2f981323cb0cba0c566b1dd
MD5 5e7ec2d9c9399bbc93525c15ccff7d6b
BLAKE2b-256 df9905badc0c1a2aacc917e319f6834fb134366affda30a2bfdf785193bc5fc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for franka_rs-0.3.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.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for franka_rs-0.3.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 b164d58b8f4b2e741ef9b47d04f858e5ef87c4a88dac561db5bf9c9d9074f5d9
MD5 d19ba092ac1df3e033a2a70572f15220
BLAKE2b-256 07e3aa562a53f0c47b5205c315abb3a6d80d071f16ae2a18b182dfb0d48e12f7

See more details on using hashes here.

Provenance

The following attestation bundles were made for franka_rs-0.3.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

This release

0.3.0 This release

3 files

0.2.0

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