按规划持续工作

结论:五轴 TRT boat demo 已通过 LinuxCNC vendored remap/tool-table/file 执行路径纳入 native、Node WASM、browser 和 UI 验证,未在 JS 或自有代码中实现 M428/M429/M430 或运动学语义。
This commit is contained in:
2026-06-08 18:30:09 +08:00
parent 7cdfc458f9
commit c6c60c4866
9 changed files with 206 additions and 28 deletions

View File

@@ -14,6 +14,7 @@
#include "emc/rs274ngc/interp_internal.hh"
#include "linuxcnc_hal_adapter.hh"
#include "linuxcnc_tool_adapter.hh"
#include "tooldata.hh"
#ifndef LINUXCNC_VENDOR_DIR
#error "LINUXCNC_VENDOR_DIR must point at wasm-port/vendor/linuxcnc"
@@ -119,6 +120,16 @@ bool parse_machine_remaps(Interp &interp, const MachineCase &machine)
interp._setup.subroutines[0] = strstore(remap_dir.c_str());
bool ok = true;
if (auto tool_table = ini.findString("TOOL_TABLE", "EMCIO")) {
const auto tool_path = machine_dir / *tool_table;
tooldata_init(false);
tooldata_set_db(DB_NOTUSED);
const int tool_rc = tooldata_load(tool_path.c_str());
std::cout << machine.label << "_tool_table_load=" << tool_rc << "\n";
ok &= tool_rc == 0;
ok &= interp.load_tool_table() == INTERP_OK;
}
int remap_count = 0;
int line_number = 0;
while (auto remap = ini.findString(++remap_count, "REMAP", "RS274NGC")) {
@@ -305,12 +316,26 @@ int main()
"xyzac_switchkins_test_3.ngc",
0.0,
},
{
"boat_xyzac",
"configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/"
"boat-xyzac.ngc",
0.0,
},
{
"boat_xyzbc",
"configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/"
"boat-xyzbc.ngc",
0.0,
},
};
ok &= execute_demo_file(cases[0], demos[0]);
ok &= execute_demo_file(cases[1], demos[1]);
ok &= execute_demo_file(cases[0], demos[2]);
ok &= execute_demo_file(cases[0], demos[3]);
ok &= execute_demo_file(cases[0], demos[4]);
ok &= execute_demo_file(cases[1], demos[5]);
print_bool("fiveaxis_linuxcnc_remap_execute_path", ok);
return ok ? 0 : 1;

View File

@@ -287,6 +287,16 @@ bool parse_machine_remaps(Interp &interp, std::ostringstream &output, const char
interp._setup.subroutines[0] = strstore(remap_dir.c_str());
bool ok = true;
if (auto tool_table = ini.findString("TOOL_TABLE", "EMCIO")) {
const std::string tool_path = machine_dir + "/" + *tool_table;
tooldata_init(false);
tooldata_set_db(DB_NOTUSED);
const int tool_rc = tooldata_load(tool_path.c_str());
output << "fiveaxis_tool_table_load=" << tool_rc << "\n";
ok &= tool_rc == 0;
ok &= interp.load_tool_table() == INTERP_OK;
}
int remap_count = 0;
while (auto remap = ini.findString(++remap_count, "REMAP", "RS274NGC")) {
const int line_number = ini.lineOf(remap_count, "REMAP", "RS274NGC").second;

View File

@@ -165,6 +165,11 @@ async function writeFiveAxisTrtMachineFiles(interp) {
`${FIVEAXIS_TRT_SOURCE_PATH}/xyzac-trt.ini`,
`${FIVEAXIS_TRT_WASM_DIR}/xyzac-trt.ini`,
);
await writeFetchedTextFile(
interp,
`${FIVEAXIS_TRT_SOURCE_PATH}/xyzac-trt.tbl`,
`${FIVEAXIS_TRT_WASM_DIR}/xyzac-trt.tbl`,
);
for (const filename of FIVEAXIS_REMAP_FILES) {
await writeFetchedTextFile(
interp,
@@ -174,8 +179,8 @@ async function writeFiveAxisTrtMachineFiles(interp) {
}
await writeFetchedTextFile(
interp,
`${FIVEAXIS_TRT_SOURCE_PATH}/demos/xyzac_switchkins.ngc`,
`${FIVEAXIS_TRT_WASM_DIR}/demos/xyzac_switchkins.ngc`,
`${FIVEAXIS_TRT_SOURCE_PATH}/demos/boat-xyzac.ngc`,
`${FIVEAXIS_TRT_WASM_DIR}/demos/boat-xyzac.ngc`,
);
}
@@ -306,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/xyzac_switchkins.ngc`;
const programPath = `${FIVEAXIS_TRT_WASM_DIR}/demos/boat-xyzac.ngc`;
const result = interp.runFiveAxisRemapFile(programPath, iniPath);
setField("fiveaxisRemap", "ok");
setCanonicalEvents(result.trim());