Skip to content

post: HSC tolerance bump + retract spindle lookahead#24

Open
CyberCraftLab wants to merge 3 commits into
mainfrom
fix/hsc-path-track-dev-0p5
Open

post: HSC tolerance bump + retract spindle lookahead#24
CyberCraftLab wants to merge 3 commits into
mainfrom
fix/hsc-path-track-dev-0p5

Conversation

@CyberCraftLab

@CyberCraftLab CyberCraftLab commented May 19, 2026

Copy link
Copy Markdown
Owner

Two related improvements to the KUKA CNC ISG post processor for clay extrusion.

1. HSC BSPLINE tolerances bumped 0.1 → 0.5 mm

`PostProcessor/KUKA_CNC_2_1_ISG_CCL_3DP_WIP_MS_S_INT_HSC_WAIT_S_DELAY.py:275`

At 0.1 mm the BSPLINE smoother had very little latitude to round corners between programmed waypoints. Fine for milling, overkill for clay extrusion where the bead naturally smooths over sub-millimetre detail and dense toolpath sampling produces many close-spaced corners. 0.5 mm gives the smoother more room while staying inside the bead's own footprint.

2. Retract spindle lookahead

New mechanism: when a `MoveJ` (rapid) arrives while the extruder is still on, treat it as the lift-off of a retract and:

  1. Back the `S1` command up by RETRACT_LOOKAHEAD_POINTS (default 10) MoveL waypoints — so clay flow has stopped before the nozzle leaves the print.
  2. Stash the active S value, then re-issue it before the next MoveL — so the extruder is flowing again by the time the plunge lands at the first print point.

Lets source G-code leave the spindle on continuously with one `M3 S` at program start; the post inserts the needed S transitions around every retract automatically. Reuses the same MoveL segment buffer the existing `EXTRUDER_OFF_DELAY_S` lead compensation already maintains.

Active S value is tracked in `RunCode` so the resume reflects the most recent setpoint, not a hardcoded constant.

Test plan

  • Load `BenchTests/lookahead_spindle_retract_test.nc` into RoboDK as a CNC project (three stacked 40×40 squares with two retracts in between, continuous `M3 S500`)
  • Run the PP and inspect the generated .nc:
    • `S1` should appear ~10 MoveL lines before each retract `G0 Z`
    • `S500` should appear right before the first print MoveL after each plunge
    • `#HSC ON [BSPLINE PATH_DEV 0.5000 TRACK_DEV 0.5000]` everywhere HSC mode opens
  • Run on the robot — confirm bead pressure-drop completes cleanly before lift-off, no clay drag between contours

🤖 Generated with Claude Code

CyberCraftLab and others added 2 commits May 19, 2026 22:07
The KUKA CNC ISG #HSC BSPLINE smoothing tolerances were emitted at 0.1
mm for both path and track deviation, which keeps the toolpath very
tight to the programmed points but allows little smoothing. Bumping
both to 0.5 mm gives the controller more latitude to round corners
during high-speed contouring — appropriate for clay extrusion where
the bead naturally smooths over sub-millimetre path detail and the
sharp corners of dense toolpath sampling can otherwise show as accel
spikes.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…r plunge

When a MoveJ arrives while the extruder is still on, treat it as the
lift-off of a retract: back the S1 command up by
RETRACT_LOOKAHEAD_POINTS (default 10) waypoints so clay flow has
stopped before the nozzle leaves the print, and stash the active S
value. The next MoveL after the retract re-issues that S value so
the extruder is flowing again by the time the plunge lands at the
first print point.

This lets source G-code leave the spindle on continuously with a
single M3 S<n> at program start — the post inserts the needed S1 /
S<n> transitions around each retract automatically.

Tracks the active extruder S value in RunCode (whenever S>1 is
emitted) so the resume value reflects the most recent setpoint
rather than a hardcoded constant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CyberCraftLab CyberCraftLab changed the title post: HSC BSPLINE PATH_DEV + TRACK_DEV at 0.5 mm post: HSC tolerance bump + retract spindle lookahead May 19, 2026
RoboDK's CNC machining import collapses G0 rapids into MoveL with a
faster feed rate — it never invokes MoveJ for inner retracts. The
previous lookahead implementation triggered on MoveJ and so silently
did nothing on real CNC-imported curves.

New trigger: a MoveL whose speed is more than RETRACT_SPEED_RATIO
(default 1.3) × the previous MoveL's speed marks a retract entry; a
MoveL whose speed has dropped back below the previous MoveL's speed
by the same ratio marks the first print point after the plunge. The
MoveJ-based trigger is kept as a defensive fallback for stations
that do emit MoveJ for retracts.

The N-back fallback in _inject_extruder_off_n_points_back was also
hardened: when the buffered print pass is shorter than the lookahead
(short contour), emit S1 inline rather than at the very start of the
pass — turning the extruder off for the entire short contour would
lose more than it saves.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant