step.logic.loop_dsl =================== .. py:module:: step.logic.loop_dsl .. autoapi-nested-parse:: Auto-generated step builders and DSL functions — DO NOT EDIT. Source: loop.py Classes ------- .. autoapisummary:: step.logic.loop_dsl.LoopForeverBuilder step.logic.loop_dsl.LoopForBuilder Functions --------- .. autoapisummary:: step.logic.loop_dsl.loop_forever step.logic.loop_dsl.loop_for Module Contents --------------- .. py:class:: LoopForeverBuilder Bases: :py:obj:`raccoon.step.step_builder.StepBuilder` Builder for LoopForever. Auto-generated — do not edit. .. py:method:: step(value: step.StepProtocol) .. py:function:: loop_forever(step: step.StepProtocol = _UNSET) Repeat a step indefinitely until externally cancelled. Wraps the given step in an infinite loop. Each iteration awaits the child step to completion before starting the next. The loop only terminates when the enclosing context cancels it (e.g. via ``do_while_active`` or ``do_until_checkpoint``). :param step: The step to execute repeatedly. Must satisfy ``StepProtocol``. :returns: A LoopForeverBuilder (chainable via ``.step()``, ``.on_anomaly()``, ``.skip_timing()``). Example:: from raccoon.step.logic import loop_forever from raccoon.step.timing import do_until_checkpoint # Continuously toggle a motor on and off until T=30s toggle = seq([ motor_power(robot.motor(0), 100), wait(0.5), motor_off(robot.motor(0)), wait(0.5), ]) do_until_checkpoint(30.0, loop_forever(toggle)) .. py:class:: LoopForBuilder Bases: :py:obj:`raccoon.step.step_builder.StepBuilder` Builder for LoopFor. Auto-generated — do not edit. .. py:method:: step(value: step.StepProtocol) .. py:method:: iterations(value: int) .. py:function:: loop_for(step: step.StepProtocol = _UNSET, iterations: int = _UNSET) Repeat a step a fixed number of times. Wraps the given step in a counted loop. Each iteration awaits the child step to completion before starting the next. After all iterations complete, the step finishes normally. :param step: The step to execute repeatedly. Must satisfy ``StepProtocol``. :param iterations: Number of times to run the step. Must be a positive integer. :returns: A LoopForBuilder (chainable via ``.step()``, ``.iterations()``, ``.on_anomaly()``, ``.skip_timing()``). Example:: from raccoon.step.logic import loop_for # Drive forward and back 3 times loop_for(seq([drive_forward(20), drive_backward(20)]), iterations=3)