Skip to content

Machine check: blocks the decoder reads as moving no axis command none (#369) - #370

Merged
10-X-eng merged 1 commit into
mainfrom
fix/non-motion-axis-words
Nov 21, 2026
Merged

10-X-eng merged 1 commit into
mainfrom
fix/non-motion-axis-words

Conversation

@10-X-eng

Copy link
Copy Markdown
Contributor

Closes #369

Problem

Haas and FANUC headers write G52 X0 Y0 Z0 (clear the local shift), and Haas also G100 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 reported uncertain at 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), and Session::chunk treats 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:

  • G52 zero, which sets or clears a coordinate shift and moves nothing:
    • Haas NGC, Rust and Python (96-8210 Rev N)
    • FANUC 0i-MB (B-63844EN, local coordinate system, pp. 79–89)
    • Centroid CNC12 mill (12.20), plasma (same CNC12 G52) and lathe (9.17)
    • LNC (p. 48)
  • Haas G100 X0 Y0 Z0: mirror-image cancel; the axis words choose the axes.
  • Siemens 808D ISO G50.1 X0. Y0. Z0. and G92.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, Rust Engine::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 in on_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}_held are added; the old functions delegate to them with nothing marked.
  • IntentSession and its methods take an optional held_json.
  • GCodeDecoder.hold_axes() and .held are added, and Rust Decoder::held likewise.
  • nc_lines() entries for marked lines now carry holds_axes: true.
  • Two existing tests unpack the 6-tuple _format now returns; only the unpacking changed.

Tests

  • tests/machine.rs a_block_the_decoder_reads_as_moving_no_axis_commands_none: with the marks the header is clear; the same blocks unmarked are uncertain, so an unclassified block still counts.
  • python/tests/test_placed_axes.py OffsetBlockTest:
    • Haas NGC (Python and Rust posts) and FANUC 0i-MB from a home pose on the X/Y travel minimums, ±0.02 mm calibration: released clear. Both fail on main with the refusal quoted above.
    • A decoder subclass that marks nothing is refused uncertain.
  • ToolChangeTest.test_a_block_the_decoder_held_leaves_placed_axes_placed covers the post-side tracking.
  • In the FANUC case Z homes below its maximum. FANUC turns on the length offset with 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 flags needless_range_loop in src/surface/spline_bounds.rs, which this PR does not touch. With that lint allowed it is clean. CI's 1.100 result is pending.
  • Python suite: 1024 tests. All 150 errors come from CadQuery and numpy not being installed here (CAD adapter, test_package entry checks); there are no other failures.
  • Not run: doc tests, benchmarks (toolpaths unchanged), Windows/macOS.

🤖 Generated with Claude Code

#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>
@10-X-eng
10-X-eng added this pull request to the merge queue Nov 21, 2026
Merged via the queue into main with commit c67c47a Nov 21, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Machine check: a header block that names axis letters but moves nothing (G52 X0 Y0 Z0) counts as commanding them

1 participant