simple_proportional


-- Measured surface contour: maps each sampled (x,y,z) point to its
-- height deviation from the target surface (mm).
-- Concretely a CSV with columns X, Y, Z, err_mm.
type SurfaceErrorMap = [((X, Y, Z), ZErr_mm)]

-- Primary signature of this module
simple_proportional_compensation :: (SurfaceErrorMap, GcodeProg) -> GcodeProg

Adjusts G-code feedrates for the next WAAM layer using surface-height errors measured on the previous layer, applying the proportional correction F_corrected = F_nominal * (1 + K_p * z_err_mm). Where the prior layer is too high the robot speeds up (depositing less material), and where it is too low the robot slows down.

Usage

uv run python simple_proportional.py <next_layer_to_be_corrected.gcode> <prev_layer_map__xyz_to_err_z.csv> [-k K_P] [-o output.gcode]