G28 Singularität und Planungen

This commit is contained in:
chk
2026-06-26 11:39:20 +02:00
parent bd1752f567
commit 7639266170
6 changed files with 232 additions and 34 deletions

View File

@@ -90,17 +90,21 @@ describe('GCode.receiveGCode', () => {
expect(robot.sendCommand).toHaveBeenCalled()
})
test('G28 setzt Home-Position und löst Bewegung aus', () => {
test('G28 setzt Home-Motorwerte direkt (Singularität) und löst Bewegung aus', () => {
const robot = createDummyRobot()
GCode.receiveGCode(robot, 'G28')
expect(robot.x).toBe(0)
expect(robot.z).toBe(0)
expect(robot.y).toBe(-(robot.l1 + robot.l2 + robot.l3)) // -y Grundstellung
expect(robot.phi).toBeCloseTo(Math.PI / 2)
expect(robot.theta).toBeCloseTo(Math.PI / 2)
expect(robot.calculateAngles3D).toHaveBeenCalledTimes(1)
// Voll ausgestreckt = Handgelenk-Singularität -> Motorwerte DIREKT, dann FK (nicht IK).
expect(robot.xMotor).toBe(0)
expect(robot.alpha).toBe(0)
expect(robot.beta).toBe(0)
expect(robot.a).toBe(0)
expect(robot.b).toBe(Math.PI) // gerade Hand (Phase-1-Konvention)
expect(robot.c).toBe(0)
expect(robot.e).toBe(0)
expect(robot.calculateAngles3D).not.toHaveBeenCalled()
expect(robot.calculatePositionFromMotorAngles).toHaveBeenCalledTimes(1)
expect(robot.sendCommand).toHaveBeenCalledTimes(1)
})