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 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 step.motion.motion_step.MotionStep

Bases: step.Step

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

hz: int = 100
required_resources() frozenset[str]

Return the hardware resources this step requires exclusive access to.

For leaf steps (drive, motor, servo), return the resources this step directly uses. Composite steps override collected_resources instead to include children — required_resources stays empty for composites because they don’t touch hardware themselves.

on_start(robot: raccoon.robot.api.GenericRobot) None

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

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

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

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

Called after loop exits. Default: hard_stop.