Repository navigation
Machine check: blocks the decoder reads as moving no axis command none (#369) - #370
Merged
Merged
Conversation
#369) Haas and FANUC headers clear the local shift with G52 X0 Y0 Z0, and Haas mirror image with G100 X0 Y0 Z0. Their axis letters are parameters, but the machine check counted them as words, so a start pose on the travel limits was held with the calibration interval and reported uncertain. The independent decoders now say which blocks set an offset or a mode without moving any axis (Rust Decoder::hold_axes / held, Python GCodeDecoder.hold_axes / held). The intent checker records it on the posted line (Line.holds_axes, omitted when false), and Session::chunk treats such a block as naming no axis. Classified, each from its manual: G52 zero (Haas NGC, FANUC 0i-MB, Centroid CNC12 mill/plasma/lathe, LNC), Haas G100 X0 Y0 Z0, Siemens 808D ISO G50.1 / G92.1 X0. Y0. Z0. Any other block naming an axis still commands it. The posts keep placed axes the same way: after decoding, a hook's blocks are tracked again without the held ones (Python _hold_placed, Rust hold_placed). Posted text does not change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Closes #369
Problem
Haas and FANUC headers write
G52 X0 Y0 Z0(clear the local shift), and Haas alsoG100 X0 Y0 Z0(cancel mirror image). The machine check counted those axis letters as words, so the axes they name lost their exact start pose. A start pose on the travel limits was then reporteduncertainat move None, even though no block commands an axis there. On main the new tests are refused with exactly the reported finding:axis X calibration interval -0.020000 to 0.020000 mm ... straddles the minimum 0.000000 mm, for both Haas NGC and FANUC 0i-MB.Rule
A block counts as moving nothing only when the independent decoder reads it that way. The decoder marks it while reading it (
hold_axes), the intent checker records the mark on the posted line (Line.holds_axes, serialized only when true), andSession::chunktreats a marked block as naming no axis. Every other block that names an axis letter still commands that axis (axis_words, unchanged), so the conservative rule stays the default.Decoders that now mark blocks, each citing its manual in the code:
G52zero, which sets or clears a coordinate shift and moves nothing:G100 X0 Y0 Z0: mirror-image cancel; the axis words choose the axes.G50.1 X0. Y0. Z0.andG92.1 X0. Y0. Z0.(ISO pp. 104–113).Post side
Placed axes (#368) follow the same reading. After decoding, the engines (Python
_format/_format_default, RustEngine::format) track a hook's blocks again without the marked ones (_hold_placed/hold_placed), and the Python and Rust implementations are identical. Today these blocks only appear inon_begin, which already places every axis, so posted text does not change: all golden and parity tests pass without edits.API
IntentChecker::{begin,consume,check_lowered,finish}_heldare added; the old functions delegate to them with nothing marked.IntentSessionand its methods take an optionalheld_json.GCodeDecoder.hold_axes()and.heldare added, and RustDecoder::heldlikewise.nc_lines()entries for marked lines now carryholds_axes: true._formatnow returns; only the unpacking changed.Tests
tests/machine.rsa_block_the_decoder_reads_as_moving_no_axis_commands_none: with the marks the header isclear; the same blocks unmarked areuncertain, so an unclassified block still counts.python/tests/test_placed_axes.pyOffsetBlockTest:clear. Both fail on main with the refusal quoted above.uncertain.ToolChangeTest.test_a_block_the_decoder_held_leaves_placed_axes_placedcovers the post-side tracking.G1 G43 H Z(pp. 199–206), and that Z word really commands Z, so with Z on its maximum the check is correctly uncertain there.Run locally (Linux only)
cargo test --profile ci --workspace --all-features --lib --tests: passed (497 lib, 679 integration).cargo fmt --check,ruff check,ruff format --check: passed.cargo clippy --workspace --all-targets --all-features -D warnings: local clippy 1.98 flagsneedless_range_loopinsrc/surface/spline_bounds.rs, which this PR does not touch. With that lint allowed it is clean. CI's 1.100 result is pending.test_packageentry checks); there are no other failures.🤖 Generated with Claude Code