docs: add axis run process working set
This commit is contained in:
@@ -1781,7 +1781,13 @@ export function createSimulationStore(seed = {}) {
|
||||
{ type: "EMC_TASK_PLAN_PAUSE" },
|
||||
], {
|
||||
operatorMessage: "task/HAL program paused",
|
||||
preserveMachine: pausedMachine,
|
||||
}).then((status) => {
|
||||
if (isTaskHalStatusPaused(status)) {
|
||||
startTaskHalStatusLoop({
|
||||
batchSize: 1,
|
||||
operatorMessage: "task/HAL paused status monitor running",
|
||||
});
|
||||
}
|
||||
}).catch(() => {});
|
||||
break;
|
||||
}
|
||||
@@ -1858,7 +1864,6 @@ export function createSimulationStore(seed = {}) {
|
||||
{ type: "EMC_TASK_PLAN_RESUME" },
|
||||
], {
|
||||
operatorMessage: "task/HAL program resumed",
|
||||
preserveMachine: resumedMachine,
|
||||
}).then((status) => {
|
||||
if (shouldContinueTaskHalStatusLoop(state, status)) {
|
||||
startTaskHalStatusLoop({
|
||||
@@ -2274,6 +2279,9 @@ export function createSimulationStore(seed = {}) {
|
||||
};
|
||||
|
||||
const refreshAsyncKinematicsFrame = async ({ operatorMessage = state.operatorMessage } = {}) => {
|
||||
if (state.taskHalPauseLock?.active === true || isTaskHalRunPausedByOperator(state)) {
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
if (state.desiredFrameSourceMode !== "source-derived-kinematics-wasm") {
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
@@ -2296,6 +2304,14 @@ export function createSimulationStore(seed = {}) {
|
||||
if (state.asyncFrameRefreshSequence !== sequence) {
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
if (state.taskHalPauseLock?.active === true || isTaskHalRunPausedByOperator(state)) {
|
||||
state = {
|
||||
...state,
|
||||
asyncFrameRefreshPending: false,
|
||||
};
|
||||
notify();
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
const frame = buildRtcpFrame({
|
||||
axisPose: state.axisPose,
|
||||
activeLine: state.activeLine,
|
||||
@@ -2988,6 +3004,7 @@ export function createSimulationStore(seed = {}) {
|
||||
};
|
||||
|
||||
const scheduleAsyncKinematicsRefresh = () => {
|
||||
if (state.taskHalPauseLock?.active === true || isTaskHalRunPausedByOperator(state)) return null;
|
||||
if (state.asyncFrameRefreshPending) return null;
|
||||
if (state.desiredFrameSourceMode !== "source-derived-kinematics-wasm") return null;
|
||||
if (!state.kinematicsRuntime?.loaded || !isAsyncKinematicsRuntime(state.kinematicsRuntime)) return null;
|
||||
@@ -3779,43 +3796,44 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const ui = status?.ui || {};
|
||||
const task = status?.task || {};
|
||||
const motion = status?.motionStatus?.motion || {};
|
||||
const pauseLock = state.taskHalPauseLock?.active === true ? state.taskHalPauseLock : null;
|
||||
const statusInterpState = normalizeTaskHalInterpState(ui.interpState || task.interpState);
|
||||
const statusMotionPaused = ui.motionPaused === true || motion.paused === true;
|
||||
const statusTaskPaused = ui.taskPaused === true || task.taskPaused === true;
|
||||
const statusPaused = statusInterpState === "paused" || statusMotionPaused || statusTaskPaused;
|
||||
const rawTaskState = normalizeTaskHalTaskState(ui.taskState || task.state);
|
||||
const taskState = preserveMachine?.powerOn && rawTaskState === "estop-reset"
|
||||
? "on"
|
||||
: rawTaskState;
|
||||
const taskMode = pauseLock
|
||||
const taskMode = statusPaused
|
||||
? programControlModeForMachine(state.machine)
|
||||
: normalizeLinuxCncTaskMode(preserveMachine?.mode || ui.taskMode || task.mode || state.machine.mode);
|
||||
const manualPanel = taskMode === "manual"
|
||||
? (preserveMachine?.manualPanel || state.machine.manualPanel || "manual")
|
||||
: null;
|
||||
const interpState = pauseLock
|
||||
const interpState = statusPaused
|
||||
? "paused"
|
||||
: Object.hasOwn(preserveMachine || {}, "interpState")
|
||||
? normalizeTaskHalInterpState(preserveMachine.interpState)
|
||||
: normalizeTaskHalInterpState(ui.interpState || task.interpState);
|
||||
: statusInterpState;
|
||||
const allHomed = Boolean(preserveMachine?.allHomed ?? state.machine.allHomed);
|
||||
const activeLine = state.programStartLine + Math.max(Number(ui.activeLine || 1) - 1, 0);
|
||||
const kinsType = resolveTaskHalKinsType(state, status, activeLine);
|
||||
const motionPaused = Boolean(pauseLock) ||
|
||||
ui.motionPaused === true ||
|
||||
motion.paused === true ||
|
||||
preserveMachine?.motionPaused === true;
|
||||
const taskPaused = ui.taskPaused === true || task.taskPaused === true || preserveMachine?.taskPaused === true;
|
||||
const paused = Boolean(pauseLock) || interpState === "paused" || motionPaused || taskPaused;
|
||||
const motionPaused = statusMotionPaused || preserveMachine?.motionPaused === true;
|
||||
const taskPaused = statusTaskPaused || preserveMachine?.taskPaused === true;
|
||||
const paused = interpState === "paused" || motionPaused || taskPaused;
|
||||
const interpResumeState = normalizeTaskHalInterpState(
|
||||
ui.interpResumeState ||
|
||||
task.interpResumeState ||
|
||||
(paused ? state.machine.interpResumeState || "reading" : interpState),
|
||||
);
|
||||
const axisPose = pauseLock?.axisPose
|
||||
? clampAxisPoseToProfile(pauseLock.axisPose, state.profile)
|
||||
: paused
|
||||
? clampAxisPoseToProfile(state.axisPose, state.profile)
|
||||
const displayPauseLock = paused && state.taskHalPauseLock?.active === true
|
||||
? state.taskHalPauseLock
|
||||
: null;
|
||||
const axisPose = displayPauseLock?.axisPose
|
||||
? clampAxisPoseToProfile(displayPauseLock.axisPose, state.profile)
|
||||
: preserveAxisPose
|
||||
? clampAxisPoseToProfile({ ...state.axisPose, ...preserveAxisPose }, state.profile)
|
||||
: resolveTaskHalAxisPose(state, status);
|
||||
: resolveTaskHalAxisPose(state, status, { paused, runState: state.runState });
|
||||
const currentVelocity = paused
|
||||
? 0
|
||||
: Number.isFinite(ui.currentVelocity)
|
||||
@@ -3841,9 +3859,9 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const shouldTrackProgramPlayback = runState === "running"
|
||||
|| runState === "mdi"
|
||||
|| (runState === "complete" && (state.runState === "running" || state.runState === "mdi" || state.runState === "complete"));
|
||||
const taskHalSampleIndex = pauseLock
|
||||
const taskHalSampleIndex = displayPauseLock
|
||||
? clampNumber(
|
||||
pauseLock.sampleIndex,
|
||||
displayPauseLock.sampleIndex,
|
||||
0,
|
||||
Math.max(Number(state.programAxisPreviewPath?.samples?.length || state.programAxisPreviewPath?.sampleCount || 1) - 1, 0),
|
||||
)
|
||||
@@ -3857,15 +3875,15 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const idleRuntimeFeedback = {
|
||||
...runtimeFeedback,
|
||||
sampleIndex: taskHalSampleIndex,
|
||||
motionIndex: pauseLock
|
||||
? Number(pauseLock.motionIndex || 0)
|
||||
motionIndex: displayPauseLock
|
||||
? Number(displayPauseLock.motionIndex || 0)
|
||||
: Number(state.programExecutionMotionIndex || runtimeFeedback.motionIndex || 0),
|
||||
...(paused ? {
|
||||
axisPose,
|
||||
tcp: {
|
||||
x: Number(state.tcpPose?.x ?? axisPose.x ?? 0),
|
||||
y: Number(state.tcpPose?.y ?? axisPose.y ?? 0),
|
||||
z: Number(state.tcpPose?.z ?? axisPose.z ?? 0),
|
||||
x: Number(displayPauseLock?.tcpPose?.x ?? state.tcpPose?.x ?? axisPose.x ?? 0),
|
||||
y: Number(displayPauseLock?.tcpPose?.y ?? state.tcpPose?.y ?? axisPose.y ?? 0),
|
||||
z: Number(displayPauseLock?.tcpPose?.z ?? state.tcpPose?.z ?? axisPose.z ?? 0),
|
||||
},
|
||||
} : {}),
|
||||
};
|
||||
@@ -3875,12 +3893,12 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
axisPose,
|
||||
kinsType,
|
||||
rtcpState: rtcpStateFromKinsType(kinsType),
|
||||
motionIndex: pauseLock ? Number(pauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
motionIndex: displayPauseLock ? Number(displayPauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
sampleIndex: taskHalSampleIndex,
|
||||
runtimeFeedback: {
|
||||
...runtimeFeedback,
|
||||
sampleIndex: taskHalSampleIndex,
|
||||
motionIndex: pauseLock ? Number(pauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
motionIndex: displayPauseLock ? Number(displayPauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
axisPose,
|
||||
currentVelocityMmPerMin: paused ? 0 : runtimeFeedback.currentVelocityMmPerMin,
|
||||
requestedVelocityMmPerMin: paused ? 0 : runtimeFeedback.requestedVelocityMmPerMin,
|
||||
@@ -3900,6 +3918,8 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
? createProgramUiExecution({
|
||||
...state,
|
||||
axisPose,
|
||||
tcpPose: displayPauseLock?.tcpPose || state.tcpPose,
|
||||
rtcpFrame: displayPauseLock?.rtcpFrame || state.rtcpFrame,
|
||||
kinsType: kinsType || state.kinsType,
|
||||
programExecutionSampleIndex: taskHalSampleIndex,
|
||||
programRuntimeFeedback: idleRuntimeFeedback,
|
||||
@@ -3909,7 +3929,7 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const loopActive = state.taskHalStatusLoop?.active === true
|
||||
&& loopSequence !== null
|
||||
&& Number(state.taskHalStatusLoop.sequence) === Number(loopSequence)
|
||||
&& (runState === "running" || runState === "mdi");
|
||||
&& (runState === "running" || runState === "mdi" || runState === "paused");
|
||||
const nextTickCount = loopActive ? Number(state.taskHalStatusLoop.tickCount || 0) + 1 : Number(state.taskHalStatusLoop?.tickCount || 0);
|
||||
const feedbackHistory = [taskHalPlaybackPatch.programRuntimeFeedback, ...(state.programRuntimeFeedbackHistory || [])].slice(0, 100);
|
||||
const lineStatus = runState === "complete"
|
||||
@@ -3921,10 +3941,15 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
return {
|
||||
taskHalStatus: status,
|
||||
taskHalExecutionPending: false,
|
||||
taskHalPauseLock: pauseLock ? { ...pauseLock, lastStatusAt: new Date().toISOString() } : state.taskHalPauseLock,
|
||||
taskHalPauseLock: displayPauseLock ? { ...displayPauseLock, lastStatusAt: new Date().toISOString() } : null,
|
||||
taskHalFallbackReason: null,
|
||||
pendingJogCommand: null,
|
||||
...taskHalPlaybackPatch,
|
||||
...(displayPauseLock ? {
|
||||
tcpPose: displayPauseLock.tcpPose,
|
||||
rtcpFrame: displayPauseLock.rtcpFrame,
|
||||
dro: displayPauseLock.dro,
|
||||
} : {}),
|
||||
programExecutionSourceMode: "linuxcnc-task-motion-hal-wasm",
|
||||
machine: {
|
||||
...state.machine,
|
||||
@@ -3978,9 +4003,26 @@ function shouldContinueTaskHalStatusLoop(state = {}, status = {}) {
|
||||
const openedProgramLineCount = Number(task.openedSourceLineCount || task.openedLineCount || 1);
|
||||
const complete = interpState === "idle"
|
||||
&& Number(task.nextProgramLine || 0) >= openedProgramLineCount;
|
||||
if (paused) {
|
||||
return state.runState === "paused" ||
|
||||
state.machine?.interpState === "paused" ||
|
||||
state.machine?.taskPaused === true ||
|
||||
state.machine?.motionPaused === true;
|
||||
}
|
||||
return !aborted && !paused && !complete && (interpState === "reading" || taskMode === "mdi");
|
||||
}
|
||||
|
||||
function isTaskHalStatusPaused(status = {}) {
|
||||
const ui = status?.ui || {};
|
||||
const task = status?.task || {};
|
||||
const motion = status?.motionStatus?.motion || {};
|
||||
return normalizeTaskHalInterpState(ui.interpState || task.interpState) === "paused" ||
|
||||
ui.motionPaused === true ||
|
||||
ui.taskPaused === true ||
|
||||
motion.paused === true ||
|
||||
task.taskPaused === true;
|
||||
}
|
||||
|
||||
function isTaskHalRunPausedByOperator(state = {}) {
|
||||
return state.runState === "paused"
|
||||
|| state.machine?.interpState === "paused"
|
||||
@@ -4024,6 +4066,8 @@ function createTaskHalPauseLock(state = {}, source = "pause") {
|
||||
y: Number(state.tcpPose?.y || 0),
|
||||
z: Number(state.tcpPose?.z || 0),
|
||||
},
|
||||
rtcpFrame: state.rtcpFrame,
|
||||
dro: state.dro,
|
||||
semanticBoundary: "linuxcnc_axis_task_pauseresume_freezes_task_hal_status_until_resume",
|
||||
};
|
||||
}
|
||||
@@ -4104,7 +4148,7 @@ function programMotionAtOrBeforeLine(state, activeLine) {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
function resolveTaskHalAxisPose(state, status) {
|
||||
function resolveTaskHalAxisPose(state, status, { paused = false, runState = state.runState } = {}) {
|
||||
const ui = status?.ui || {};
|
||||
const axisPose = ui.axisPose;
|
||||
if (!axisPose || typeof axisPose !== "object") {
|
||||
@@ -4127,6 +4171,10 @@ function resolveTaskHalAxisPose(state, status) {
|
||||
return addAxisDelta(state.axisPose, ui.axisPoseDelta, state.profile);
|
||||
}
|
||||
|
||||
if (!paused && runState !== "running" && runState !== "mdi" && !isJogStatus(status)) {
|
||||
return state.axisPose;
|
||||
}
|
||||
|
||||
if (!ui.axisPoseFrame && wouldResetNonZeroPoseToLocalZero(state.axisPose, axisPose)) {
|
||||
return state.axisPose;
|
||||
}
|
||||
|
||||
@@ -1781,7 +1781,13 @@ export function createSimulationStore(seed = {}) {
|
||||
{ type: "EMC_TASK_PLAN_PAUSE" },
|
||||
], {
|
||||
operatorMessage: "task/HAL program paused",
|
||||
preserveMachine: pausedMachine,
|
||||
}).then((status) => {
|
||||
if (isTaskHalStatusPaused(status)) {
|
||||
startTaskHalStatusLoop({
|
||||
batchSize: 1,
|
||||
operatorMessage: "task/HAL paused status monitor running",
|
||||
});
|
||||
}
|
||||
}).catch(() => {});
|
||||
break;
|
||||
}
|
||||
@@ -1858,7 +1864,6 @@ export function createSimulationStore(seed = {}) {
|
||||
{ type: "EMC_TASK_PLAN_RESUME" },
|
||||
], {
|
||||
operatorMessage: "task/HAL program resumed",
|
||||
preserveMachine: resumedMachine,
|
||||
}).then((status) => {
|
||||
if (shouldContinueTaskHalStatusLoop(state, status)) {
|
||||
startTaskHalStatusLoop({
|
||||
@@ -2274,6 +2279,9 @@ export function createSimulationStore(seed = {}) {
|
||||
};
|
||||
|
||||
const refreshAsyncKinematicsFrame = async ({ operatorMessage = state.operatorMessage } = {}) => {
|
||||
if (state.taskHalPauseLock?.active === true || isTaskHalRunPausedByOperator(state)) {
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
if (state.desiredFrameSourceMode !== "source-derived-kinematics-wasm") {
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
@@ -2296,6 +2304,14 @@ export function createSimulationStore(seed = {}) {
|
||||
if (state.asyncFrameRefreshSequence !== sequence) {
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
if (state.taskHalPauseLock?.active === true || isTaskHalRunPausedByOperator(state)) {
|
||||
state = {
|
||||
...state,
|
||||
asyncFrameRefreshPending: false,
|
||||
};
|
||||
notify();
|
||||
return state.rtcpFrame;
|
||||
}
|
||||
const frame = buildRtcpFrame({
|
||||
axisPose: state.axisPose,
|
||||
activeLine: state.activeLine,
|
||||
@@ -2988,6 +3004,7 @@ export function createSimulationStore(seed = {}) {
|
||||
};
|
||||
|
||||
const scheduleAsyncKinematicsRefresh = () => {
|
||||
if (state.taskHalPauseLock?.active === true || isTaskHalRunPausedByOperator(state)) return null;
|
||||
if (state.asyncFrameRefreshPending) return null;
|
||||
if (state.desiredFrameSourceMode !== "source-derived-kinematics-wasm") return null;
|
||||
if (!state.kinematicsRuntime?.loaded || !isAsyncKinematicsRuntime(state.kinematicsRuntime)) return null;
|
||||
@@ -3779,43 +3796,44 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const ui = status?.ui || {};
|
||||
const task = status?.task || {};
|
||||
const motion = status?.motionStatus?.motion || {};
|
||||
const pauseLock = state.taskHalPauseLock?.active === true ? state.taskHalPauseLock : null;
|
||||
const statusInterpState = normalizeTaskHalInterpState(ui.interpState || task.interpState);
|
||||
const statusMotionPaused = ui.motionPaused === true || motion.paused === true;
|
||||
const statusTaskPaused = ui.taskPaused === true || task.taskPaused === true;
|
||||
const statusPaused = statusInterpState === "paused" || statusMotionPaused || statusTaskPaused;
|
||||
const rawTaskState = normalizeTaskHalTaskState(ui.taskState || task.state);
|
||||
const taskState = preserveMachine?.powerOn && rawTaskState === "estop-reset"
|
||||
? "on"
|
||||
: rawTaskState;
|
||||
const taskMode = pauseLock
|
||||
const taskMode = statusPaused
|
||||
? programControlModeForMachine(state.machine)
|
||||
: normalizeLinuxCncTaskMode(preserveMachine?.mode || ui.taskMode || task.mode || state.machine.mode);
|
||||
const manualPanel = taskMode === "manual"
|
||||
? (preserveMachine?.manualPanel || state.machine.manualPanel || "manual")
|
||||
: null;
|
||||
const interpState = pauseLock
|
||||
const interpState = statusPaused
|
||||
? "paused"
|
||||
: Object.hasOwn(preserveMachine || {}, "interpState")
|
||||
? normalizeTaskHalInterpState(preserveMachine.interpState)
|
||||
: normalizeTaskHalInterpState(ui.interpState || task.interpState);
|
||||
: statusInterpState;
|
||||
const allHomed = Boolean(preserveMachine?.allHomed ?? state.machine.allHomed);
|
||||
const activeLine = state.programStartLine + Math.max(Number(ui.activeLine || 1) - 1, 0);
|
||||
const kinsType = resolveTaskHalKinsType(state, status, activeLine);
|
||||
const motionPaused = Boolean(pauseLock) ||
|
||||
ui.motionPaused === true ||
|
||||
motion.paused === true ||
|
||||
preserveMachine?.motionPaused === true;
|
||||
const taskPaused = ui.taskPaused === true || task.taskPaused === true || preserveMachine?.taskPaused === true;
|
||||
const paused = Boolean(pauseLock) || interpState === "paused" || motionPaused || taskPaused;
|
||||
const motionPaused = statusMotionPaused || preserveMachine?.motionPaused === true;
|
||||
const taskPaused = statusTaskPaused || preserveMachine?.taskPaused === true;
|
||||
const paused = interpState === "paused" || motionPaused || taskPaused;
|
||||
const interpResumeState = normalizeTaskHalInterpState(
|
||||
ui.interpResumeState ||
|
||||
task.interpResumeState ||
|
||||
(paused ? state.machine.interpResumeState || "reading" : interpState),
|
||||
);
|
||||
const axisPose = pauseLock?.axisPose
|
||||
? clampAxisPoseToProfile(pauseLock.axisPose, state.profile)
|
||||
: paused
|
||||
? clampAxisPoseToProfile(state.axisPose, state.profile)
|
||||
const displayPauseLock = paused && state.taskHalPauseLock?.active === true
|
||||
? state.taskHalPauseLock
|
||||
: null;
|
||||
const axisPose = displayPauseLock?.axisPose
|
||||
? clampAxisPoseToProfile(displayPauseLock.axisPose, state.profile)
|
||||
: preserveAxisPose
|
||||
? clampAxisPoseToProfile({ ...state.axisPose, ...preserveAxisPose }, state.profile)
|
||||
: resolveTaskHalAxisPose(state, status);
|
||||
: resolveTaskHalAxisPose(state, status, { paused, runState: state.runState });
|
||||
const currentVelocity = paused
|
||||
? 0
|
||||
: Number.isFinite(ui.currentVelocity)
|
||||
@@ -3841,9 +3859,9 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const shouldTrackProgramPlayback = runState === "running"
|
||||
|| runState === "mdi"
|
||||
|| (runState === "complete" && (state.runState === "running" || state.runState === "mdi" || state.runState === "complete"));
|
||||
const taskHalSampleIndex = pauseLock
|
||||
const taskHalSampleIndex = displayPauseLock
|
||||
? clampNumber(
|
||||
pauseLock.sampleIndex,
|
||||
displayPauseLock.sampleIndex,
|
||||
0,
|
||||
Math.max(Number(state.programAxisPreviewPath?.samples?.length || state.programAxisPreviewPath?.sampleCount || 1) - 1, 0),
|
||||
)
|
||||
@@ -3857,15 +3875,15 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const idleRuntimeFeedback = {
|
||||
...runtimeFeedback,
|
||||
sampleIndex: taskHalSampleIndex,
|
||||
motionIndex: pauseLock
|
||||
? Number(pauseLock.motionIndex || 0)
|
||||
motionIndex: displayPauseLock
|
||||
? Number(displayPauseLock.motionIndex || 0)
|
||||
: Number(state.programExecutionMotionIndex || runtimeFeedback.motionIndex || 0),
|
||||
...(paused ? {
|
||||
axisPose,
|
||||
tcp: {
|
||||
x: Number(state.tcpPose?.x ?? axisPose.x ?? 0),
|
||||
y: Number(state.tcpPose?.y ?? axisPose.y ?? 0),
|
||||
z: Number(state.tcpPose?.z ?? axisPose.z ?? 0),
|
||||
x: Number(displayPauseLock?.tcpPose?.x ?? state.tcpPose?.x ?? axisPose.x ?? 0),
|
||||
y: Number(displayPauseLock?.tcpPose?.y ?? state.tcpPose?.y ?? axisPose.y ?? 0),
|
||||
z: Number(displayPauseLock?.tcpPose?.z ?? state.tcpPose?.z ?? axisPose.z ?? 0),
|
||||
},
|
||||
} : {}),
|
||||
};
|
||||
@@ -3875,12 +3893,12 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
axisPose,
|
||||
kinsType,
|
||||
rtcpState: rtcpStateFromKinsType(kinsType),
|
||||
motionIndex: pauseLock ? Number(pauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
motionIndex: displayPauseLock ? Number(displayPauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
sampleIndex: taskHalSampleIndex,
|
||||
runtimeFeedback: {
|
||||
...runtimeFeedback,
|
||||
sampleIndex: taskHalSampleIndex,
|
||||
motionIndex: pauseLock ? Number(pauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
motionIndex: displayPauseLock ? Number(displayPauseLock.motionIndex || 0) : runtimeFeedback.motionIndex,
|
||||
axisPose,
|
||||
currentVelocityMmPerMin: paused ? 0 : runtimeFeedback.currentVelocityMmPerMin,
|
||||
requestedVelocityMmPerMin: paused ? 0 : runtimeFeedback.requestedVelocityMmPerMin,
|
||||
@@ -3900,6 +3918,8 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
? createProgramUiExecution({
|
||||
...state,
|
||||
axisPose,
|
||||
tcpPose: displayPauseLock?.tcpPose || state.tcpPose,
|
||||
rtcpFrame: displayPauseLock?.rtcpFrame || state.rtcpFrame,
|
||||
kinsType: kinsType || state.kinsType,
|
||||
programExecutionSampleIndex: taskHalSampleIndex,
|
||||
programRuntimeFeedback: idleRuntimeFeedback,
|
||||
@@ -3909,7 +3929,7 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
const loopActive = state.taskHalStatusLoop?.active === true
|
||||
&& loopSequence !== null
|
||||
&& Number(state.taskHalStatusLoop.sequence) === Number(loopSequence)
|
||||
&& (runState === "running" || runState === "mdi");
|
||||
&& (runState === "running" || runState === "mdi" || runState === "paused");
|
||||
const nextTickCount = loopActive ? Number(state.taskHalStatusLoop.tickCount || 0) + 1 : Number(state.taskHalStatusLoop?.tickCount || 0);
|
||||
const feedbackHistory = [taskHalPlaybackPatch.programRuntimeFeedback, ...(state.programRuntimeFeedbackHistory || [])].slice(0, 100);
|
||||
const lineStatus = runState === "complete"
|
||||
@@ -3921,10 +3941,15 @@ function applyTaskHalStatusPatch(state, status, operatorMessage, {
|
||||
return {
|
||||
taskHalStatus: status,
|
||||
taskHalExecutionPending: false,
|
||||
taskHalPauseLock: pauseLock ? { ...pauseLock, lastStatusAt: new Date().toISOString() } : state.taskHalPauseLock,
|
||||
taskHalPauseLock: displayPauseLock ? { ...displayPauseLock, lastStatusAt: new Date().toISOString() } : null,
|
||||
taskHalFallbackReason: null,
|
||||
pendingJogCommand: null,
|
||||
...taskHalPlaybackPatch,
|
||||
...(displayPauseLock ? {
|
||||
tcpPose: displayPauseLock.tcpPose,
|
||||
rtcpFrame: displayPauseLock.rtcpFrame,
|
||||
dro: displayPauseLock.dro,
|
||||
} : {}),
|
||||
programExecutionSourceMode: "linuxcnc-task-motion-hal-wasm",
|
||||
machine: {
|
||||
...state.machine,
|
||||
@@ -3978,9 +4003,26 @@ function shouldContinueTaskHalStatusLoop(state = {}, status = {}) {
|
||||
const openedProgramLineCount = Number(task.openedSourceLineCount || task.openedLineCount || 1);
|
||||
const complete = interpState === "idle"
|
||||
&& Number(task.nextProgramLine || 0) >= openedProgramLineCount;
|
||||
if (paused) {
|
||||
return state.runState === "paused" ||
|
||||
state.machine?.interpState === "paused" ||
|
||||
state.machine?.taskPaused === true ||
|
||||
state.machine?.motionPaused === true;
|
||||
}
|
||||
return !aborted && !paused && !complete && (interpState === "reading" || taskMode === "mdi");
|
||||
}
|
||||
|
||||
function isTaskHalStatusPaused(status = {}) {
|
||||
const ui = status?.ui || {};
|
||||
const task = status?.task || {};
|
||||
const motion = status?.motionStatus?.motion || {};
|
||||
return normalizeTaskHalInterpState(ui.interpState || task.interpState) === "paused" ||
|
||||
ui.motionPaused === true ||
|
||||
ui.taskPaused === true ||
|
||||
motion.paused === true ||
|
||||
task.taskPaused === true;
|
||||
}
|
||||
|
||||
function isTaskHalRunPausedByOperator(state = {}) {
|
||||
return state.runState === "paused"
|
||||
|| state.machine?.interpState === "paused"
|
||||
@@ -4024,6 +4066,8 @@ function createTaskHalPauseLock(state = {}, source = "pause") {
|
||||
y: Number(state.tcpPose?.y || 0),
|
||||
z: Number(state.tcpPose?.z || 0),
|
||||
},
|
||||
rtcpFrame: state.rtcpFrame,
|
||||
dro: state.dro,
|
||||
semanticBoundary: "linuxcnc_axis_task_pauseresume_freezes_task_hal_status_until_resume",
|
||||
};
|
||||
}
|
||||
@@ -4104,7 +4148,7 @@ function programMotionAtOrBeforeLine(state, activeLine) {
|
||||
return candidate;
|
||||
}
|
||||
|
||||
function resolveTaskHalAxisPose(state, status) {
|
||||
function resolveTaskHalAxisPose(state, status, { paused = false, runState = state.runState } = {}) {
|
||||
const ui = status?.ui || {};
|
||||
const axisPose = ui.axisPose;
|
||||
if (!axisPose || typeof axisPose !== "object") {
|
||||
@@ -4127,6 +4171,10 @@ function resolveTaskHalAxisPose(state, status) {
|
||||
return addAxisDelta(state.axisPose, ui.axisPoseDelta, state.profile);
|
||||
}
|
||||
|
||||
if (!paused && runState !== "running" && runState !== "mdi" && !isJogStatus(status)) {
|
||||
return state.axisPose;
|
||||
}
|
||||
|
||||
if (!ui.axisPoseFrame && wouldResetNonZeroPoseToLocalZero(state.axisPose, axisPose)) {
|
||||
return state.axisPose;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user