libstp.step.motion.motion_step

Base class for motion steps with a unified fixed-rate update loop.

All motion steps share the same async timing pattern: dt calculation, near-zero dt skip, sleep, and hard_stop cleanup. MotionStep owns this loop and exposes on_start / on_update / on_stop lifecycle hooks for subclasses.

Classes

MotionLoopStats

Summary of the fixed-rate loop timing observed during one motion step.

MotionStep

Base class for all motion steps. Handles the fixed-rate update loop.

Module Contents

class libstp.step.motion.motion_step.MotionLoopStats

Summary of the fixed-rate loop timing observed during one motion step.

iterations: int
elapsed_s: float
avg_hz: float
min_dt_ms: float
max_dt_ms: float
class libstp.step.motion.motion_step.MotionStep

Bases: libstp.step.Step

Base class for all motion steps. Handles the fixed-rate update loop.

hz: int = 100
on_start(robot: libstp.robot.api.GenericRobot) None

Called once before the loop. Override to set up motion/velocity.

abstract on_update(robot: libstp.robot.api.GenericRobot, dt: float) bool

Called each cycle with dt in seconds. Return True when motion is complete.

on_stop(robot: libstp.robot.api.GenericRobot) None

Called after loop exits. Default: hard_stop.