Add dual canvas XYZBC and refined machine visualization

This commit is contained in:
2026-09-10 05:47:14 +08:00
parent d90933b980
commit 17887c199a
15 changed files with 935 additions and 92 deletions

View File

@@ -1,4 +1,4 @@
import type { XyzacKinematicsSnapshot } from "./protocol";
import type { XyzacKinematicsSnapshot, XyzacMachineModel } from "./protocol";
export type XyzacVisualState = {
schema: "xyzac-visual-state.v1";
@@ -18,6 +18,7 @@ export type XyzacVisualState = {
velocityMmMin?: number;
activeSegmentId: number | null;
toolpath: Array<Record<string, unknown>>;
machineModel: XyzacMachineModel | null;
source: "linuxcnc-wasm-worker";
};
@@ -29,7 +30,7 @@ export type XyzacVisualSource = {
state_hash?: string;
kinematics?: XyzacKinematicsSnapshot;
motion?: { velocity_mm_min?: number };
visual?: { active_segment_id?: number | null; active_progress?: number; pose_epoch?: number; live_path_epoch?: number; motion_trace?: Array<{ tick: number; pose: Record<string, number>; joints: number[]; active_segment_id: number; active_progress: number }>; pose?: Record<string, number>; joints?: number[]; toolpath?: Array<Record<string, unknown>> };
visual?: { active_segment_id?: number | null; active_progress?: number; pose_epoch?: number; live_path_epoch?: number; motion_trace?: Array<{ tick: number; pose: Record<string, number>; joints: number[]; active_segment_id: number; active_progress: number }>; pose?: Record<string, number>; joints?: number[]; toolpath?: Array<Record<string, unknown>>; machine_model?: XyzacMachineModel };
};
export function projectXyzacVisual(snapshot: XyzacVisualSource | null | undefined): XyzacVisualState {
@@ -63,6 +64,7 @@ export function projectXyzacVisual(snapshot: XyzacVisualSource | null | undefine
velocityMmMin: (snapshot?.visual as { velocity_mm_min?: number })?.velocity_mm_min ?? snapshot?.motion?.velocity_mm_min,
activeSegmentId: snapshot?.visual?.active_segment_id ?? null,
toolpath: snapshot?.visual?.toolpath ?? [],
machineModel: snapshot?.visual?.machine_model ?? null,
source: "linuxcnc-wasm-worker",
};
}