Skip to main content

Python bindings for libfranka - Control Franka robots with Python

Project description

pylibfranka Installation and Usage Guide

This document provides comprehensive instructions for installing and using pylibfranka, a Python binding for libfranka that enables control of Franka Robotics robots.

Table of Contents

Installation

From PyPI (Recommended)

The easiest way to install pylibfranka is via pip. Pre-built wheels include all necessary dependencies.

pip install pylibfranka

Platform Compatibility

Ubuntu Version Supported Python Versions
20.04 (Focal) Python 3.9 only
22.04 (Jammy) Python 3.9, 3.10, 3.11, 3.12
24.04 (Noble) Python 3.9, 3.10, 3.11, 3.12

Note: Ubuntu 20.04 users must use Python 3.9 due to glibc compatibility requirements.

From Source

If you need to build from source (e.g., for development or unsupported platforms):

Prerequisites

  • Python 3.9 or newer
  • CMake 3.16 or newer
  • C++ compiler with C++17 support
  • Eigen3 development headers
  • Poco development headers

Disclaimer: If you are using the provided devcontainer, you can skip the prerequisites installation as they are already included in the container.

Installing Prerequisites on Ubuntu/Debian

sudo apt-get update
sudo apt-get install -y build-essential cmake libeigen3-dev libpoco-dev python3-dev

Build and Install

From the root folder, you can install pylibfranka using pip:

pip install .

This will install pylibfranka in your current Python environment.

Examples

pylibfranka comes with three example scripts that demonstrate how to use the library to control a Franka robot.

Joint Position Example

This example demonstrates how to use an external control loop with pylibfranka to move the robot joints.

To run the example:

cd examples
python3 joint_position_example.py --ip <robot_ip>

Where <robot_ip> is the IP address of your Franka robot. If not specified, it defaults to "localhost".

The active control example:

  • Sets collision behavior parameters
  • Starts joint position control with CartesianImpedance controller mode
  • Moves the robot using an external control loop
  • Performs a simple motion of selected joints

Print Robot State Example

This example shows how to read and display the complete state of the robot.

To run the example:

cd examples
python3 print_robot_state.py --ip <robot_ip> [--rate <rate>] [--count <count>]

Where:

  • --ip is the robot's IP address (defaults to "localhost")
  • --rate is the frequency at which to print the state in Hz (defaults to 0.5)
  • --count is the number of state readings to print (defaults to 1, use 0 for continuous)

The print robot state example:

  • Connects to the robot
  • Reads the complete robot state
  • Prints detailed information about:
    • Joint positions, velocities, and torques
    • End effector pose and velocities
    • External forces and torques
    • Robot mode and error states
    • Mass and inertia properties

Joint Impedance Control Example

This example demonstrates how to implement a joint impedance controller that renders a spring-damper system to move the robot through a sequence of target joint configurations.

To run the example:

cd examples
python3 joint_impedance_example.py --ip <robot_ip>

Where --ip is the robot's IP address (defaults to "localhost").

The joint impedance example:

  • Implements a minimum jerk trajectory generator for smooth joint motion
  • Uses a spring-damper system for compliant control
  • Moves through a sequence of predefined joint configurations:
    • Home position (slightly bent arm)
    • Extended arm pointing forward
    • Arm pointing to the right
    • Arm pointing to the left
    • Return to home position
  • Includes position holding with dwell time between movements
  • Compensates for Coriolis effects

And more control examples

There are more control examples to discover. All of them can be executed in a similar way:

cd examples
python3 other_example.py --ip <robot_ip>

Gripper Control Example

This example demonstrates how to control the Franka gripper, including homing, grasping, and reading gripper state.

To run the example:

cd examples
python3 move_gripper.py --robot_ip <robot_ip> [--width <width>] [--homing <0|1>] [--speed <speed>] [--force <force>]

Where:

  • --robot_ip is the robot's IP address (required)
  • --width is the object width to grasp in meters (defaults to 0.005)
  • --homing enables/disables gripper homing (0 or 1, defaults to 1)
  • --speed is the gripper speed (defaults to 0.1)
  • --force is the gripper force in N (defaults to 60)

