Skip to main content

Dexter Controller for the HARP Load Cells

Project description

dexter-controller (Python)

This is a Python package for controlling the Dexter device. It provides an interface to interact with it using a mapping between the device and the connected LoadCells for each finger.

Installation

You can install the package using uv:

uv add dexter-controller

Usage example

import time
from dexter_controller import Finger, DexterHandController

# The mapping dictionary should contain the serial port paths as keys and a list of Finger enums as values.
mapping = {
    "/dev/ttyUSB0": [Finger.THUMB, Finger.INDEX],   # "COMx" on Windows
    "/dev/ttyUSB1": [Finger.MIDDLE, Finger.RING],   # "COMy" on Windows
    "/dev/ttyUSB2": [Finger.PINKY],                 # "COMz on Windows
}

# When using the controller, you can access the raw data for each finger.
# Devices are connected on creation of the controller.
controller = DexterHandController(mapping)

try:
    print("Press Ctrl+C to exit.")
    while True:
        line = (
            f"Thumb: {controller.thumb.raw_data if controller.thumb else None} | "
            f"Index: {controller.index.raw_data if controller.index else None} | "
            f"Middle: {controller.middle.raw_data if controller.middle else None} | "
            f"Ring: {controller.ring.raw_data if controller.ring else None} | "
            f"Pinky: {controller.pinky.raw_data if controller.pinky else None}    "
        )
        print(line, end="\r", flush=True)
        # sleep for a short duration to avoid flooding the output (20 milliseconds)
        time.sleep(0.02)
except KeyboardInterrupt:
    print("Exiting...")
finally:
    controller.close()

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

dexter_controller-0.2.2.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

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

dexter_controller-0.2.2-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

File details

Details for the file dexter_controller-0.2.2.tar.gz.

File metadata

  • Download URL: dexter_controller-0.2.2.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dexter_controller-0.2.2.tar.gz
Algorithm Hash digest
SHA256 818463b639c99ec99135060dd05783e883fd4be351c1a730d0add9e03a5031ca
MD5 9e9dead52d88d51884e490d8dfa5e3a6
BLAKE2b-256 36c51a1287f74186dfaa6d42a78637358a4243895ffa6932160a082192feb01c

See more details on using hashes here.

File details

Details for the file dexter_controller-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: dexter_controller-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 8.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for dexter_controller-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 eb4af9720dd39cc778bcd9a5360705bf126966ab414dae7f04d2ee45c1439414
MD5 b4b60c8ac2048d647cec5ca956ca8e48
BLAKE2b-256 4abc255c29531dc7226085133bf276d62039954ed7ce9caa720050f810cb13c4

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