step.wait_for¶
Classes¶
Block until a stop condition is satisfied. |
Module Contents¶
- class step.wait_for.WaitFor(condition: step.condition.StopCondition)¶
Bases:
step.base.StepBlock until a stop condition is satisfied.
Initializes the condition, then polls it at 50 Hz until it returns True. This lets you reuse any composable
StopCondition— sensor triggers, timers, distance thresholds, or combinations — as a standalone wait without an accompanying motion.- Parameters:
condition – A
StopConditioninstance (or composition) to wait for. Supports the same|,&, and+operators as motion.until()clauses.
Example:
from raccoon.step import wait_for from raccoon.step.condition import on_black, after_seconds # Wait until the front-left IR sensor sees black wait_for(on_black(Defs.front.left)) # Wait for black OR a 5-second timeout wait_for(on_black(sensor) | after_seconds(5))