G92-Grad + E-Korrektur

This commit is contained in:
chk
2026-06-25 18:58:55 +02:00
parent 8deb7bb8a6
commit b96a538b89
18 changed files with 1369 additions and 34 deletions

View File

@@ -113,5 +113,22 @@ describe("Robot G92", () => {
// ("Wenn nur G92 x3 gegeben wird, dann wird trotzdem auch y und z gesendet. schlecht." );
});
test("G92 E: Greifer-Öffnung (mm) → eMotor über Kopplung e - b - c", () => {
const robot = new Robot(300, 300, 20);
const D = 180 / Math.PI;
// B/C in Grad rein (→ intern Radiant), E in mm. eMotor muss aus e, b, c abgeleitet
// werden — die Greifer-Sehne läuft durchs Handgelenk (Arm3SegmentLinearX-Kopplung).
GCode.receiveGCode(robot, "G92 B30 C-45 E10");
expect(robot.b).toBeCloseTo(30 / D, 6); // 30° → rad
expect(robot.c).toBeCloseTo(-45 / D, 6); // -45° → rad
expect(robot.e).toBe(10); // mm, unverändert
expect(robot.eMotor).toBeCloseTo(10 - robot.b - robot.c, 6); // = e - b - c
// Konsistenz: identische Kopplung wie der reguläre Bewegungspfad (calculateAngles3D).
expect(robot.eMotor).toBeCloseTo(robot.gripperMotorFromOpening(robot.e), 12);
});
});