The gripper example:

  • Connects to the gripper
  • Performs homing to estimate maximum grasping width
  • Reads and displays gripper state including:
    • Current width
    • Maximum width
    • Grasp status
    • Temperature
    • Timestamp
  • Attempts to grasp an object with specified parameters
  • Verifies successful grasping
  • Releases the object

Async Joint Position Control Example

You can also use the async API to control the robot in a low-rate fashion, e.g. 50Hz. This allows you to specify joint position setpoints without the need for a blocking loop.

cd examples
python3 async_position_control.py --ip <robot_ip> 

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

pylibfranka-0.21.1.tar.gz (16.2 kB view details)

Uploaded Source

Built Distributions

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

pylibfranka-0.21.1-cp312-cp312-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

pylibfranka-0.21.1-cp311-cp311-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

pylibfranka-0.21.1-cp310-cp310-manylinux_2_34_x86_64.whl (4.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

pylibfranka-0.21.1-cp39-cp39-manylinux_2_31_x86_64.whl (4.4 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.31+ x86-64

File details

Details for the file pylibfranka-0.21.1.tar.gz.

File metadata

  • Download URL: pylibfranka-0.21.1.tar.gz
  • Upload date:
  • Size: 16.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pylibfranka-0.21.1.tar.gz
Algorithm Hash digest
SHA256 d68b271732e064f4158c9d6faeece0f352c3a54b45da9970dbe88c8a556836f1
MD5 4f0f7e0c9d070c1ea18bf1557dba31fe
BLAKE2b-256 f572b9f6f5a319e8eb45775db69a6385dc2fc2dd4cb268d8ac146fc7bb10b9a6

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibfranka-0.21.1.tar.gz:

Publisher: pylibfranka-wheels.yml on frankarobotics/libfranka

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

File details

Details for the file pylibfranka-0.21.1-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pylibfranka-0.21.1-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b0528fe749c6d46612d1ce8da592a884dbca7dbf5632d2131d67f13d136a6b61
MD5 9d9f3902f85a11b56d3d951c1f7c78ce
BLAKE2b-256 f22138b4359097a61645673d28026280cf2031e378422e91fc7b9aaefd9ece04

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibfranka-0.21.1-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: pylibfranka-wheels.yml on frankarobotics/libfranka

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

File details

Details for the file pylibfranka-0.21.1-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pylibfranka-0.21.1-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 cf7b0fcc43667f00a4ee0a97fadbb7a5b0bbbf4eb89ce313d800b5483552b958
MD5 8f170562c2e3cb1bcf0b51c280327dd2
BLAKE2b-256 f6654e97efd08cc42041d64ab0324d50c62d58e948e8b681fca7bf5edf06aee8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibfranka-0.21.1-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: pylibfranka-wheels.yml on frankarobotics/libfranka

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

File details

Details for the file pylibfranka-0.21.1-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for pylibfranka-0.21.1-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 476d2e3c76be94a7a8db657b1cb2e33bc935c08e7e497a87a104816936b15329
MD5 39ef48a22d62d4c1698c9e338f4f4f44
BLAKE2b-256 c27071b7f872ebb26df914507c42c1753644ca3f76b97b336cc6976e8e6d42d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibfranka-0.21.1-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: pylibfranka-wheels.yml on frankarobotics/libfranka

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

File details

Details for the file pylibfranka-0.21.1-cp39-cp39-manylinux_2_31_x86_64.whl.

File metadata

File hashes

Hashes for pylibfranka-0.21.1-cp39-cp39-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 346782485cd257efc722f99496b5e1121f5b2bfd6d3cc6dabed8d6d40f705bd7
MD5 bb8522673ff7c326ba499e8a995a9865
BLAKE2b-256 0bd5fb85f470761ddd0d7f5724225021e61804a087d7fcb098b699af523d5b35

See more details on using hashes here.

Provenance

The following attestation bundles were made for pylibfranka-0.21.1-cp39-cp39-manylinux_2_31_x86_64.whl:

Publisher: pylibfranka-wheels.yml on frankarobotics/libfranka

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

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