From d40a4b3b6067addafe80a598052383f83221ad99 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Sun, 7 Jun 2026 16:42:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E6=8E=A8=E8=8D=90=E5=BB=BA=E8=AE=AE?= =?UTF-8?q?=EF=BC=8C=E7=BB=A7=E7=BB=AD=E6=89=A7=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:已接入 LinuxCNC NURBS G6 canonical 边界事件记录,并新增 G6.2 回归 fixture;原生 probe 验证通过。 --- wasm-port/docs/porting-steps-standalone.md | 6 +++++ .../linuxcnc_interp_minimal_runtime.cpp | 25 ++++++++++++++++++- .../fixtures/canon/nurbs_g6_semantics.events | 4 +++ .../fixtures/gcode/nurbs_g6_semantics.ngc | 5 ++++ 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 wasm-port/tests/fixtures/canon/nurbs_g6_semantics.events create mode 100644 wasm-port/tests/fixtures/gcode/nurbs_g6_semantics.ngc diff --git a/wasm-port/docs/porting-steps-standalone.md b/wasm-port/docs/porting-steps-standalone.md index ed4e46e..b5d77ed 100644 --- a/wasm-port/docs/porting-steps-standalone.md +++ b/wasm-port/docs/porting-steps-standalone.md @@ -409,6 +409,12 @@ Current verified progress: `tests/fixtures/gcode/nurbs_g5_semantics.ngc` and `tests/fixtures/canon/nurbs_g5_semantics.events` pin `G5.2` control-point collection and `G5.3` NURBS feed emission. +- `runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp` now records + NURBS G6 canonical boundary calls emitted by vendored + `interp_convert.cc::convert_nurbs()`: `NURBS_G6_FEED`. + `tests/fixtures/gcode/nurbs_g6_semantics.ngc` and + `tests/fixtures/canon/nurbs_g6_semantics.events` pin `G6.2` order, + interpolation mode, control-point, weight, and K segment handling. - `tests/fixtures/gcode_errors/g1_zero_feed.ngc` and `tests/fixtures/canon_errors/g1_zero_feed.expected` pin the negative `G1` zero-feed case. The source basis is LinuxCNC diff --git a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp index 3630783..67c0c56 100644 --- a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp +++ b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_minimal_runtime.cpp @@ -471,7 +471,30 @@ void NURBS_G5_FEED(int lineno, } standalone::push_canon_event(oss.str()); } -void NURBS_G6_FEED(int, const std::vector &, unsigned int, double, int, CANON_PLANE) {} +void NURBS_G6_FEED(int lineno, + const std::vector &control_points, + unsigned int k, + double feedrate, + int interpolation_mode, + CANON_PLANE plane) +{ + std::ostringstream oss; + oss << "NURBS_G6_FEED line=" << lineno + << " k=" << k + << " feedrate=" << feedrate + << " interpolation_mode=" << interpolation_mode + << " plane=" << static_cast(plane) + << " points=" << control_points.size(); + for (std::size_t index = 0; index < control_points.size(); ++index) { + const auto &point = control_points[index]; + oss << " p" << index + << "=(" << point.NURBS_X + << "," << point.NURBS_Y + << "," << point.NURBS_R + << "," << point.NURBS_K << ")"; + } + standalone::push_canon_event(oss.str()); +} void COMMENT(const char *s) { diff --git a/wasm-port/tests/fixtures/canon/nurbs_g6_semantics.events b/wasm-port/tests/fixtures/canon/nurbs_g6_semantics.events new file mode 100644 index 0000000..3e13626 --- /dev/null +++ b/wasm-port/tests/fixtures/canon/nurbs_g6_semantics.events @@ -0,0 +1,4 @@ +canon_event=SELECT_PLANE plane=1 +canon_event=STRAIGHT_TRAVERSE line=1 x=0 y=0 z=0 a=0 b=0 c=0 u=0 v=0 w=0 +canon_event=SET_FEED_RATE rate=50 +canon_event=NURBS_G6_FEED line=5 k=2 feedrate=50 interpolation_mode=1 plane=1 points=3 p0=(0,0,1,0) p1=(1,0,1,1) p2=(1,1,1,1) diff --git a/wasm-port/tests/fixtures/gcode/nurbs_g6_semantics.ngc b/wasm-port/tests/fixtures/gcode/nurbs_g6_semantics.ngc new file mode 100644 index 0000000..93274e5 --- /dev/null +++ b/wasm-port/tests/fixtures/gcode/nurbs_g6_semantics.ngc @@ -0,0 +1,5 @@ +G90 G17 G0 X0 Y0 Z0 +F50 +G6.2 P2 Q1 X0 Y0 R1 K0 +G6.2 X1 Y0 R1 K1 +G6.2 X1 Y1 R1 K1