Fault Handling
Fault detection and clearing for the L6 dexterous hand.
Overview
Use hand.fault to access fault-related functions:
- Clear fault codes
- Read fault status in blocking or cached mode
Fault Code Table
| Fault code | Value | Description |
|---|---|---|
NONE | 0 | No fault |
PHASE_B_OVERCURRENT | 1 | Phase B overcurrent |
PHASE_C_OVERCURRENT | 2 | Phase C overcurrent |
PHASE_A_OVERCURRENT | 4 | Phase A overcurrent |
OVERLOAD_1 | 8 | Overload level 1 |
OVERLOAD_2 | 16 | Overload level 2 |
MOTOR_OVERTEMP | 32 | Motor overtemperature |
MCU_OVERTEMP | 64 | MCU overtemperature |
Clear Faults
hand.fault.clear_faults()
Clear fault codes on all joints.
Read Faults
Blocking Read
data = hand.fault.get_blocking(timeout_ms=500)
Parameter:
timeout_ms: Timeout in milliseconds, default100
Return value: FaultData, containing:
faults:L6Faultfault 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.l6 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
L6Fault fields
| Field | Description |
|---|---|
thumb_flex | Thumb flexion |
thumb_abd | Thumb abduction |
index | Index finger |
middle | Middle finger |
ring | Ring finger |
pinky | Pinky |
L6Fault 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 has a fault
faults.thumb_flex.has_fault() # -> bool
# Get fault names
faults.thumb_flex.get_fault_names() # -> list[str]
Examples
Check and Clear Faults
from realhand import L6
with L6(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()}")
# Clear faults
hand.fault.clear_faults()
else:
print("No faults")
Continuous Monitoring
from realhand import L6
from realhand.hand.l6 import SensorSource, FaultEvent
with L6(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()