Skip to content

State, subscriptions, and real-time control

Snapshots read once, subscriptions pull periodically, and Servo sessions send continuous targets.

APIDirectionUse
state.snapshot()Device to applicationPreflight and post-command verification
state.subscribe()Device to applicationContinuous state monitoring and logging
touch.subscribe()Device to applicationTactile monitoring and algorithm input
health.subscribe()Device to applicationRuntime and fault monitoring
open_servo()Application to deviceContinuous position or impedance targets

Subscription lifecycle

python
subscription = hand.state.subscribe(period=0.02)
try:
    while True:
        state = await subscription.next()
        process_state(state)
finally:
    subscription.close()

Subscriptions do not retain history. Use bounded queues and define a drop or downsampling policy when consumers are slower than acquisition; do not allow telemetry to accumulate without a limit.

Servo session

A Servo session owns control state. Complete layout and Health checks before opening it, define send timing and command timeout, monitor telemetry without assuming its rate equals the control rate, and close the session on every exit. No unconditional fixed frequency is guaranteed across hosts, adapters, bus load, and firmware.

Help