diff --git a/wasm-port/docs/compatibility-validation.md b/wasm-port/docs/compatibility-validation.md index 8cb0bc6..43fe48e 100644 --- a/wasm-port/docs/compatibility-validation.md +++ b/wasm-port/docs/compatibility-validation.md @@ -113,6 +113,8 @@ file execution path. It also writes the vendored LinuxCNC `xyzac-trt` and `boat-xyzbc.ngc`, and `impeller-7bl-xyzac.ngc` demo files into the Emscripten filesystem. It also writes the vendored LinuxCNC `xyzab-tdr` table-dual-rotary INI, tool table, `remap_subs/*.ngc`, and `xyzab-tdr-demo.ngc` into the +Emscripten filesystem. It also writes the vendored LinuxCNC bridge-mill +`5axis.ini`, tool table, `remap_subs/*.ngc`, and `5axisgui.ngc` into the Emscripten filesystem. These checks validate 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 @@ -204,10 +206,11 @@ LinuxCNC `xyzac-trt`/`xyzbc-trt` INI, remap subroutines, and switchkins demo files, including the larger `boat-xyzac.ngc`, `boat-xyzbc.ngc`, and `impeller-7bl-xyzac.ngc` demos, into the browser WASM filesystem. It also writes vendored LinuxCNC `xyzab-tdr` machine files and `xyzab-tdr-demo.ngc` -into the browser WASM filesystem. The browser smoke verifies -`runFiveAxisRemapFile()` for the table-rotary-tilting and table-dual-rotary -sample machines through the exported LinuxCNC remap/tool-table/file execution -path. +into the browser WASM filesystem. It also writes vendored LinuxCNC bridge-mill +machine files and `5axisgui.ngc` into the browser WASM filesystem. The browser +smoke verifies `runFiveAxisRemapFile()` for the table-rotary-tilting, +table-dual-rotary, and bridge-mill 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 @@ -237,7 +240,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, plus the two-remap `M429 -> M428 -> M429` path in the `xyzab-tdr` sample machine. It 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`, `impeller-7bl-xyzac.ngc`, and `xyzab-tdr-demo.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, the two-remap `M429 -> M428 -> M429` path in the `xyzab-tdr` sample machine, and the bridge-mill `M429 -> M428 -> M430 -> M429` path where M428 selects the default bridge-mill kinematics. It 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`, `impeller-7bl-xyzac.ngc`, `xyzab-tdr-demo.ngc`, and `5axisgui.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 e96cc53..d434184 100644 --- a/wasm-port/docs/porting-steps-standalone.md +++ b/wasm-port/docs/porting-steps-standalone.md @@ -803,17 +803,21 @@ Current five-axis switchkins status: `M66` synchronization through the standalone HAL adapter boundary. 6. `linuxcnc_5axis_remap_execute_harness` executes the `xyzac-trt` and `xyzbc-trt` switchkins `M429 -> M428 -> M430 -> M429` paths plus the - `xyzab-tdr` two-remap `M429 -> M428 -> M429` path, loads vendored machine - tool tables through LinuxCNC `tooldata_load()`, and runs vendored - `xyzac_switchkins.ngc`, `xyzbc_switchkins.ngc`, + `xyzab-tdr` two-remap `M429 -> M428 -> M429` path and the bridge-mill + `M429 -> M428 -> M430 -> M429` path where M428 selects default + bridge-mill kinematics, loads 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`, `boat-xyzbc.ngc`, `impeller-7bl-xyzac.ngc`, and - `xyzab-tdr-demo.ngc` through LinuxCNC remap/file execution paths. + `xyzab-tdr-demo.ngc`, plus bridge-mill `5axisgui.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`, `impeller-7bl-xyzac.ngc`, and `xyzab-tdr-demo.ngc` - through the SDK C ABI without JavaScript M-code or kinematics semantics. + `boat-xyzbc.ngc`, `impeller-7bl-xyzac.ngc`, `xyzab-tdr-demo.ngc`, and + `5axisgui.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. @@ -823,8 +827,8 @@ Next work: 1. Continue broadening five-axis fixture coverage through the same source-backed execution boundary. 2. Evaluate additional vendored LinuxCNC five-axis sample machines and demos - after the TRT boat/impeller and TDR demo paths are stable in native, Node - WASM, browser, and UI remap paths. + after the TRT boat/impeller, TDR demo, and bridge-mill demo paths 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_execute_harness.cpp b/wasm-port/runtime/core/linuxcnc_wrap/linuxcnc_5axis_remap_execute_harness.cpp index 6ce2415..da82c23 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 @@ -27,6 +27,9 @@ struct MachineCase { const char *ini_rel; int expected_remaps; bool has_m430; + double m428_switchkins; + double m429_switchkins; + double m430_switchkins; }; struct DemoCase { @@ -281,12 +284,12 @@ bool check_machine(const MachineCase &machine) bool ok = parse_machine_remaps(interp, machine); ok &= read_hal_named(interp, machine.label, "_hal[motion.switchkins-type]", 0.0); - ok &= execute_step(interp, machine.label, "M429\n", 0.0); - ok &= execute_step(interp, machine.label, "M428\n", 1.0); + ok &= execute_step(interp, machine.label, "M429\n", machine.m429_switchkins); + ok &= execute_step(interp, machine.label, "M428\n", machine.m428_switchkins); if (machine.has_m430) { - ok &= execute_step(interp, machine.label, "M430\n", 2.0); + ok &= execute_step(interp, machine.label, "M430\n", machine.m430_switchkins); } - ok &= execute_step(interp, machine.label, "M429\n", 0.0); + ok &= execute_step(interp, machine.label, "M429\n", machine.m429_switchkins); print_bool(std::string(machine.label) + "_linuxcnc_remap_execute_path", ok); return ok; @@ -302,18 +305,36 @@ int main() "configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzac-trt.ini", 3, true, + 1.0, + 0.0, + 2.0, }, { "xyzbc_trt", "configs/sim/axis/vismach/5axis/table-rotary-tilting/xyzbc-trt.ini", 3, true, + 1.0, + 0.0, + 2.0, }, { "xyzab_tdr", "configs/sim/axis/vismach/5axis/table-dual-rotary/xyzab-tdr.ini", 2, false, + 1.0, + 0.0, + 0.0, + }, + { + "bridgemill", + "configs/sim/axis/vismach/5axis/bridgemill/5axis.ini", + 3, + true, + 0.0, + 1.0, + 2.0, }, }; @@ -371,6 +392,11 @@ int main() "xyzab-tdr-demo.ngc", 1.0, }, + { + "bridgemill_5axisgui", + "configs/sim/axis/vismach/5axis/bridgemill/5axisgui.ngc", + 0.0, + }, }; ok &= execute_demo_file(cases[0], demos[0]); @@ -381,6 +407,7 @@ int main() ok &= execute_demo_file(cases[1], demos[5]); ok &= execute_demo_file(cases[0], demos[6]); ok &= execute_demo_file(cases[2], demos[7]); + ok &= execute_demo_file(cases[3], demos[8]); print_bool("fiveaxis_linuxcnc_remap_execute_path", ok); return ok ? 0 : 1; diff --git a/wasm-port/tests/browser/interp_smoke.html b/wasm-port/tests/browser/interp_smoke.html index 7b0ed60..4a6a0dd 100644 --- a/wasm-port/tests/browser/interp_smoke.html +++ b/wasm-port/tests/browser/interp_smoke.html @@ -178,6 +178,26 @@ return wasmDir; } + async function writeFiveAxisBridgeMillMachineFiles(interp) { + const sourceDir = + "../../vendor/linuxcnc/configs/sim/axis/vismach/5axis/bridgemill"; + const wasmDir = "/work/browser-fiveaxis/bridgemill"; + const remapFiles = ["428remap.ngc", "429remap.ngc", "430remap.ngc"]; + + await writeFetchedTextFile(interp, `${sourceDir}/5axis.ini`, `${wasmDir}/5axis.ini`); + await writeFetchedTextFile(interp, `${sourceDir}/5axis.tbl`, `${wasmDir}/5axis.tbl`); + for (const filename of remapFiles) { + await writeFetchedTextFile( + interp, + `${sourceDir}/remap_subs/${filename}`, + `${wasmDir}/remap_subs/${filename}`, + ); + } + await writeFetchedTextFile(interp, `${sourceDir}/5axisgui.ngc`, `${wasmDir}/5axisgui.ngc`); + + return wasmDir; + } + async function verifyRejects(fixtureName, operation, expectedPattern) { try { await operation(); @@ -528,6 +548,31 @@ "fiveaxis_linuxcnc_remap_file_execute=1", ].join("\n"), ); + const fiveAxisBridgeMillDir = await writeFiveAxisBridgeMillMachineFiles(interp); + verifyExpectedOutput( + "browser_fiveaxis_bridgemill_5axisgui", + interp.runFiveAxisRemapFile( + `${fiveAxisBridgeMillDir}/5axisgui.ngc`, + `${fiveAxisBridgeMillDir}/5axis.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_parsed_remap_count=3", + "fiveaxis_remaps_ready=1", + "fiveaxis_file_open=0", + "fiveaxis_file_read_count=2197", + "fiveaxis_file_execute_count=2197", + "fiveaxis_file_finish_count=137", + "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 59f39ed..db747e6 100755 --- a/wasm-port/tests/native/verify_native_probes.sh +++ b/wasm-port/tests/native/verify_native_probes.sh @@ -310,6 +310,19 @@ grep -Fq "xyzab_tdr_M429_execute_1=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzab_tdr_M428_execute_0=2" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzab_tdr_M428_execute_1=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzab_tdr_linuxcnc_remap_execute_path=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_ini_open=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_parsed_remap_count=3" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_remaps_ready=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_M429_execute_0=2" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_M429_execute_1=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill__hal[motion.switchkins-type]: rc=0 found=1 value=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_M428_execute_0=2" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_M428_execute_1=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill__hal[motion.switchkins-type]: rc=0 found=1 value=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_M430_execute_0=2" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_M430_execute_1=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill__hal[motion.switchkins-type]: rc=0 found=1 value=2" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_linuxcnc_remap_execute_path=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzac_trt_xyzac_switchkins_file_open=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzac_trt_xyzac_switchkins_file_read_count=620" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzac_trt_xyzac_switchkins_file_execute_count=620" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" @@ -374,6 +387,14 @@ grep -Fq "xyzab_tdr_xyzab_tdr_demo_file_final_rc=1" "$FIVEAXIS_REMAP_EXECUTE_STD grep -Fq "xyzab_tdr_xyzab_tdr_demo_file_reached_exit=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzab_tdr_xyzab_tdr_demo__hal[motion.switchkins-type]: rc=0 found=1 value=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" grep -Fq "xyzab_tdr_xyzab_tdr_demo_linuxcnc_demo_file_execute=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui_file_open=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui_file_read_count=2197" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui_file_execute_count=2197" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui_file_finish_count=137" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui_file_final_rc=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui_file_reached_exit=1" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui__hal[motion.switchkins-type]: rc=0 found=1 value=0" "$FIVEAXIS_REMAP_EXECUTE_STDOUT" +grep -Fq "bridgemill_bridgemill_5axisgui_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 dc8430c..fdb766f 100644 --- a/wasm-port/tests/wasm/node/verify_interp_wasm.mjs +++ b/wasm-port/tests/wasm/node/verify_interp_wasm.mjs @@ -162,6 +162,28 @@ function writeFiveAxisTdrMachineFiles() { return wasmDir; } +function writeFiveAxisBridgeMillMachineFiles() { + const sourceDir = resolve( + rootDir, + "vendor/linuxcnc/configs/sim/axis/vismach/5axis/bridgemill", + ); + const wasmDir = "/work/fiveaxis/bridgemill"; + + writeVendorTextFile(resolve(sourceDir, "5axis.ini"), `${wasmDir}/5axis.ini`); + writeVendorTextFile(resolve(sourceDir, "5axis.tbl"), `${wasmDir}/5axis.tbl`); + for (const filename of readdirSync(resolve(sourceDir, "remap_subs"))) { + if (filename.endsWith(".ngc")) { + writeVendorTextFile( + resolve(sourceDir, "remap_subs", filename), + `${wasmDir}/remap_subs/${filename}`, + ); + } + } + writeVendorTextFile(resolve(sourceDir, "5axisgui.ngc"), `${wasmDir}/5axisgui.ngc`); + + return wasmDir; +} + const namedParamIniPath = "/work/namedparams.ini"; interp.writeTextFile( namedParamIniPath, @@ -519,6 +541,32 @@ verifyExpectedOutput( ].join("\n"), ); +const fiveAxisBridgeMillDir = writeFiveAxisBridgeMillMachineFiles(); +verifyExpectedOutput( + "fiveaxis_bridgemill_5axisgui_wasm", + interp.runFiveAxisRemapFile( + `${fiveAxisBridgeMillDir}/5axisgui.ngc`, + `${fiveAxisBridgeMillDir}/5axis.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_parsed_remap_count=3", + "fiveaxis_remaps_ready=1", + "fiveaxis_file_open=0", + "fiveaxis_file_read_count=2197", + "fiveaxis_file_execute_count=2197", + "fiveaxis_file_finish_count=137", + "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( parameterFilePath,