Repository navigation
Description
Stage 1 Motion IR — slice S2a (the keystone). Part of #136. Depends on S1 + the golden freeze/harness (P0/P1).
plan_wind lowers to the Program IR and serialize(program, dialect) reproduces the validated cylinder G-code byte-for-byte. This makes motion math have one home (the lowering) and the dialect a true post-processor. Planner time is left on today's formula in this slice so the existing time tests remain an independent regression signal alongside the byte-equal diff (adopting O1 is S2b).
Scope
- Lowering builds
list[Move]+ProgramMetainstead of appending strings — move INTO the lowering: carriage segmentation (int(round(abs(carriage_delta)))+1, all-axis linear interpolation), the carry-forward all-axis completion move, thezero_axesmacro (→G92+ a real rotate-to-360RAPID+G92), the initRAPID(all-zero targets), the singleSET_FEED, and all comments (incl. the literal tab in helical pattern comments). -
serialize(program, dialect) -> list[str]owns:AxisMappingX/A/B letters,strip_precision(with defensive-0.0normalization),RAPIDemits all 3 axes in fixed CARRIAGE,MANDREL,DELIVERY order whileSET_POSITIONemits only its subset in caller order,G0/G92/;prefixes, the; Parameters {json}header (relocatedump_header's key-order/separators/int-normalization out ofconfig/schemas.py),sanitize_program, trailing newline. -
plan_windreturnsProgram;PlanResult.commands = serialize(program, dialect);LayerMetricsderived from the IR but using today's degrees+delivery time formula. - Do not emit
dialect.prologue(G21/G94).
Acceptance
- P1 byte-equal golden test green (empty G-code diff) for all frozen
.wind→.gcodepairs and the 4 layer fixtures. PlanResult.commandsbyte-identical to the P0 baseline (compare via thewrite_gcodetrailing-newline path, exact text).- Existing planner-time assertions UNCHANGED (joint proof that the refactor changed nothing).
machineno longer the authoritative string emitter for motion.
Byte-equality watch-list (from the investigation)
banker's-rounding segment count · fixed XAB order vs ordered G92 subset · header key-order/separators/int-normalization · trailing newline · embedded literal tab · -0.0/sub-epsilon negatives → preserve interpolate_coordinates and per-axis delta arithmetic in identical order (the primary guarantee; value+0.0 only catches exact -0.0).
Activity
test(planning): byte-equal .wind→.gcode golden harness + regenerator (#…
feat(planning): define the typed Motion IR (Move/MoveKind/Program/Pro…
refactor(planning): lower plan_wind to the Motion IR + serialize() to…
refactor(gcode): read G-code into the Motion IR at the CLI/API bounda…