Acceleration Control
Use hand.acceleration to control and read the acceleration of the 6 joint motors on the O6 dexterous hand.
- Acceleration range: 0-100
- Maximum acceleration: 2209.8 deg/s² at value
100
Set Acceleration
from realhand import O6
from realhand.hand.o6 import O6Acceleration
# Using a list
hand.acceleration.set_accelerations([80.0, 80.0, 80.0, 80.0, 80.0, 80.0])
# Using an O6Acceleration object
accel = O6Acceleration(
thumb_flex=80.0, # Thumb flexion
thumb_abd=80.0, # Thumb abduction
index=80.0, # Index finger
middle=80.0, # Middle finger
ring=80.0, # Ring finger
pinky=80.0, # Pinky
)
hand.acceleration.set_accelerations(accel)
Read Acceleration
Blocking Read
from realhand import O6
from realhand.exceptions import TimeoutError
try:
data = hand.acceleration.get_blocking(timeout_ms=500)
print(f"Thumb flexion: {data.accelerations.thumb_flex}")
print(f"All accelerations: {data.accelerations.to_list()}")
except TimeoutError:
print("Read timed out")
Cached Read
data = hand.acceleration.get_snapshot()
if data:
print(f"Acceleration: {data.accelerations.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, AccelerationEvent
hand.start_polling({SensorSource.ACCELERATION: 0.1})
for event in hand.stream():
match event:
case AccelerationEvent(data=data):
print(f"Acceleration: {data.accelerations.to_list()}")
hand.stop_polling()
hand.stop_stream()
deg/s² Conversion
O6Acceleration supports conversion to and from the physical unit deg/s².
Convert to deg/s²
from realhand.hand.o6 import O6Acceleration
accel = O6Acceleration(50.0, 50.0, 50.0, 50.0, 50.0, 50.0)
deg_s2_values = accel.to_deg_per_sec2()
print(deg_s2_values) # [1104.9, 1104.9, 1104.9, 1104.9, 1104.9, 1104.9]
Create from deg/s²
from realhand.hand.o6 import O6Acceleration
# Set all joint motor accelerations to 1000 deg/s²
accel = O6Acceleration.from_deg_per_sec2([1000.0] * 6)
# Set different accelerations
accel = O6Acceleration.from_deg_per_sec2(
[
1500.0, # Thumb flexion
1200.0, # Thumb abduction
1800.0, # Index finger
1800.0, # Middle finger
1800.0, # Ring finger
1800.0, # Pinky
]
)
Complete Example
from realhand import O6
from realhand.hand.o6 import O6Acceleration
with O6(side="left", interface_name="can0") as hand:
# Set a lower acceleration for smoother motion
hand.acceleration.set_accelerations([30.0] * 6)
# Set acceleration using deg/s²
accel = O6Acceleration.from_deg_per_sec2([1000.0] * 6)
hand.acceleration.set_accelerations(accel)
# Read current acceleration
data = hand.acceleration.get_blocking(timeout_ms=500)
print(f"Current acceleration: {data.accelerations.to_list()}")
print(f"In deg/s²: {data.accelerations.to_deg_per_sec2()}")