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.1.tar.gz (5.4 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.1-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dexter_controller-0.2.1.tar.gz
  • Upload date:
  • Size: 5.4 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.1.tar.gz
Algorithm Hash digest
SHA256 2fdd859f5839190f19dce98e7c5b612e6e44ecdee358de6db94a66269fd8b1ca
MD5 8b1fcb38b48df16e70e1b4d48a227e32
BLAKE2b-256 7a76586d073f0cbcd84180df9c6d9d4a4eb58d89ba2a5db8d7bf6396df073800

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexter_controller-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.6 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bbe4af864ff2ab5ae8318d0b48b6a22484a3422570afe6cb12b316f8e2c67b8c
MD5 6870c175d6661dd0952503e479c2a7c3
BLAKE2b-256 35f164d2f25de13df78eb05a362c374e78da4a2c7de92a92273e3a80a4baecea

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