Support XYZAC and XYZBC in shared web machine UI
This commit is contained in:
@@ -71,6 +71,7 @@ function projection(result: Record<string, unknown>, message: MessageEnvelope, p
|
||||
const executionTrace = resetExecutionTrace ? trace.slice(-EXECUTION_TRACE_CACHE_LIMIT) : trace.length ? [...previous.executionTrace, ...trace].slice(-EXECUTION_TRACE_CACHE_LIMIT) : previous.executionTrace;
|
||||
const delta = result.motion_sample as { tick?: number; pose?: Record<string, number>; joints?: number[]; active_segment_id?: number; active_progress?: number } | undefined;
|
||||
if (!panel && delta && previous.snapshot) {
|
||||
const previousSnapshot = previous.snapshot;
|
||||
const pose = delta.pose ?? {};
|
||||
const joints = Array.isArray(delta.joints) ? [...delta.joints] : previous.snapshot.motion?.joints ?? [];
|
||||
const visual = previous.snapshot.visual ? {
|
||||
@@ -97,16 +98,8 @@ function projection(result: Record<string, unknown>, message: MessageEnvelope, p
|
||||
motion: {
|
||||
...previous.snapshot.motion,
|
||||
...(result.motion as SimSnapshotV1["motion"] | undefined),
|
||||
// Keep the XYZAC axis vector intact on every motion delta. Older
|
||||
// projection code rebuilt only XYZ, which made A/C disappear from
|
||||
// consumers that read the canonical motion array.
|
||||
axes: [
|
||||
Number(pose.x ?? previous.snapshot.motion?.axes?.[0] ?? 0),
|
||||
Number(pose.y ?? previous.snapshot.motion?.axes?.[1] ?? 0),
|
||||
Number(pose.z ?? previous.snapshot.motion?.axes?.[2] ?? 0),
|
||||
Number(pose.a ?? previous.snapshot.motion?.axes?.[3] ?? 0),
|
||||
Number(pose.c ?? previous.snapshot.motion?.axes?.[4] ?? 0),
|
||||
],
|
||||
// Keep the active machine's axis vector intact on every motion delta.
|
||||
axes: [...String(previousSnapshot.kinematics?.coordinates ?? "XYZAC").toLowerCase()].map((axis, index) => Number(pose[axis] ?? previousSnapshot.motion?.axes?.[index] ?? 0)),
|
||||
joints,
|
||||
},
|
||||
wasm_motion: (result.wasm_motion as Record<string, unknown>) ?? previous.snapshot.wasm_motion,
|
||||
@@ -150,7 +143,8 @@ function projection(result: Record<string, unknown>, message: MessageEnvelope, p
|
||||
})
|
||||
: previous.toolpath;
|
||||
const pose = panel.visual.pose;
|
||||
const axes = [pose.x, pose.y, pose.z, pose.a, pose.c].map((value) => Number.isFinite(value) ? value : 0);
|
||||
const coordinateSystem = String(panel.kinematics?.coordinates ?? panel.xyzac?.coordinates ?? "XYZAC");
|
||||
const axes = [...coordinateSystem.toLowerCase()].map((axis) => Number.isFinite(pose?.[axis]) ? Number(pose[axis]) : 0);
|
||||
const snapshot = {
|
||||
schema: panel.schema,
|
||||
source_status: panel.source_status,
|
||||
|
||||
Reference in New Issue
Block a user