libstp.step.motion.motion_step ============================== .. py:module:: libstp.step.motion.motion_step .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: libstp.step.motion.motion_step.MotionLoopStats libstp.step.motion.motion_step.MotionStep Module Contents --------------- .. py:class:: MotionLoopStats Summary of the fixed-rate loop timing observed during one motion step. .. py:attribute:: iterations :type: int .. py:attribute:: elapsed_s :type: float .. py:attribute:: avg_hz :type: float .. py:attribute:: min_dt_ms :type: float .. py:attribute:: max_dt_ms :type: float .. py:class:: MotionStep Bases: :py:obj:`libstp.step.Step` Base class for all motion steps. Handles the fixed-rate update loop. .. py:attribute:: hz :type: int :value: 100 .. py:method:: on_start(robot: libstp.robot.api.GenericRobot) -> None Called once before the loop. Override to set up motion/velocity. .. py:method:: on_update(robot: libstp.robot.api.GenericRobot, dt: float) -> bool :abstractmethod: Called each cycle with dt in seconds. Return True when motion is complete. .. py:method:: on_stop(robot: libstp.robot.api.GenericRobot) -> None Called after loop exits. Default: hard_stop.