G92 > send-to-ESP
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
// __tests__/Robot.inverseKinematics.test.js
|
||||
const Robot = require('../robot/Robot.js');
|
||||
const GCode = require('../robot/GCode.js');
|
||||
var TenetSender = require('../robot/TelnetSenderGRBL.js')
|
||||
|
||||
describe("Robot G92", () => {
|
||||
|
||||
beforeAll(() => {
|
||||
jest.spyOn(console, 'log').mockImplementation(() => {})
|
||||
})
|
||||
|
||||
afterAll(() => {
|
||||
jest.restoreAllMocks()
|
||||
})
|
||||
|
||||
test("ReadPosition -> calculatePositionFromMotorAngles()", () => {
|
||||
|
||||
// === Instanz A: Vorwärts-Kinematik (XYZ -> Motorwinkel) ===
|
||||
@@ -26,7 +35,7 @@ describe("Robot G92", () => {
|
||||
|
||||
A.calculateAngles3D();
|
||||
|
||||
var strGCode = `G92 X${A.xMotor} Y${A.alpha} Z${A.beta} A${A.a} B${A.b} C${A.c}`
|
||||
var strGCode = `M92 X${A.xMotor} Y${A.alpha} Z${A.beta} A${A.a} B${A.b} C${A.c}`
|
||||
|
||||
|
||||
const T = new Robot(L1, L2, L3)
|
||||
@@ -44,5 +53,36 @@ describe("Robot G92", () => {
|
||||
|
||||
|
||||
});
|
||||
|
||||
// G92 y2.8 z131.0
|
||||
test("ReadPosition -> G92()", () => {
|
||||
|
||||
// === Instanz A: Vorwärts-Kinematik (XYZ -> Motorwinkel) ===
|
||||
const L1 = 300;
|
||||
const L2 = 300;
|
||||
const L3 = 20;
|
||||
|
||||
const robot = new Robot(L1, L2, L3)
|
||||
|
||||
var telnetSender1 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 2300, xAxisGrbl = "x", yAxisGrbl = "y", zAxisGrbl = "z");
|
||||
var telnetSender2 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 5000, xAxisGrbl = "a", yAxisGrbl = null, zAxisGrbl = null);
|
||||
var telnetSender3 = new TenetSender(urlGRBL = "test.test", maxSpeedF = 5000, xAxisGrbl = "c", yAxisGrbl = "e", zAxisGrbl = "b");
|
||||
|
||||
robot.cmdReceivers.push(telnetSender1);
|
||||
robot.cmdReceivers.push(telnetSender2);
|
||||
robot.cmdReceivers.push(telnetSender3);
|
||||
|
||||
|
||||
GCode.receiveGCode(robot,"M92 y0.049 z2.286");
|
||||
|
||||
const strExpect1 = 'G92 x0.00 y2.81 z128.17\r\n';
|
||||
const strExpect2 = 'G92 y2.81 z128.17\r\n';
|
||||
|
||||
allowedValues = [strExpect1, strExpect2];
|
||||
expect(allowedValues).toContain(telnetSender1.tSocket.written);
|
||||
|
||||
// ("Wenn nur G92 x3 gegeben wird, dann wird trotzdem auch y und z gesendet. schlecht." );
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user