step.motion.path.compiler

PathCompiler — turns a list of Steps into a CompiledPlan.

The compiler is a thin orchestrator: it lowers the input Step tree into the IR via the lowering pass, then runs each subsequent CompilerPass in sequence on the resulting node list. The result is a CompiledPlan that the PathExecutor knows how to run.

Classes

CompilerPass

Pure transform on the path IR.

CompiledPlan

Result of compiling a Step tree.

PathCompiler

Orchestrates the compiler pipeline.

Module Contents

class step.motion.path.compiler.CompilerPass

Bases: Protocol

Pure transform on the path IR.

A pass takes a node list and returns a (possibly different) node list. Passes must preserve the “deferred placeholder” (None) entries so the executor can resolve them at runtime.

name: str
run(nodes: list[step.motion.path.ir.PathNode | None]) list[step.motion.path.ir.PathNode | None]
class step.motion.path.compiler.CompiledPlan

Result of compiling a Step tree.

nodes — the path IR after all passes ran. Spline mode lowers

to a single Segment(kind="spline") node here, so the executor walks it through the unified loop like any other opaque segment.

deferred(index, Defer) pairs for runtime resolution. passes_applied — names of passes that ran, for diagnostics.

nodes: list[step.motion.path.ir.PathNode | None]
deferred: list[tuple[int, step.logic.defer.Defer]]
passes_applied: list[str] = []
class step.motion.path.compiler.PathCompiler(passes: list[CompilerPass] | None = None)

Orchestrates the compiler pipeline.

Lowering is always run first (it produces the IR from the Step tree). The remaining passes are applied in the order given.

Example

>>> from raccoon.step.motion.path.passes import MergePass, CornerCutPass
>>> compiler = PathCompiler([MergePass(), CornerCutPass(0.05)])
>>> plan = compiler.compile([drive(50), turn(90), drive(30)])
compile(steps: list) CompiledPlan

Lower steps to IR and run all configured passes.