Repository navigation
refactor(planning): lower plan_wind to the Motion IR + serialize() to G-code - #280
Merged
Merged
Conversation
… G-code S2a, the keystone of the Motion IR epic (#136): motion math now has a single home and G-code becomes a build artifact, with the validated cylinder output byte-identical (gated by tests/planning/test_example_goldens.py). - WinderMachine records a list[Move] (one per emitted line) instead of G-code strings. The strategies drive it exactly as before — carriage segmentation, all-axis completion, the zero_axes macro, and the time/tow accumulation stay here, so the IR is post-segmentation (one motion Move == one G0 line) and the motion math is not re-derived anywhere. - New fiberpath/gcode/serializer.py is the dialect post-processor and the ONLY place that knows axis letters, number formatting, and the `; Parameters` header (reproducing dump_header's key order, int-normalization, and compact separators). It never emits the dead G21/G94 prologue. - plan_wind builds a Program{meta, moves=[init_rapid, *recorded]} and returns serialize(program, dialect); the init line and header are now structural (a RAPID Move and ProgramMeta) rather than hand-built strings. Planner time is deliberately UNCHANGED in this slice (still the degrees+delivery formula), so the existing time assertions stay green and jointly prove — with the empty G-code diff — that the refactor changed nothing. Adopting the single O1 model is S2b (#275). get_gcode() is kept as a derived convenience (render each Move, no header) so the strategy-level layer fixtures pass untouched. Removed the unused add_raw_gcode escape hatch (no IR representation; only a unit test used it — retargeted to the mandrel accessor). Verified: byte-equal goldens (7), layer fixtures (10), sim/plot snapshot unchanged, full suite 138 passed; ruff/mypy clean; no OpenAPI drift. Part of #136. Closes #274.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #136 (Motion IR epic). Closes #274. S2a — the keystone. Motion math gets a single home and G-code becomes a build artifact, with the validated cylinder output byte-identical (gated by
test_example_goldens.py).The cutover
WinderMachinerecords alist[Move](one per emitted line) instead of G-code strings. The strategies drive it exactly as before — carriage segmentation, all-axis completion, thezero_axesmacro, and the time/tow accumulation stay here, so the IR is post-segmentation (one motionMove== oneG0line) and motion math is not re-derived anywhere.fiberpath/gcode/serializer.pyis the dialect post-processor and the only place that knows axis letters, number formatting, and the; Parametersheader (reproducingdump_header's key order + int-normalization + compact separators). It never emits the deadG21/G94prologue.plan_windbuildsProgram{meta, moves=[init_rapid, *recorded]}and returnsserialize(program, dialect); the init line and header are now structural (aRAPIDMove andProgramMeta) rather than hand-built strings.Time deliberately unchanged
Planner time stays on the degrees+delivery formula in this slice, so the existing time assertions stay green and — together with the empty G-code diff — jointly prove the refactor changed nothing. Adopting the single O1 model is S2b (#275).
Back-compat / cleanup
get_gcode()is kept as a derived convenience (render each Move, no header), so the strategy-level layer fixtures pass untouched. Removed the unusedadd_raw_gcodeescape hatch (no IR representation; only one unit test used it — retargeted to the mandrel accessor). Fully relocatingdump_headerout ofschemas.pyis deferred to S5.Verification (4 independent signals)
test_layer_strategies,test_helpers_machine): 10 passed via the derivedget_gcode().