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 harp.loadcells

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dexter_controller-0.1.1.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.17

File hashes

Hashes for dexter_controller-0.1.1.tar.gz
Algorithm Hash digest
SHA256 02a1c2bf2bcc7f3cd30a0ae7008f0cd94c27d738f01ad9fdb14a619f6663c85f
MD5 bf55a805676f8de9778e763388d7779a
BLAKE2b-256 38be285492ace13edf3e20d91b7569c33f454934f5aee62875e0d0e6c46e4d36

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dexter_controller-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4dd3a5b9ff3f5015bdb7fbd8afc5c8431fff89240ebc99f40f8bd54c5dc74fdd
MD5 b7c27dde6e9ccecddce6a09d896f1a08
BLAKE2b-256 554d2fffd52d5f193f1fdf1a85334ecaa18999b8326578f0d459280148a4bb18

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