接入 task HAL Web 仿真运行时
This commit is contained in:
@@ -131,6 +131,18 @@
|
||||
) {
|
||||
throw new Error(`LinuxCNC TP planner runtime did not load in browser worker: ${JSON.stringify(interpreterReadiness)}`);
|
||||
}
|
||||
const taskHalReadiness = await win.webRtcp5AxisSimulation.taskHalRuntimeReady;
|
||||
if (
|
||||
taskHalReadiness.loaded !== true ||
|
||||
taskHalReadiness.taskRuntimeReady !== true ||
|
||||
taskHalReadiness.motionRuntimeReady !== true ||
|
||||
taskHalReadiness.halRuntimeReady !== true
|
||||
) {
|
||||
throw new Error(`LinuxCNC task/HAL runtime did not load in browser: ${JSON.stringify(taskHalReadiness)}`);
|
||||
}
|
||||
if (taskHalReadiness.executionContext !== "worker") {
|
||||
throw new Error(`LinuxCNC task/HAL runtime should run in worker: ${JSON.stringify(taskHalReadiness)}`);
|
||||
}
|
||||
const state = win.webRtcp5AxisSimulation.getState();
|
||||
if (state.sourceMode !== "source-derived-kinematics-wasm") {
|
||||
throw new Error(`unexpected source mode: ${state.sourceMode}`);
|
||||
@@ -349,24 +361,9 @@
|
||||
if (machineFileRunState.fullExecutionBoundary?.machineFileBackedRemapReady !== true) {
|
||||
throw new Error(`full execution boundary did not record remap readiness: ${JSON.stringify(machineFileRunState.fullExecutionBoundary)}`);
|
||||
}
|
||||
if (machineFileRunState.fullExecutionBoundary?.fullLinuxCncProgramExecutionReady !== false) {
|
||||
throw new Error("full LinuxCNC program execution must remain blocked without native task/planner/HAL");
|
||||
}
|
||||
if (!machineFileRunState.fullExecutionBoundary.blockers.some((blocker) => blocker.includes("trajectory planner"))) {
|
||||
throw new Error("full execution boundary did not expose planner blocker");
|
||||
}
|
||||
if (!doc.querySelector('[data-full-execution-boundary="status"]')?.textContent.includes("remap ready")) {
|
||||
throw new Error("full execution boundary status did not render remap readiness");
|
||||
}
|
||||
if (!doc.querySelector('[data-full-execution-boundary="status"]')?.textContent.includes("full blocked")) {
|
||||
throw new Error("full execution boundary status did not render full blocked state");
|
||||
}
|
||||
if (!doc.querySelector('[data-full-execution-boundary="blockers"]')?.textContent.includes("native LinuxCNC task")) {
|
||||
throw new Error("full execution blocker diagnostic did not render native task blocker");
|
||||
}
|
||||
if (!doc.querySelector('[data-full-execution-boundary="evidence"]')?.textContent.includes("linuxcnc_machine_file_remap_ready_planner_task_hal_blocked")) {
|
||||
throw new Error("full execution evidence diagnostic did not render boundary semantic");
|
||||
}
|
||||
const savedSession = await win.webRtcp5AxisSimulation.saveSession();
|
||||
await wait(50);
|
||||
if (savedSession.snapshot.format !== "web-rtcp-5axis-session-snapshot") {
|
||||
@@ -383,18 +380,34 @@
|
||||
}
|
||||
|
||||
win.webRtcp5AxisSimulation.dispatch({ type: "RUN" });
|
||||
await wait(50);
|
||||
await wait(250);
|
||||
if (win.webRtcp5AxisSimulation.getState().runState !== "running") {
|
||||
throw new Error("RUN action did not update state after power on");
|
||||
}
|
||||
if (win.webRtcp5AxisSimulation.getState().programRuntimeFeedback?.sourceMode !== "linuxcnc-tp-runtime-sample") {
|
||||
throw new Error("RUN did not advance with LinuxCNC TP runtime feedback");
|
||||
if (win.webRtcp5AxisSimulation.getState().programRuntimeFeedback?.sourceMode !== "linuxcnc-task-motion-hal-wasm") {
|
||||
throw new Error("RUN did not advance with LinuxCNC task/HAL runtime feedback");
|
||||
}
|
||||
if (win.webRtcp5AxisSimulation.getState().feed.currentVelocity <= 0) {
|
||||
throw new Error("RUN did not expose LinuxCNC TP current velocity");
|
||||
throw new Error("RUN did not expose LinuxCNC task/HAL current velocity");
|
||||
}
|
||||
if (Number(doc.querySelector(".gcode-row.active")?.dataset.programLine || 0) < 2) {
|
||||
throw new Error("RUN did not highlight a LinuxCNC canonical motion line");
|
||||
throw new Error("RUN did not highlight a LinuxCNC task/HAL motion line");
|
||||
}
|
||||
const taskHalRunState = win.webRtcp5AxisSimulation.getState();
|
||||
if (taskHalRunState.fullExecutionBoundary?.semanticBoundary !== "linuxcnc_task_motion_hal_wasm_simulation_runtime") {
|
||||
throw new Error(`full execution boundary did not promote task/HAL simulation runtime: ${JSON.stringify(taskHalRunState.fullExecutionBoundary)}`);
|
||||
}
|
||||
if (taskHalRunState.fullExecutionBoundary?.fullLinuxCncProgramExecutionReady !== true) {
|
||||
throw new Error("full LinuxCNC program execution should be ready for Web simulation boundary");
|
||||
}
|
||||
if (!doc.querySelector('[data-full-execution-boundary="status"]')?.textContent.includes("full ready")) {
|
||||
throw new Error("full execution boundary status did not render full ready state");
|
||||
}
|
||||
if (!doc.querySelector('[data-task-hal-runtime="readiness"]')?.textContent.includes("sync")) {
|
||||
throw new Error("task/HAL readiness diagnostic did not render sync");
|
||||
}
|
||||
if (!doc.querySelector('[data-task-hal-runtime="cycles"]')?.textContent.includes("servo")) {
|
||||
throw new Error("task/HAL cycle diagnostic did not render servo cycle");
|
||||
}
|
||||
doc.querySelector('[data-action="PAUSE"]').click();
|
||||
await wait(50);
|
||||
|
||||
Reference in New Issue
Block a user