spin Marker Callibration
This commit is contained in:
@@ -338,18 +338,34 @@ function buildSkeletonFK(robot, angles) {
|
||||
gSkeleton.add(makeSphere(jointW, 0.004, 0xc8cdd8));
|
||||
}
|
||||
|
||||
// 4. Arm-Marker zeichnen (Modellposition via FK, als orientiertes Quadrat)
|
||||
// 4. Arm-Marker zeichnen (Modellposition via FK, orientiertes Quadrat + spin)
|
||||
if (link.markers?.length > 0) {
|
||||
const col = LINK_COLORS[linkName] ?? 0xffffff;
|
||||
for (const m of link.markers) {
|
||||
if (!m.position) continue;
|
||||
const [lx, ly, lz] = m.position;
|
||||
const posWorld = new THREE.Vector3(lx * S, lz * S, -ly * S).applyMatrix4(childFrame);
|
||||
const posWorld = new THREE.Vector3(lx * S, lz * S, -ly * S).applyMatrix4(childFrame);
|
||||
const markerSizeM = (m.size ?? 25) * S;
|
||||
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));
|
||||
const normalW = new THREE.Vector3(nx, nz, -ny).transformDirection(childFrame).normalize();
|
||||
|
||||
// P1: Quadrat mit spin-Rotation (um die Marker-Normale in Welt-Koordinaten)
|
||||
const markerMesh = makeMarkerSquareOriented(posWorld, normalW, markerSizeM, col);
|
||||
const spinRad = ((m.spin ?? 0) * Math.PI) / 180;
|
||||
if (Math.abs(spinRad) > 1e-6) {
|
||||
markerMesh.quaternion.premultiply(
|
||||
new THREE.Quaternion().setFromAxisAngle(normalW, spinRad)
|
||||
);
|
||||
}
|
||||
gArmMarkers.add(markerMesh);
|
||||
gArmMarkers.add(makeSphere(posWorld, 0.0006, col));
|
||||
|
||||
// P3b (Modell-Seite): Orientierungszeiger zur Ecke 0 (top-left bei spin=0)
|
||||
// markerMesh.quaternion kodiert bereits Q_normal ∘ Q_spin
|
||||
const ptrDir = new THREE.Vector3(1, 1, 0).normalize().applyQuaternion(markerMesh.quaternion);
|
||||
const corner0W = posWorld.clone().add(ptrDir.multiplyScalar(markerSizeM * Math.SQRT1_2));
|
||||
gArmMarkers.add(makeLine(posWorld, corner0W, col, 0.9));
|
||||
gArmMarkers.add(makeSphere(corner0W, 0.0008, col));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user