Fault Handling
Fault detection for the L20Lite 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
from realhand.exceptions import TimeoutError
try:
data = hand.fault.get_blocking(timeout_ms=500)
except TimeoutError:
print("Read timed out")
Parameter:
timeout_ms: Timeout in milliseconds, default100
Return value: FaultData, containing:
faults:L20liteFaultfault datatimestamp: Timestamp
Exception:
TimeoutError: No response before timeout
Cached Read
data = hand.fault.get_snapshot()
if data:
print(f"Has fault: {data.faults.has_any_fault()}")
Returns the latest cached fault data, or None if no data is available.
Fault Data
L20liteFault fields
| Field | Description |
|---|---|
thumb_flex | Thumb flexion |
thumb_abd | Thumb abduction |
index_flex | Index flexion |
middle_flex | Middle flexion |
ring_flex | Ring flexion |
pinky_flex | Pinky flexion |
index_abd | Index abduction |
ring_abd | Ring abduction |
pinky_abd | Pinky abduction |
thumb_yaw | Thumb rotation |
L20liteFault 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 L20lite
with L20lite(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_flex.has_fault():
print(f" Index flexion: {data.faults.index_flex.get_fault_names()}")
else:
print("No faults")
Iterate Through All Joint Faults
from realhand import L20lite
with L20lite(side="left", interface_name="can0") as hand:
data = hand.fault.get_blocking(timeout_ms=500)
if data.faults.has_any_fault():
for i, code in enumerate(data.faults.to_list()):
if code.has_fault():
print(f"Joint {i} fault: {code.get_fault_names()}")