Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dexter-controller

PyPI Python

Python library for the Dexter hand device. This library handles device communication, force computation, calibration, and data recording.

Installation

The recommended way to install the library is via uv. In your project add the dependency with:

uv add dexter-controller
# or use pip
pip install dexter-controller

Optional extras for reading and writing recordings:

uv add dexter-controller[reader]    # numpy, for loading recordings
uv add dexter-controller[parquet]   # pyarrow + numpy, for Parquet format support
# or use pip
pip install dexter-controller[reader]    # numpy, for loading recordings
pip install dexter-controller[parquet]   # pyarrow + numpy, for Parquet format support

Quick start

Connect over BLE or UART using the DexterDevice factory:

import time
from dexter_controller import DexterDevice, Finger

device = DexterDevice.create_ble(
    # connect to a specific device by name:
    # device_name="Dexter-001"
)
device.connect()
device.start_acquisition()

device_name = device.get_device_name()
battery = device.get_battery_level()
rate = device.get_sampling_rate()
print(f"Device: {device_name} | Battery: {battery}% | Rate: {rate.value} Hz")

try:
    while True:
        for finger in Finger:
            data = device.finger_data[finger]
            print(f"{finger.name}: {data.raw_data}", end="  ")
        print(end="\r", flush=True)
        time.sleep(0.02)
except KeyboardInterrupt:
    pass
finally:
    device.close()

Force computation

Convert raw load-cell readings into calibrated 2D force vectors (Fx, Fy):

from dexter_controller import (
    DEFAULT_CALIBRATION,
    DexterDevice,
    Finger,
    ForceProcessor,
    get_default_orientation,
)

device = DexterDevice.create_ble()
device.connect()
device.start_acquisition()

processors = {}
for finger in Finger:
    orientation = get_default_orientation(finger)
    processors[finger] = ForceProcessor(DEFAULT_CALIBRATION, orientation)

# In your read loop:
data = device.finger_data[Finger.INDEX]
fx, fy = processors[Finger.INDEX].process(data)

Each ForceProcessor includes a TareState that lets you zero-out the baseline:

processors[Finger.INDEX].tare.start_tare(sample_count=20)

Recording data

Record sessions to disk in CSV, SQLite (default), or Parquet format:

from dexter_controller import (
    DEFAULT_CALIBRATION,
    DataRecorder,
    DexterDevice,
    Finger,
    ForceProcessor,
    RecordingMetadata,
    get_default_orientation,
)
from dexter_controller.recording_format import RecordingFormat

device = DexterDevice.create_ble()
device.connect()
device.start_acquisition()

processors = {}
for finger in Finger:
    processors[finger] = ForceProcessor(
        DEFAULT_CALIBRATION, get_default_orientation(finger)
    )

recorder = DataRecorder(
    "./recordings",
    file_format=RecordingFormat.SQLITE,
    metadata=RecordingMetadata(
        device_name=device.get_device_name(),
        sampling_rate_hz=device.get_sampling_rate().value,
    ),
)

def on_sample(_data):
    fingers = [device.finger_data[f] for f in Finger]
    forces = [processors[f].process(device.finger_data[f]) for f in Finger]
    baselines = [(processors[f].tare.baseline_x, processors[f].tare.baseline_y) for f in Finger]
    recorder.write_sample(fingers, forces, baselines)

device.register_finger_callback(Finger.PINKY, on_sample)

recorder.start_recording()
# ... run until done ...
recorder.stop_recording()
device.close()

Each recording file includes session metadata.

Session metadata has the following fields:

  • session_id: Unique identifier for the recording session.
  • recording_started_at: Timestamp when the recording started.
  • recording_stopped_at: Timestamp when the recording stopped.
  • total_samples: Total number of samples recorded.
  • library_version: Version of the library used for recording.
  • timestamps: Array of timestamps for each sample.
  • device_name: Name of the device used for recording.
  • sampling_rate_hz: Sampling rate in Hz.
  • extras: Dictionary for experiment-specific metadata.

