完成 xyzbc-trt working 任务复核

This commit is contained in:
mes123456
2026-07-02 23:53:51 -04:00
parent b279fa17fd
commit 2722fe7f3c
33 changed files with 376795 additions and 171883 deletions

View File

@@ -134,6 +134,10 @@
if (!doc.querySelector('[data-action="mdi-input"]') || !doc.querySelector('[data-action="kins-tcp"]')) {
throw new Error("MDI input or switchkins TCP control missing from AXIS shell");
}
const statusbar = doc.querySelector('[data-region="statusbar"]');
if (!statusbar?.dataset.toolStatus?.startsWith("T2 P2")) {
throw new Error(`AXIS statusbar did not show active xyzbc tool: ${statusbar?.innerText || ""} / ${statusbar?.dataset.toolStatus || ""}`);
}
const buttonParity = api.getButtonParity();
if (!Array.isArray(buttonParity) || buttonParity.length < 50) {
@@ -317,6 +321,16 @@
doc.querySelector('[data-menu-command="run-ready"]').click();
await waitState((state) => state.machine.powerOn === true && state.machine.allHomed === true && state.machine.mode === "auto", "run-ready menu");
const beforeRun = api.getState();
await click('[data-action="run"]', "AXIS run");
const runState = await waitState((state) => (
(state.runState === "running" || state.runState === "complete")
&& state.programRuntimeFeedback
&& state.activeLine >= beforeRun.activeLine
), "program run execution");
if (runState.programExecutionSourceMode !== "linuxcnc-task-motion-hal-wasm") {
throw new Error(`RUN did not use task/HAL execution path: ${runState.programExecutionSourceMode}`);
}
}
async function readOpfsText(storage, path) {

View File

@@ -23,6 +23,7 @@ import {
applyToolCommandSequence,
createToolRuntimeState,
} from "../../app/src/runtime/tool-db-simulation.js";
import { buildAxisExecutionTraceFromProgram } from "../../app/src/runtime/axis-preview-path.js";
const profile = getFiveAxisProfile();
@@ -108,6 +109,49 @@ const selectedPlan = selectMachineFileProgram(
);
assert.equal(selectedPlan.selectedProgramFilename, "xyzbc_switchkins.ngc");
assert.ok(selectedPlan.wasmProgramPath.endsWith("/demos/xyzbc_switchkins.ngc"));
const selectedProgramFile = staged.save.files.find((file) => file.sourceRel === selectedPlan.selectedProgramSourceRel);
const semanticExecutionPath = buildAxisExecutionTraceFromProgram({
filename: selectedPlan.selectedProgramFilename,
sourceRel: selectedPlan.selectedProgramSourceRel,
content: selectedProgramFile.text,
});
assert.equal(semanticExecutionPath.status, "ok");
assert.equal(semanticExecutionPath.samplePeriodMs, 50);
assert.equal(semanticExecutionPath.sampleCount, 1300);
assert.equal(semanticExecutionPath.segmentCount, 29);
assert.equal(semanticExecutionPath.lineExecutionTrace.length, 64);
assert.equal(semanticExecutionPath.axisValuesByLine.length, 29);
assert.equal(semanticExecutionPath.gcodeExecutionProcess.status, "ok");
assert.equal(semanticExecutionPath.gcodeExecutionProcess.executionStepCount, 128);
assert.equal(semanticExecutionPath.gcodeExecutionProcess.sourceLineCoverage.length, 65);
assert.equal(semanticExecutionPath.gcodeExecutionProcess.summary.motionStepCount, 29);
assert.equal(semanticExecutionPath.gcodeExecutionProcess.summary.parameterAssignmentStepCount, 41);
assert.deepEqual(semanticExecutionPath.samples.find((sample) => sample.motionType === "arc").machineState.cutting, {
active: true,
cuttingSpeedMmPerMin: 1000,
});
assert.equal(semanticExecutionPath.samples[0].machineState.spindle.speedRpm, 0);
assert.equal(semanticExecutionPath.samples[0].machineState.coolant.flood, false);
assert.equal(semanticExecutionPath.samples[0].machineState.toolChange.activeTool, 2);
assert.equal(semanticExecutionPath.gcodeExecutionProcess.executionSteps.some((step) => (
step.sourceFile === "helix_bc.ngc"
&& step.line === 17
&& step.result.operation === "feed-helix"
&& step.result.motion?.endJoint?.b === 20
&& step.result.motion?.endJoint?.c === 45
&& step.result.motion?.endJoint?.z === 5
&& step.result.machineStateAfter?.cutting?.active === true
&& step.result.machineStateAfter?.feed?.actualMmPerMin === 1000
)), true);
assert.equal(semanticExecutionPath.axisValuesByLine.some((entry) => (
entry.sourceFile === "helix_bc.ngc"
&& entry.line === 17
&& entry.operation === "feed-helix"
&& entry.joint.b === 20
&& entry.joint.c === 45
&& entry.joint.z === 5
&& entry.machineState.cutting.cuttingSpeedMmPerMin === 1000
)), true);
const interpreter = await createLinuxCncInterpreterRuntime();
const execution = interpreter.runMachineFileProgram({
@@ -165,6 +209,15 @@ assert.equal(state.sessionName, "xyzbc-trt-web-session");
assert.equal(state.kinematicsRuntimeReadiness, null);
const storeStage = await store.stageMachineFiles({ storage: createMemorySessionStorage() });
assert.equal(store.getState().toolRuntimeState.ready, true);
assert.equal(store.getState().toolRuntimeState.currentTool.toolNumber, 0);
store.dispatch({
type: "LOAD_LINUXCNC_GCODE_SOURCE",
sourceRel: "configs/sim/axis/vismach/5axis/table-rotary-tilting/demos/xyzbc_switchkins.ngc",
});
assert.equal(store.getState().toolRuntimeState.activeToolNumber, 0);
assert.equal(store.getState().programAxisPreviewPath.samples[0].tool.id, 2);
assert.equal(store.getState().programAxisPreviewPath.samples[0].tool.diameter, 8);
const toolOffsetDb = applyToolCommandSequence(store.getState().toolDbSimulation, [
{ code: "T", toolNumber: 2 },
{ code: "M6" },