Speed Control
Use hand.speed to control and read the motion speed of each joint motor on the O6 dexterous hand.
- Speed range: 0-100
- Maximum RPM: 186.66 RPM at value
100
Set Speed
from realhand import O6
from realhand.hand.o6 import O6Speed
# Using a list
hand.speed.set_speeds([50.0, 50.0, 50.0, 50.0, 50.0, 50.0])
# Using an O6Speed object
speed = O6Speed(
thumb_flex=30.0, # Thumb flexion
thumb_abd=30.0, # Thumb abduction
index=80.0, # Index finger
middle=80.0, # Middle finger
ring=80.0, # Ring finger
pinky=80.0, # Pinky
)
hand.speed.set_speeds(speed)
Read Speed
Blocking Read
from realhand import O6
from realhand.exceptions import TimeoutError
try:
data = hand.speed.get_blocking(timeout_ms=500)
print(f"Thumb flexion speed: {data.speeds.thumb_flex}")
print(f"All speeds: {data.speeds.to_list()}")
except TimeoutError:
print("Read timed out")
Cached Read
data = hand.speed.get_snapshot()
if data:
print(f"Speed: {data.speeds.to_list()}")
print(f"Timestamp: {data.timestamp}")
Streaming Read
Receive all sensor events through the top-level hand.stream() interface:
from realhand.hand.o6 import SensorSource, SpeedEvent
hand.start_polling({SensorSource.SPEED: 0.1})
for event in hand.stream():
match event:
case SpeedEvent(data=data):
print(f"Speed: {data.speeds.to_list()}")
hand.stop_polling()
hand.stop_stream()
RPM Conversion
O6Speed supports conversion to and from RPM.
Convert to RPM
from realhand.hand.o6 import O6Speed
speed = O6Speed(50.0, 50.0, 50.0, 50.0, 50.0, 50.0)
rpm_values = speed.to_rpm()
print(rpm_values) # [93.33, 93.33, 93.33, 93.33, 93.33, 93.33]
Create from RPM
from realhand.hand.o6 import O6Speed
# Set all joint motors to 90 RPM
speed = O6Speed.from_rpm([90.0, 90.0, 90.0, 90.0, 90.0, 90.0])
hand.speed.set_speeds(speed)
# Thumb slow, other fingers fast
speed = O6Speed.from_rpm([60.0, 60.0, 120.0, 120.0, 120.0, 120.0])
hand.speed.set_speeds(speed)
Complete Example
from realhand import O6
from realhand.hand.o6 import O6Speed
with O6(side="left", interface_name="can0") as hand:
# Set speed using RPM
speed = O6Speed.from_rpm([90.0, 90.0, 120.0, 120.0, 120.0, 120.0])
hand.speed.set_speeds(speed)
# Read current speed
data = hand.speed.get_blocking(timeout_ms=500)
print(f"Current speed: {data.speeds.to_list()}")
print(f"RPM: {data.speeds.to_rpm()}")