step.timing.do_until_checkpoint¶
Classes¶
Run a step until a mission-relative time checkpoint, then cancel it. |
Module Contents¶
- class step.timing.do_until_checkpoint.DoUntilCheckpoint(checkpoint: float, step)¶
Bases:
step.StepRun a step until a mission-relative time checkpoint, then cancel it.
Starts executing
stepimmediately and cancels it when the robot’s global synchronizer clock reachescheckpointseconds since mission start. If the step finishes before the checkpoint, execution continues without waiting. This is useful for time-boxing actions within a timed Botball run (e.g. “search for objects, but stop at T=45s no matter what”).- Prerequisites:
The robot must have a
synchronizerconfigured. The synchronizer clock starts when the mission begins.
- Parameters:
checkpoint – The mission-relative deadline (in seconds) at which
stepwill be cancelled.step – The step to run. Will be cancelled if still active when the checkpoint time is reached.
Example:
from raccoon.step.timing import do_until_checkpoint from raccoon.step.logic import loop_forever # Search for objects until T=45s, then move on search = loop_forever(seq([ scan_for_object(), drive_forward(10), ])) seq([ do_until_checkpoint(45.0, search), drive_to_start(), ])
- checkpoint¶
- step¶
- collected_resources() frozenset[str]¶
Return all resources this step and its children require.
Used by
validate_no_overlapfor static conflict detection at construction time. Leaf steps don’t need to override this — the default delegates torequired_resources. Composite steps override to union their children’s collected resources.
- async run_step(robot: GenericRobot) None¶
Record the wrapper step, then execute the child until the checkpoint.