You can attach experiment-specific metadata via RecordingMetadata.extras:

metadata = RecordingMetadata(
    device_name="Dexter-001",
    sampling_rate_hz=1000,
    extras={"subject_id": "S01", "trial": "3", "condition": "baseline"},
)

Reading recordings

Load recorded sessions back for analysis:

from dexter_controller import RecordingReader

recording = RecordingReader.read("recordings/session.db")
print(f"Samples: {recording.num_rows}")
print(f"Session: {recording.metadata.session_id}")
print(f"Forces shape: {recording.forces.shape}")    # (N, 10) - Fx,Fy per finger
print(f"Raw channels: {recording.raw_channels.shape}")  # (N, 15) - 3 channels per finger

For either the Sqlite and Parquet formats, you can use Pandas or Polars to load the data for analysis.

import pandas as pd

# for Sqlite format, use:
conn = RecordingReader.open("recordings/session.db")
df = pd.read_sql("SELECT * FROM samples", conn)
print(df.head())

# or for Parquet format, use:
df = pd.read_parquet("recordings/session.parquet")
print(df.head())

You can also convert those formats to CSV for easier analysis or interoperability:

RecordingReader.to_csv("recordings/session.db")  # produces session.csv

BLE device configuration

When connected via BLE, you can read and write device settings:

from dexter_controller import SamplingRate

device.get_device_name()                          # read name
device.set_device_name("MyDexter")                # rename device
device.get_sampling_rate()                        # current rate
device.set_sampling_rate(SamplingRate.HZ_1000)    # change rate
device.get_battery_level()                        # battery percentage

Available sampling rates: 100, 200, 400, 800, 1000, 2000 Hz.

Examples

See the example/ directory for complete, runnable scripts:

File Description
example_ble.py BLE connection with raw data streaming and event rate monitoring
example_ble_force.py BLE connection with real-time force computation using ForceProcessor
example_ble_recording.py Full recording session: BLE connect, force processing, and data recording to file
example_uart.py UART (wired) connection

UART connection

For wired setups using UART:

import sys
from dexter_controller import DexterDevice, EventFlags, Finger, SamplingRate

device = DexterDevice.create_uart("COM3")  # or /dev/ttyUSB0 on Linux

with device:
    device.set_sampling_rate(SamplingRate.HZ_800)
    device.set_event_enable(EventFlags.LOAD_CELL_DATA)
    device.set_finger_channel_mapping([Finger.RING, None, None, None, None])
    device.start_acquisition()
    # ... read data via device.register_data_callback(callback)

Metadata

Release files for dexter-controller 1.0.0a1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dexter-controller 1.0.0a1
File Size Uploaded Provenance Actions
dexter_controller-1.0.0a1.tar.gz 31.2 kB With provenance Details for dexter_controller-1.0.0a1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dexter-controller 1.0.0a1
File Interpreter ABI Platform Actions
dexter_controller-1.0.0a1-py3-none-any.whl Python 3 none any Details for dexter_controller-1.0.0a1-py3-none-any.whl

Total release size: 68.7 kB

Release files / dexter_controller-1.0.0a1.tar.gz

Download URL dexter_controller-1.0.0a1.tar.gz
Size 31.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9646ac0ec4dfd107b0a1543241c3a59b2e75dfd93b864f57336269b15f83979b
BLAKE2b-256 checksum
How to use checksums
8768675caa1bc3e0200750456ee3c76cfc4edc0441ecad4e9c08185f7008e833
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Release files / dexter_controller-1.0.0a1-py3-none-any.whl

Download URL dexter_controller-1.0.0a1-py3-none-any.whl
Size 37.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adc96e3c4ff892e54d6470da071c5e57dac6a7ab069aea58a664ec4c5c50f783
BLAKE2b-256 checksum
How to use checksums
5f378f8df9d1cd4ba9d1012db468c2f8af0d511f1eedffbb3ceab86e3ae607e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

Security for dexter-controller 1.0.0a1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dexter_controller-1.0.0a1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 22, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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