step.base

Attributes

StepAnomalyCallback

Classes

Step

Base async action executed by missions and higher-level step combinators.

Module Contents

step.base.StepAnomalyCallback
class step.base.Step

Bases: raccoon.class_name_logger.ClassNameLogger

Base async action executed by missions and higher-level step combinators.

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.

collected_resources() frozenset[str]

Return all resources this step and its children require.

Used by validate_no_overlap for static conflict detection at construction time. Leaf steps don’t need to override this — the default delegates to required_resources. Composite steps override to union their children’s collected resources.

resolve() Step

Return the concrete Step that should actually execute.

Default returns self. StepBuilder overrides this to call _build() so that fluent-DSL builders are converted into the underlying Step at composite-construction time. Composite steps call resolve() on their children before storing them so that validate_no_overlap and collected_resources see the real resource sets, not empty builder placeholders.

async run_step(robot: raccoon.robot.api.GenericRobot) None

Execute the step with logging and optional timing instrumentation.

When a per-step _anomaly_callback is set and a timing baseline exists, a background watchdog fires the callback as soon as the elapsed time exceeds the anomaly upper bound — even while the step is still running.

to_simulation_step() step.model.SimulationStep

Convert this step to a simulation-friendly summary.

The default implementation uses timing history only when it can query the tracker synchronously; otherwise it returns conservative defaults. Override in subclasses that know their motion delta or exact duration.