Add RTCP simulation QA updates
This commit is contained in:
@@ -63,11 +63,27 @@ assert.equal(state.rtcpState, "on");
|
||||
|
||||
store.dispatch({ type: "SET_MODE", mode: "manual" });
|
||||
await waitForTaskHal(store);
|
||||
store.dispatch({ type: "HOME" });
|
||||
state = store.getState();
|
||||
const homePose = { ...state.axisPose };
|
||||
assert.equal(homePose.x, 43);
|
||||
assert.equal(homePose.y, -32.15);
|
||||
assert.equal(homePose.z, -11.306);
|
||||
store.dispatch({ type: "JOG", axis: "x", direction: 1, increment: 0.5 });
|
||||
await waitForTaskHal(store);
|
||||
state = store.getState();
|
||||
assert.equal(state.taskHalStatus.motionStatus.motion.teleopMode, 1);
|
||||
assert.equal(state.programRuntimeFeedback.sourceMode, "linuxcnc-task-motion-hal-wasm");
|
||||
assertNear(state.axisPose.x, homePose.x + 0.5, "task/HAL JOG X+ should keep HOME work-pose continuity");
|
||||
assertNear(state.axisPose.y, homePose.y, "task/HAL JOG X+ should not reset Y");
|
||||
assertNear(state.axisPose.z, homePose.z, "task/HAL JOG X+ should not reset Z");
|
||||
|
||||
store.dispatch({ type: "JOG", axis: "y", direction: -1, increment: 0.5 });
|
||||
await waitForTaskHal(store);
|
||||
state = store.getState();
|
||||
assertNear(state.axisPose.x, homePose.x + 0.5, "task/HAL JOG Y- should not reset X");
|
||||
assertNear(state.axisPose.y, homePose.y - 0.5, "task/HAL JOG Y- should keep HOME work-pose continuity");
|
||||
assertNear(state.axisPose.z, homePose.z, "task/HAL JOG Y- should not reset Z");
|
||||
|
||||
store.dispatch({ type: "SET_MODE", mode: "auto" });
|
||||
await waitForTaskHal(store);
|
||||
@@ -94,3 +110,7 @@ async function waitForTaskHal(store) {
|
||||
}
|
||||
throw new Error("task/HAL store command did not settle");
|
||||
}
|
||||
|
||||
function assertNear(actual, expected, message) {
|
||||
assert.equal(Math.abs(Number(actual) - Number(expected)) < 1e-9, true, `${message}: ${actual} !== ${expected}`);
|
||||
}
|
||||
|
||||
@@ -428,4 +428,90 @@ assert.equal(state.machine.powerOn, false);
|
||||
assert.equal(state.machine.taskState, "estop-reset");
|
||||
assert.equal(state.operatorMessage, "estop reset; machine off");
|
||||
|
||||
const taskHalSwitchkinsStore = createSimulationStore({
|
||||
programStartLine: 1,
|
||||
activeLine: 5,
|
||||
kinsType: "tcp-xyzac",
|
||||
rtcpState: "on",
|
||||
programExecutionSourceMode: "linuxcnc-interpreter-wasm",
|
||||
programExecution: {
|
||||
sourceMode: "linuxcnc-interpreter-wasm",
|
||||
motion: [
|
||||
{
|
||||
type: "STRAIGHT_TRAVERSE",
|
||||
line: 5,
|
||||
axes: { x: 1, y: 2, z: 3, a: 10, c: 20 },
|
||||
switchkinsType: 1,
|
||||
kinsType: "tcp",
|
||||
},
|
||||
{
|
||||
type: "STRAIGHT_FEED",
|
||||
line: 20,
|
||||
axes: { x: 2, y: 3, z: 4, a: 0, c: 0 },
|
||||
switchkinsType: 0,
|
||||
kinsType: "identity",
|
||||
},
|
||||
],
|
||||
summary: {
|
||||
motionEventCount: 2,
|
||||
switchkinsEventCount: 2,
|
||||
switchkinsCodes: ["M428", "M429"],
|
||||
},
|
||||
},
|
||||
});
|
||||
taskHalSwitchkinsStore.dispatch({
|
||||
type: "TASK_HAL_STATUS_APPLIED",
|
||||
status: taskHalStatusForSwitchkinsLine({ activeLine: 5, switchkinsType: 0 }),
|
||||
operatorMessage: "task/HAL status retained program TCP switchkins",
|
||||
});
|
||||
state = taskHalSwitchkinsStore.getState();
|
||||
assert.equal(state.activeLine, 5);
|
||||
assert.equal(state.kinsType, "tcp-xyzac");
|
||||
assert.equal(state.rtcpState, "on");
|
||||
|
||||
taskHalSwitchkinsStore.dispatch({
|
||||
type: "TASK_HAL_STATUS_APPLIED",
|
||||
status: taskHalStatusForSwitchkinsLine({ activeLine: 20, switchkinsType: 0 }),
|
||||
operatorMessage: "task/HAL status applied program identity switchkins",
|
||||
});
|
||||
state = taskHalSwitchkinsStore.getState();
|
||||
assert.equal(state.activeLine, 20);
|
||||
assert.equal(state.kinsType, "identity");
|
||||
assert.equal(state.rtcpState, "off");
|
||||
|
||||
console.log("rtcp_store_smoke=ok");
|
||||
|
||||
function taskHalStatusForSwitchkinsLine({ activeLine, switchkinsType }) {
|
||||
return {
|
||||
semanticBoundary: "linuxcnc_task_motion_hal_wasm_simulation_runtime",
|
||||
task: {
|
||||
state: "ON",
|
||||
mode: "AUTO",
|
||||
interpState: "READING",
|
||||
execState: "WAITING_FOR_MOTION",
|
||||
},
|
||||
motionStatus: {
|
||||
motion: {
|
||||
programLine: activeLine,
|
||||
motionType: 1,
|
||||
switchkinsType,
|
||||
currentVel: 1,
|
||||
requestedVel: 1,
|
||||
inPosition: false,
|
||||
},
|
||||
},
|
||||
ui: {
|
||||
taskState: "on",
|
||||
taskMode: "auto",
|
||||
interpState: "reading",
|
||||
activeLine,
|
||||
switchkinsType,
|
||||
axisPoseFrame: "work",
|
||||
axisPose: { x: 1, y: 2, z: 3, a: 10, b: 0, c: 20 },
|
||||
currentVelocity: 60,
|
||||
servoCycle: 1,
|
||||
taskCycle: 1,
|
||||
motionQueueDepth: 1,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user