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

@@ -90,19 +90,23 @@ describe('GCode.receiveGCode', () => {
expect(robot.sendCommand).toHaveBeenCalled()
})
test('G28 setzt Home-Motorwerte direkt (Singularität) und löst Bewegung aus', () => {
test('G28 setzt Home-Motorwerte direkt (Singularität), lässt aber den Greifer unangetastet', () => {
const robot = createDummyRobot()
robot.e = 7 // vorher gesetzte Greifer-Öffnung ...
robot.eMotor = 3 // ... darf von G28 NICHT bewegt werden (sonst ebc-Slam bei b=π)
GCode.receiveGCode(robot, 'G28')
// Voll ausgestreckt = Handgelenk-Singularität -> Motorwerte DIREKT, dann FK (nicht IK).
// Voll ausgestreckt = Handgelenk-Singularität -> Arm-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)
// Greifer unverändert -> kein Finger-Slam am Anschlag
expect(robot.e).toBe(7)
expect(robot.eMotor).toBe(3)
expect(robot.calculateAngles3D).not.toHaveBeenCalled()
expect(robot.calculatePositionFromMotorAngles).toHaveBeenCalledTimes(1)
expect(robot.sendCommand).toHaveBeenCalledTimes(1)

View File

@@ -24,9 +24,11 @@ const FULL_ROBOT_JSON = {
hand: { ip: 'fluidNcHand.local', port: 5000, protocol: 'telnet', axes: ['c', 'e', 'b'] }
},
links: {
Arm1: { skeleton: { from: [0,0,0], to: [0,-250,0] } },
Arm2: { skeleton: { from: [0,0,0], to: [0,-250,0] } },
Ellbow: { skeleton: { from: [0,0,0], to: [90,0,0] } }
Arm1: { skeleton: { from: [0,0,0], to: [0,-250,0] } },
Arm2: { skeleton: { from: [0,0,0], to: [0,-250,0] } },
Ellbow: { skeleton: { from: [0,0,0], to: [90,0,0] } },
Hand: { skeleton: { from: [0,0,0], to: [0,-35,0] } },
FingerA: { skeleton: { from: [0,0,0], to: [0,-60,0] } }
}
};
@@ -45,8 +47,16 @@ describe('RobotConfig.load — Vollständige robot.json', () => {
expect(cfg.kinematics.l2).toBe(250);
});
test('l3 aus links.Ellbow.skeleton.to[0]', () => {
expect(cfg.kinematics.l3).toBe(90);
test('l3 aus Hand + Finger (Handgelenk → Fingerspitze), NICHT Ellbow-Versatz', () => {
expect(cfg.kinematics.l3).toBe(95); // |Hand.to[1]|=35 + |FingerA.to[1]|=60
});
test('kinematics.l1/l2/l3 explizit in robot.json überschreiben die links-Ableitung', () => {
const json = { ...FULL_ROBOT_JSON, kinematics: { type: 'arm3segmentlinearx', l1: 260, l2: 270, l3: 50 } };
const c = load(makeFs(JSON.stringify(json)), {}, log);
expect(c.kinematics.l1).toBe(260);
expect(c.kinematics.l2).toBe(270);
expect(c.kinematics.l3).toBe(50);
});
test('motion.defaultFeedrate aus robot.json', () => {