Marker Update Live
This commit is contained in:
@@ -349,7 +349,7 @@ function buildSkeletonFK(robot, angles) {
|
||||
const [nx, ny, nz] = m.normal ?? [0, 0, 1];
|
||||
const normalWorld = new THREE.Vector3(nx, nz, -ny).transformDirection(childFrame);
|
||||
gArmMarkers.add(makeMarkerSquareOriented(posWorld, normalWorld, markerSizeM, col));
|
||||
gArmMarkers.add(makeSphere(posWorld, 0.003, col));
|
||||
gArmMarkers.add(makeSphere(posWorld, 0.0006, col));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,6 +346,17 @@ function setHomingProgress(step, total, text) {
|
||||
if (txt) txt.textContent = text || `Schritt ${step} / ${total}`;
|
||||
}
|
||||
|
||||
function writePartialGCode(state) {
|
||||
const axisMap = { x: 'X', y: 'Y', z: 'Z', a: 'A', b: 'B', c: 'C', e: 'E' };
|
||||
const parts = [];
|
||||
for (const [key, axis] of Object.entries(axisMap)) {
|
||||
if (state[key] != null) parts.push(`${axis}${Number(state[key]).toFixed(2)}`);
|
||||
}
|
||||
if (!parts.length) return;
|
||||
const el = document.getElementById('gcodePayload');
|
||||
if (el) el.value = `G92 ${parts.join(' ')}`;
|
||||
}
|
||||
|
||||
function showHomingResult(state) {
|
||||
// Raw JSON
|
||||
const jsonEl = document.getElementById('result-json');
|
||||
@@ -518,6 +529,14 @@ async function runHoming() {
|
||||
el.value += `${evt.key}:\n${JSON.stringify(evt.value, null, 2)}\n\n`;
|
||||
el.scrollTop = el.scrollHeight;
|
||||
}
|
||||
// Progressiver Skeleton-Update: accumulated_state nach jedem Gelenk
|
||||
if (evt.key?.startsWith('state_') && evt.value) {
|
||||
const frame = document.getElementById('board-viewer-frame');
|
||||
if (frame?.contentWindow) {
|
||||
frame.contentWindow.postMessage({ type: 'homing-state', state: evt.value }, '*');
|
||||
}
|
||||
writePartialGCode(evt.value);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user