Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Quick Start

Connect to a Dexterous Hand

from realhand import L6

with L6(side="left", interface_name="can0") as hand:
    # Control and read the hand
    pass

Use a with statement to ensure resources are released correctly.

Control Joint Angles

Set target angles for the 6 joints (range 0-100):

from realhand import L6

with L6(side="left", interface_name="can0") as hand:
    # Open the hand
    hand.angle.set_angles([100, 50, 100, 100, 100, 100])

    # Close into a fist
    hand.angle.set_angles([0, 0, 0, 0, 0, 0])

Joint order: [thumb_flex, thumb_abd, index, middle, ring, pinky]

Read Angles

with L6(side="left", interface_name="can0") as hand:
    # Blocking read
    data = hand.angle.get_blocking(timeout_ms=100)
    print(f"Current angles: {data.angles.to_list()}")

    # Access a single joint
    print(f"Index finger: {data.angles.index}")

Read Force Sensors

Get force sensor data from all 5 fingers:

with L6(side="left", interface_name="can0") as hand:
    data = hand.force_sensor.get_blocking(timeout_ms=1000)

    # Access per-finger data
    print(f"Thumb: {data.thumb.values.shape}")  # (12, 6)
    print(f"Index: {data.index.values.shape}")

Streaming Reads

Continuously receive data through the unified event stream. Polling starts automatically at initialization with default intervals (angles at 60 Hz, force sensors at 30 Hz). You can override that by calling start_polling() manually:

from realhand.hand.l6 import SensorSource, AngleEvent

with L6(side="left", interface_name="can0") as hand:
    # Default polling has already started automatically (angle + force sensor)
    # Call start_polling() again if you want custom settings
    hand.start_polling({SensorSource.ANGLE: 0.1})

    for event in hand.stream():
        match event:
            case AngleEvent(data=data):
                print(f"Angles: {data.angles.to_list()}")

        if should_stop():
            break

    hand.stop_polling()
    hand.stop_stream()

Complete Example

from realhand import L6
import time

with L6(side="left", interface_name="can0") as hand:
    # Set speed
    hand.speed.set_speeds([50, 50, 50, 50, 50, 50])

    # Open
    hand.angle.set_angles([100, 50, 100, 100, 100, 100])
    time.sleep(1)

    # Close
    hand.angle.set_angles([0, 0, 0, 0, 0, 0])
    time.sleep(1)

    # Read state
    angles = hand.angle.get_blocking()
    temps = hand.temperature.get_blocking()

    print(f"Angles: {angles.angles.to_list()}")
    print(f"Temperature: {temps.temperatures.to_list()} °C")

Next Steps