From 566d3894c4a45739b364a887c086236d699235a5 Mon Sep 17 00:00:00 2001 From: ChK Date: Tue, 17 Mar 2026 08:14:48 +0100 Subject: [PATCH] logging --- robot/GCode.js | 3 +++ robot/Robot.js | 3 +-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/robot/GCode.js b/robot/GCode.js index 866bfea..1edbec9 100755 --- a/robot/GCode.js +++ b/robot/GCode.js @@ -89,6 +89,8 @@ class GCode{ if(g == undefined) return; + console.log("GCode: Empfange GCode: " + g); + var multipleCommands = g.split(" G"); var doProcessRest = false; if(multipleCommands.length > 1){ @@ -104,6 +106,7 @@ class GCode{ if(g[0] == "G90") {robot.moveRelative = false; calculateNew = false;} else if(g[0] == "G91") {robot.moveRelative = true; calculateNew = false;} + // G28 - Move to Home Position else if(g[0] == "G28") { robot.x = 0; robot.y = robot.l1 + robot.l2 + robot.l3; diff --git a/robot/Robot.js b/robot/Robot.js index db8eb68..78d7ac0 100755 --- a/robot/Robot.js +++ b/robot/Robot.js @@ -67,7 +67,6 @@ class Robot{ // Berechnet aus XYZ die Motor-Winkel für den GCode calculateAngles3D(){ - while(this.phi > Math.PI){this.phi -= 2*Math.PI} while(this.phi < -Math.PI){this.phi += 2*Math.PI} while(this.theta > Math.PI){this.theta -= 2*Math.PI} @@ -145,7 +144,7 @@ class Robot{ this.motorPositionOld = this.motorPosition; this.createMotorPosition() - console.log("Robot.sendCommand: neue RobotMotorPosition: x=", this.motorPosition.x.toFixed(3), "yMotor=",this.motorPosition.y.toFixed(3), "zMotor=",this.motorPosition.z.toFixed(3), "aM=", this.motorPosition.a.toFixed(3), "bM=", this.motorPosition.b.toFixed(3), "cM=", this.motorPosition.c.toFixed(3), " e=", this.motorPosition.e.toFixed(3)); + console.log("Robot.sendCommand: Motor-Pos: x=", this.motorPosition.x.toFixed(3), "yMotor=",this.motorPosition.y.toFixed(3), "zMotor=",this.motorPosition.z.toFixed(3), "aM=", this.motorPosition.a.toFixed(3), "bM=", this.motorPosition.b.toFixed(3), "cM=", this.motorPosition.c.toFixed(3), " e=", this.motorPosition.e.toFixed(3)); this.cmdReceivers.forEach(receiver => { receiver.moveTo(this.motorPositionOld, this.motorPosition);