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

Fault Handling

Fault detection for the O6 dexterous hand.

Overview

Use hand.fault to access fault-related functionality:

  • Read fault status in blocking or cached mode

Fault Code Table

Fault codeValueDescription
NONE0No fault
VOLTAGE_ABNORMAL1Overvoltage / undervoltage
ENCODER_ABNORMAL2Magnetic encoder abnormality
OVERTEMPERATURE4Overtemperature
OVERCURRENT8Overcurrent
OVERLOAD32Overload

Read Faults

Blocking Read

data = hand.fault.get_blocking(timeout_ms=500)

Parameter:

  • timeout_ms: Timeout in milliseconds, default 100

Return value: FaultData, containing:

  • faults: O6Fault fault data
  • timestamp: Timestamp

Exception:

  • TimeoutError: No response before timeout

Cached Read

data = hand.fault.get_snapshot()

Returns the latest cached fault data, or None if no data is available.

Streaming Read

Receive all sensor events through the top-level hand.stream() interface:

from realhand.hand.o6 import SensorSource, FaultEvent

hand.start_polling({SensorSource.FAULT: 0.2})

for event in hand.stream():
    match event:
        case FaultEvent(data=data):
            if data.faults.has_any_fault():
                for code in data.faults.to_list():
                    if code.has_fault():
                        print(code.get_fault_names())

hand.stop_polling()
hand.stop_stream()

Fault Data

O6Fault fields

FieldDescription
thumb_flexThumb flexion
thumb_abdThumb abduction
indexIndex finger
middleMiddle finger
ringRing finger
pinkyPinky

O6Fault methods

# Check whether any fault exists
faults.has_any_fault()  # -> bool

# Convert to a list
faults.to_list()  # -> list[FaultCode]

# Index access
faults[0]  # thumb_flex

FaultCode methods

# Check whether a single joint motor has a fault
faults.thumb_flex.has_fault()  # -> bool

# Get fault names
faults.thumb_flex.get_fault_names()  # -> list[str]

Examples

Check Fault Status

from realhand import O6

with O6(side="left", interface_name="can0") as hand:
    # Read fault status
    data = hand.fault.get_blocking(timeout_ms=500)

    if data.faults.has_any_fault():
        print("Fault detected:")
        if data.faults.thumb_flex.has_fault():
            print(f"  Thumb flexion: {data.faults.thumb_flex.get_fault_names()}")
        if data.faults.index.has_fault():
            print(f"  Index finger: {data.faults.index.get_fault_names()}")
    else:
        print("No faults")

Continuous Monitoring

from realhand import O6
from realhand.hand.o6 import SensorSource, FaultEvent

with O6(side="left", interface_name="can0") as hand:
    hand.start_polling({SensorSource.FAULT: 0.2})

    try:
        for event in hand.stream():
            match event:
                case FaultEvent(data=data):
                    if data.faults.has_any_fault():
                        for code in data.faults.to_list():
                            if code.has_fault():
                                print(code.get_fault_names())
    except KeyboardInterrupt:
        pass
    finally:
        hand.stop_polling()
        hand.stop_stream()