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.1.2.tar.gz (4.0 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.1.2-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dexter_controller-0.1.2.tar.gz
  • Upload date:
  • Size: 4.0 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.1.2.tar.gz
Algorithm Hash digest
SHA256 1bcc4b17258e03766ca52c1d21cbe1bab1f2af7edd83689cc603ba6c86cc6fb7
MD5 7c43373ebe31d58b12ca5cd3f7f62def
BLAKE2b-256 21183c9d9ab4eb95ecd7ca560015a36b05a69dfabd935ea1fd5a3abcc5c1aeb6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dexter_controller-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.7 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.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0012872233ac6e5e0cce281e5c3d4dd3f8329317e8be499d7cac7b12a37b7db2
MD5 84e8581e852ea978c209906152251057
BLAKE2b-256 1c211644eb5514ea90b43560211dacb2866aa50a1e2bbef3e452e5e92919f125

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