step.motion.path.passes

Compiler passes for the motion path pipeline.

Each pass is a callable transform from one IR node list to another. The default pipeline runs lowering → merge → corner-cut, with spline as an opt-in terminal transform.

Public API:

LoweringPass, MergePass, CornerCutPass, SplineConversionPass — pass classes optimize_nodes(nodes, *, merge, corner_cut_m) — legacy helper

Submodules

Functions

optimize_nodes(→ list[step.motion.path.ir.PathNode | None])

Apply optimization passes to a flattened path node list.

Package Contents

step.motion.path.passes.optimize_nodes(nodes: list[step.motion.path.ir.PathNode | None], *, merge: bool, corner_cut_m: float) list[step.motion.path.ir.PathNode | None]

Apply optimization passes to a flattened path node list.

SideAction and None (deferred) barriers are preserved and never optimized across — they pin the execution point of side effects and runtime-resolved steps.

Passes (applied in order when enabled):

  1. Merge (merge=True): collapse adjacent same-type segments that have no conditions and known endpoints. Same-axis/same-direction linears sum their distances; consecutive turns sum their angles.

  2. Corner cut (corner_cut_m > 0): replace linear + turn + linear triples with linear + arc + linear. The arc radius is derived from the cut distance via R = cut_m / tan(|θ| / 2).