From 4cd01deafb69c5d1263d8865025091a7bf045c38 Mon Sep 17 00:00:00 2001 From: wangdequan Date: Mon, 8 Jun 2026 18:37:22 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8C=89=E8=A7=84=E5=88=92=E6=8C=81=E7=BB=AD?= =?UTF-8?q?=E5=B7=A5=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 结论:已将 vendored LinuxCNC impeller-7bl-xyzac.ngc 纳入五轴 TRT remap/tool-table/file 执行 baseline,native、Node WASM、browser 和 UI 均通过同源验证,未实现自有 M428/M429/M430 或运动学语义。 --- wasm-port/docs/compatibility-validation.md | 23 ++++++++-------- wasm-port/docs/porting-steps-standalone.md | 14 +++++----- .../linuxcnc_5axis_remap_asset_probe.cpp | 6 +++++ .../linuxcnc_5axis_remap_execute_harness.cpp | 9 ++++++- .../linuxcnc_wrap/linuxcnc_interp_wasm.cpp | 2 +- wasm-port/runtime/ui/ini-panel/app.js | 6 ++--- wasm-port/tests/browser/ini_panel_smoke.html | 3 ++- wasm-port/tests/browser/interp_smoke.html | 27 +++++++++++++++++++ .../tests/native/verify_native_probes.sh | 8 ++++++ .../tests/wasm/node/verify_interp_wasm.mjs | 26 ++++++++++++++++++ 10 files changed, 100 insertions(+), 24 deletions(-) diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index d86f21a..15b389d 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -109,12 +109,13 @@ Emscripten filesystem through the SDK and runs them through LinuxCNC `Interp::open()`, `Interp::read()`, and `Interp::execute()` to validate the file execution path. It also writes the vendored LinuxCNC `xyzac-trt` and `xyzbc-trt` table-rotary-tilting sample machine INI, `remap_subs/*.ngc`, and -`xyzac_switchkins.ngc`/`xyzbc_switchkins.ngc` plus `boat-xyzac.ngc` and -`boat-xyzbc.ngc` demo files into the Emscripten filesystem, then validates the -WASM C ABI/SDK path for vendored LinuxCNC `REMAP` parsing, vendored LinuxCNC -tool-table loading from the machine INI, O-word remap execution, `M68`/`M66` -HAL synchronization, and file `open()`/`read()`/`execute()` completion -without JavaScript M-code or kinematics semantics. The same Node smoke writes +`xyzac_switchkins.ngc`/`xyzbc_switchkins.ngc`, `boat-xyzac.ngc`, +`boat-xyzbc.ngc`, and `impeller-7bl-xyzac.ngc` demo files into the Emscripten +filesystem, then validates the WASM C ABI/SDK path for vendored LinuxCNC +`REMAP` parsing, vendored LinuxCNC tool-table loading from the machine INI, +O-word remap execution, `M68`/`M66` HAL synchronization, and file +`open()`/`read()`/`execute()` completion without JavaScript M-code or +kinematics semantics. The same Node smoke writes LinuxCNC-format parameter files into the Emscripten filesystem and validates vendored `Interp::restore_parameters()` and `Interp::save_parameters()`, including the saved parameter values, missing required numeric parameter @@ -197,10 +198,10 @@ override INI-derived names before OPFS text is copied into the LinuxCNC-backed WASM filesystem, and that absent INI file-name values use the default OPFS parameter/tool-table paths in a real browser session. It also writes vendored LinuxCNC `xyzac-trt`/`xyzbc-trt` INI, remap subroutines, and switchkins demo -files, including the larger `boat-xyzac.ngc` and `boat-xyzbc.ngc` demos, into -the browser WASM filesystem and verifies `runFiveAxisRemapFile()` for both -sample machines through the exported LinuxCNC remap/tool-table/file execution -path. +files, including the larger `boat-xyzac.ngc`, `boat-xyzbc.ngc`, and +`impeller-7bl-xyzac.ngc` demos, into the browser WASM filesystem and verifies +`runFiveAxisRemapFile()` for both sample machines through the exported +LinuxCNC remap/tool-table/file execution path. The aggregate host smoke script builds the INI, interpreter-core, and trajectory-planner WASM artifacts once, then runs the Node WASM smokes, the @@ -230,7 +231,7 @@ The validation fails if: | `linuxcnc_interp_init_harness` | Validates vendored LinuxCNC `Interp::init()` emits canonical initialization boundaries, reads metric/inch machine units, and synchronizes current/selected tool slots through standalone status adapters. | | `linuxcnc_indexer_harness` | Validates vendored LinuxCNC single-axis rotary indexer dispatch emits lock/unlock and motion boundaries through the standalone event sink. | | `linuxcnc_remap_hal_sync_harness` | Validates vendored LinuxCNC `M68`/`M66` execution can drive the standalone HAL adapter boundary used by 5-axis switchkins remap files, including `_hal[motion.switchkins-type]` readback. | -| `linuxcnc_5axis_remap_execute_harness` | Validates vendored LinuxCNC `REMAP` parsing plus NGC remap execution for the 5-axis `M429 -> M428 -> M430 -> M429` switchkins path in the `xyzac-trt` and `xyzbc-trt` sample machines, loads vendored machine tool tables through LinuxCNC `tooldata_load()`, then runs vendored `xyzac_switchkins.ngc`, `xyzbc_switchkins.ngc`, `xyzac_switchkins_test_1.ngc`, `xyzac_switchkins_test_3.ngc`, `boat-xyzac.ngc`, and `boat-xyzbc.ngc` through the LinuxCNC file `open/read/execute` path. | +| `linuxcnc_5axis_remap_execute_harness` | Validates vendored LinuxCNC `REMAP` parsing plus NGC remap execution for the 5-axis `M429 -> M428 -> M430 -> M429` switchkins path in the `xyzac-trt` and `xyzbc-trt` sample machines, loads vendored machine tool tables through LinuxCNC `tooldata_load()`, then runs vendored `xyzac_switchkins.ngc`, `xyzbc_switchkins.ngc`, `xyzac_switchkins_test_1.ngc`, `xyzac_switchkins_test_3.ngc`, `boat-xyzac.ngc`, `boat-xyzbc.ngc`, and `impeller-7bl-xyzac.ngc` through the LinuxCNC file `open/read/execute` path. | | `linuxcnc_tp_api_probe` | Validates vendored LinuxCNC trajectory planner calls for linear, arc, and queued motion paths. | | `linuxcnc_kinematics_probe` | Validates vendored LinuxCNC `trivkins.c` plus `kins_util.c` initialize and perform identity forward/inverse mapping through the standalone HAL/RTAPI boundary. | | `linuxcnc_5axis_kinematics_probe` | Validates vendored LinuxCNC `5axiskins.c` through `switchkins.c`, including 5-axis forward/inverse round-trip behavior and switching to identity kinematics. | diff --git a/wasm-port/docs/porting-steps-standalone.md b/wasm-port/docs/porting-steps-standalone.md index 67462f9..ea56888 100644 --- a/wasm-port/docs/porting-steps-standalone.md +++ b/wasm-port/docs/porting-steps-standalone.md @@ -806,13 +806,13 @@ Current five-axis switchkins status: vendored machine tool tables through LinuxCNC `tooldata_load()`, and runs vendored `xyzac_switchkins.ngc`, `xyzbc_switchkins.ngc`, `xyzac_switchkins_test_1.ngc`, `xyzac_switchkins_test_3.ngc`, - `boat-xyzac.ngc`, and `boat-xyzbc.ngc` through LinuxCNC remap/file - execution paths. + `boat-xyzac.ngc`, `boat-xyzbc.ngc`, and `impeller-7bl-xyzac.ngc` through + LinuxCNC remap/file execution paths. 7. The WASM interpreter core now links vendored `interp_remap.cc` plus the Python-only runtime edge stub, and the Node WASM smoke runs vendored `xyzac_switchkins.ngc`, `xyzbc_switchkins.ngc`, `boat-xyzac.ngc`, and - `boat-xyzbc.ngc` through the SDK C ABI without JavaScript M-code or - kinematics semantics. + `boat-xyzbc.ngc`, plus `impeller-7bl-xyzac.ngc` through the SDK C ABI + without JavaScript M-code or kinematics semantics. 8. Browser smoke and the INI panel UI now expose the same validated 5-axis remap execution path by copying vendored LinuxCNC sample-machine files into the interpreter WASM filesystem and calling the SDK C ABI. @@ -821,9 +821,9 @@ Next work: 1. Continue broadening five-axis fixture coverage through the same source-backed execution boundary. -2. Evaluate remaining larger vendored LinuxCNC TRT demos such as impeller - after the boat demos are stable in native, Node WASM, browser, and UI - remap paths. +2. Evaluate additional vendored LinuxCNC five-axis sample machines and demos + after the TRT boat and impeller demos are stable in native, Node WASM, + browser, and UI remap paths. Involved LinuxCNC source: diff --git a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_asset_probe.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_asset_probe.cpp index 3aab30e..c15668e 100644 --- a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_asset_probe.cpp +++ b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_asset_probe.cpp @@ -229,6 +229,12 @@ int main() "configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/boat-xyzbc.ngc", true, true); + ok &= check_text_mcodes( + "xyzac_trt_impeller", + "configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/" + "impeller-7bl-xyzac.ngc", + true, + true); print_bool("fiveaxis_remap_assets_from_linuxcnc", ok); return ok ? 0 : 1; diff --git a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_execute_harness.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_execute_harness.cpp index 113e3f8..6833c18 100644 --- a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_execute_harness.cpp +++ b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_execute_harness.cpp @@ -53,7 +53,7 @@ void print_interp_error(Interp &interp, const std::string &label, int rc) std::cout << label << "_blocktext=" << interp._setup.blocktext << "\n"; } -constexpr int kMaxDemoFileSteps = 4096; +constexpr int kMaxDemoFileSteps = 8192; void seed_switchkins_hal() { @@ -328,6 +328,12 @@ int main() "boat-xyzbc.ngc", 0.0, }, + { + "impeller_7bl_xyzac", + "configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/" + "impeller-7bl-xyzac.ngc", + 0.0, + }, }; ok &= execute_demo_file(cases[0], demos[0]); @@ -336,6 +342,7 @@ int main() ok &= execute_demo_file(cases[0], demos[3]); ok &= execute_demo_file(cases[0], demos[4]); ok &= execute_demo_file(cases[1], demos[5]); + ok &= execute_demo_file(cases[0], demos[6]); print_bool("fiveaxis_linuxcnc_remap_execute_path", ok); return ok ? 0 : 1; diff --git a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_wasm.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_wasm.cpp index 8a0517e..dc5fe97 100644 --- a/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_wasm.cpp +++ b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_interp_wasm.cpp @@ -485,7 +485,7 @@ char *lcinterp_run_fiveaxis_remap_file(const char *path, const char *ini_path) return copy_result(output.str()); } - constexpr int max_file_steps = 4096; + constexpr int max_file_steps = 8192; int file_read_count = 0; int file_execute_count = 0; int file_finish_count = 0; diff --git a/wasm-port/runtime/ui/ini-panel/app.js b/wasm-port/runtime/ui/ini-panel/app.js index d30d842..d971856 100644 --- a/wasm-port/runtime/ui/ini-panel/app.js +++ b/wasm-port/runtime/ui/ini-panel/app.js @@ -179,8 +179,8 @@ async function writeFiveAxisTrtMachineFiles(interp) { } await writeFetchedTextFile( interp, - `${FIVEAXIS_TRT_SOURCE_PATH}/demos/boat-xyzac.ngc`, - `${FIVEAXIS_TRT_WASM_DIR}/demos/boat-xyzac.ngc`, + `${FIVEAXIS_TRT_SOURCE_PATH}/demos/impeller-7bl-xyzac.ngc`, + `${FIVEAXIS_TRT_WASM_DIR}/demos/impeller-7bl-xyzac.ngc`, ); } @@ -311,7 +311,7 @@ document.getElementById("run-fiveaxis-remap").addEventListener("click", async () const interp = requireInterpSdk(); await writeFiveAxisTrtMachineFiles(interp); const iniPath = `${FIVEAXIS_TRT_WASM_DIR}/xyzac-trt.ini`; - const programPath = `${FIVEAXIS_TRT_WASM_DIR}/demos/boat-xyzac.ngc`; + const programPath = `${FIVEAXIS_TRT_WASM_DIR}/demos/impeller-7bl-xyzac.ngc`; const result = interp.runFiveAxisRemapFile(programPath, iniPath); setField("fiveaxisRemap", "ok"); setCanonicalEvents(result.trim()); diff --git a/wasm-port/tests/browser/ini_panel_smoke.html b/wasm-port/tests/browser/ini_panel_smoke.html index 4897a5b..90e025f 100644 --- a/wasm-port/tests/browser/ini_panel_smoke.html +++ b/wasm-port/tests/browser/ini_panel_smoke.html @@ -374,7 +374,8 @@ TOOL_TABLE = browser-tool.tbl if ( !remapLog.includes("fiveaxis_ini_open=1") || !remapLog.includes("fiveaxis_tool_table_load=0") || - !remapLog.includes("fiveaxis_file_read_count=1927") || + !remapLog.includes("fiveaxis_file_read_count=4558") || + !remapLog.includes("fiveaxis_file_finish_count=2") || !remapLog.includes("fiveaxis_hal_switchkins: rc=0 found=1 value=0") || !remapLog.includes("fiveaxis_linuxcnc_remap_file_execute=1") ) { diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index 5339b82..6f8fe69 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -145,6 +145,11 @@ `${sourceDir}/demos/boat-xyzbc.ngc`, `${wasmDir}/demos/boat-xyzbc.ngc`, ); + await writeFetchedTextFile( + interp, + `${sourceDir}/demos/impeller-7bl-xyzac.ngc`, + `${wasmDir}/demos/impeller-7bl-xyzac.ngc`, + ); return wasmDir; } @@ -453,6 +458,28 @@ "fiveaxis_linuxcnc_remap_file_execute=1", ].join("\n"), ); + verifyExpectedOutput( + "browser_fiveaxis_impeller_7bl_xyzac", + interp.runFiveAxisRemapFile( + `${fiveAxisTrtDir}/demos/impeller-7bl-xyzac.ngc`, + `${fiveAxisTrtDir}/xyzac-trt.ini`, + ), + [ + "fiveaxis_ini_open=1", + "fiveaxis_tool_table_load=0", + "fiveaxis_parse_remap_1=0", + "fiveaxis_parse_remap_2=0", + "fiveaxis_parse_remap_3=0", + "fiveaxis_file_open=0", + "fiveaxis_file_read_count=4558", + "fiveaxis_file_execute_count=4558", + "fiveaxis_file_finish_count=2", + "fiveaxis_file_final_rc=1", + "fiveaxis_file_reached_exit=1", + "fiveaxis_hal_switchkins: rc=0 found=1 value=0", + "fiveaxis_linuxcnc_remap_file_execute=1", + ].join("\n"), + ); verifyExpectedOutput( "restore_parameters_missing_file", diff --git a/wasm-port/tests/native/verify_native_probes.sh b/wasm-port/tests/native/verify_native_probes.sh index ef10c80..2415c4d 100755 --- a/wasm-port/tests/native/verify_native_probes.sh +++ b/wasm-port/tests/native/verify_native_probes.sh @@ -350,6 +350,14 @@ grep -Fq "xyzbc_trt_boat_xyzbc_file_final_rc=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzbc_trt_boat_xyzbc_file_reached_exit=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzbc_trt_boat_xyzbc__hal[motion.switchkins-type]: rc=0 found=1 value=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzbc_trt_boat_xyzbc_linuxcnc_demo_file_execute=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac_file_open=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac_file_read_count=4558" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac_file_execute_count=4558" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac_file_finish_count=2" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac_file_final_rc=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac_file_reached_exit=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac__hal[motion.switchkins-type]: rc=0 found=1 value=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "xyzac_trt_impeller_7bl_xyzac_linuxcnc_demo_file_execute=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "fiveaxis_linuxcnc_remap_execute_path=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" NAMEDPARAM_STDOUT="$BUILD_DIR/linuxcnc_namedparam_harness.run.stdout.log" diff --git a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs index d3affcc..116c711 100644 --- a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs +++ b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs @@ -129,6 +129,10 @@ function writeFiveAxisTrtMachineFiles() { resolve(sourceDir, "demos/boat-xyzbc.ngc"), `${wasmDir}/demos/boat-xyzbc.ngc`, ); + writeVendorTextFile( + resolve(sourceDir, "demos/impeller-7bl-xyzac.ngc"), + `${wasmDir}/demos/impeller-7bl-xyzac.ngc`, + ); return wasmDir; } @@ -442,6 +446,28 @@ verifyExpectedOutput( "fiveaxis_linuxcnc_remap_file_execute=1", ].join("\n"), ); +verifyExpectedOutput( + "fiveaxis_impeller_7bl_xyzac_wasm", + interp.runFiveAxisRemapFile( + `${fiveAxisTrtDir}/demos/impeller-7bl-xyzac.ngc`, + `${fiveAxisTrtDir}/xyzac-trt.ini`, + ), + [ + "fiveaxis_ini_open=1", + "fiveaxis_tool_table_load=0", + "fiveaxis_parse_remap_1=0", + "fiveaxis_parse_remap_2=0", + "fiveaxis_parse_remap_3=0", + "fiveaxis_file_open=0", + "fiveaxis_file_read_count=4558", + "fiveaxis_file_execute_count=4558", + "fiveaxis_file_finish_count=2", + "fiveaxis_file_final_rc=1", + "fiveaxis_file_reached_exit=1", + "fiveaxis_hal_switchkins: rc=0 found=1 value=0", + "fiveaxis_linuxcnc_remap_file_execute=1", + ].join("\n"), +); const parameterFilePath = "/work/rs274ngc.var"; interp.writeTextFile(