Interrim G28 ohne e

This commit is contained in:
chk
2026-06-26 12:28:40 +02:00
parent 7639266170
commit 933a017e2e
7 changed files with 89 additions and 24 deletions

View File

@@ -27,10 +27,16 @@ function deriveKinematicParams(links) {
const result = {};
const l1raw = links.Arm1?.skeleton?.to?.[1];
const l2raw = links.Arm2?.skeleton?.to?.[1];
const l3raw = links.Ellbow?.skeleton?.to?.[0];
if (l1raw != null) result.l1 = Math.abs(l1raw);
if (l2raw != null) result.l2 = Math.abs(l2raw);
if (l3raw != null) result.l3 = l3raw;
// l3 = Endeffektor-Länge (Handgelenk → Fingerspitze) = Hand-Segment + Finger.
// FRÜHER fälschlich aus Ellbow.skeleton.to[0] abgeleitet — das ist der seitliche
// Ellbogen-Versatz, nicht die Hand/Finger-Länge (siehe doc/Info_Koordinaten.md, Phase 2).
const handLen = links.Hand?.skeleton?.to?.[1]; // Hand-Segment (z. B. -35)
const fingerLen = links.FingerA?.skeleton?.to?.[1]; // Finger (z. B. -60)
if (handLen != null || fingerLen != null) {
result.l3 = Math.abs(handLen ?? 0) + Math.abs(fingerLen ?? 0);
}
return result;
}
@@ -58,11 +64,13 @@ function load(fsModule, processEnv, consoleObj) {
// Kinematik-Typ und Armlängen (aus links abgeleitet)
const linkParams = deriveKinematicParams(json?.links);
// Explizite kinematics.l1/l2/l3 in robot.json haben Vorrang vor der links-Ableitung
// (zum Kalibrieren der realen Längen, z. B. l3 an die gemessene Reichweite anpassen).
const kinematics = {
type: json?.kinematics?.type ?? DEFAULTS.kinematics.type,
l1: linkParams.l1 ?? DEFAULTS.kinematics.l1,
l2: linkParams.l2 ?? DEFAULTS.kinematics.l2,
l3: linkParams.l3 ?? DEFAULTS.kinematics.l3
l1: json?.kinematics?.l1 ?? linkParams.l1 ?? DEFAULTS.kinematics.l1,
l2: json?.kinematics?.l2 ?? linkParams.l2 ?? DEFAULTS.kinematics.l2,
l3: json?.kinematics?.l3 ?? linkParams.l3 ?? DEFAULTS.kinematics.l3
};
// Bewegungs-Defaults — Env hat Vorrang, dann robot.json, dann Hard-Default

View File

@@ -69,8 +69,10 @@ class RobotController {
robot.a = 0;
robot.b = Math.PI; // gerade Hand (Phase-1-Konvention; Phase 2: 0)
robot.c = 0;
robot.e = 0;
robot.eMotor = robot.gripperMotorFromOpening(robot.e);
// Greifer (e/eMotor) bewusst UNANGETASTET lassen: G28 fährt nur den Arm.
// Würde man e=0 setzen, ergäbe die Kopplung eMotor = e b c bei b=π den
// Wert −π → 180° am Finger-Motor → Anschlag-Slam (siehe
// doc/Info_Koordinaten.md, Phase 2). Phase 2 (b=0 = gerade) löst das sauber.
robot.calculatePositionFromMotorAngles(); // FK -> x=0, y=-(l1+l2+l3), z=0
} else {
// Allgemeiner (nicht-singulärer) Home-Punkt: regulär über die IK.