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 code | Value | Description |
|---|---|---|
NONE | 0 | No fault |
VOLTAGE_ABNORMAL | 1 | Overvoltage / undervoltage |
ENCODER_ABNORMAL | 2 | Magnetic encoder abnormality |
OVERTEMPERATURE | 4 | Overtemperature |
OVERCURRENT | 8 | Overcurrent |
OVERLOAD | 32 | Overload |
Read Faults
Blocking Read
data = hand.fault.get_blocking(timeout_ms=500)
Parameter:
timeout_ms: Timeout in milliseconds, default100
Return value: FaultData, containing:
faults:O6Faultfault datatimestamp: 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
| Field | Description |
|---|---|
thumb_flex | Thumb flexion |
thumb_abd | Thumb abduction |
index | Index finger |
middle | Middle finger |
ring | Ring finger |
pinky | Pinky |
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()