B um 180° gedreht

This commit is contained in:
chk
2026-06-26 15:53:50 +02:00
parent 2197a8954f
commit 549d10b9c0
7 changed files with 259 additions and 49 deletions

View File

@@ -67,12 +67,11 @@ class RobotController {
robot.alpha = 0;
robot.beta = 0;
robot.a = 0;
robot.b = Math.PI; // gerade Hand (Phase-1-Konvention; Phase 2: 0)
robot.b = 0; // gerade Hand (Phase-2-Konvention: b=0 = gerade)
robot.c = 0;
// 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.
// Mit b=0 (Phase 2) wäre eMotor = e0c = ec, kein Slam mehr. Trotzdem
// unangetastet, damit der Greifer unabhängig vom Arm gesteuert werden kann.
robot.calculatePositionFromMotorAngles(); // FK -> x=0, y=-(l1+l2+l3), z=0
} else {
// Allgemeiner (nicht-singulärer) Home-Punkt: regulär über die IK.

View File

@@ -110,9 +110,10 @@ class Arm3SegmentLinearX extends RobotBase {
if(Math.sin(this.theta) < 0) {this.a = -this.a}
// Handgelenk-Knick-Winkel ist zwischen Arm und Punkt-O
// Handgelenk-Knick-Winkel: b=0 = gerade (Phase 2). cosB ist cos des internen
// Winkels zwischen Unterarm und Hand; acos liefert [0,π], also b = πacos(cosB) ∈ [0,π].
var cosB = Math.cos(this.beta)*Math.sin(this.theta)*Math.sin(this.phi) + Math.sin(this.beta)*Math.cos(this.theta);
this.b = Math.acos(cosB);
this.b = Math.PI - Math.acos(cosB);
// Winkel zwischen n und z muss rumgedreht werden.
@@ -153,7 +154,8 @@ class Arm3SegmentLinearX extends RobotBase {
if(verbose) console.log("n inverse:", n.x, n.y, n.z);
const vHand = this.rotateAroundAxis(vecUnterarm, n, this.b);
// b=0 = gerade (Phase 2): interne Rotation um πb (bei b=0 → π → Hand gestreckt).
const vHand = this.rotateAroundAxis(vecUnterarm, n, Math.PI - this.b);
this.x = this.pX - this.l3 * vHand.x;
this.y = this.pY - this.l3 * vHand.y;