This commit is contained in:
ChK
2026-03-17 08:14:48 +01:00
parent 3ce269e4e9
commit 566d3894c4
2 changed files with 4 additions and 2 deletions

View File

@@ -89,6 +89,8 @@ class GCode{
if(g == undefined) return; if(g == undefined) return;
console.log("GCode: Empfange GCode: " + g);
var multipleCommands = g.split(" G"); var multipleCommands = g.split(" G");
var doProcessRest = false; var doProcessRest = false;
if(multipleCommands.length > 1){ if(multipleCommands.length > 1){
@@ -104,6 +106,7 @@ class GCode{
if(g[0] == "G90") {robot.moveRelative = false; calculateNew = false;} if(g[0] == "G90") {robot.moveRelative = false; calculateNew = false;}
else if(g[0] == "G91") {robot.moveRelative = true; calculateNew = false;} else if(g[0] == "G91") {robot.moveRelative = true; calculateNew = false;}
// G28 - Move to Home Position
else if(g[0] == "G28") { else if(g[0] == "G28") {
robot.x = 0; robot.x = 0;
robot.y = robot.l1 + robot.l2 + robot.l3; robot.y = robot.l1 + robot.l2 + robot.l3;

View File

@@ -67,7 +67,6 @@ class Robot{
// Berechnet aus XYZ die Motor-Winkel für den GCode // Berechnet aus XYZ die Motor-Winkel für den GCode
calculateAngles3D(){ calculateAngles3D(){
while(this.phi > Math.PI){this.phi -= 2*Math.PI} while(this.phi > Math.PI){this.phi -= 2*Math.PI}
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} while(this.theta > Math.PI){this.theta -= 2*Math.PI}
@@ -145,7 +144,7 @@ class Robot{
this.motorPositionOld = this.motorPosition; this.motorPositionOld = this.motorPosition;
this.createMotorPosition() 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 => { this.cmdReceivers.forEach(receiver => {
receiver.moveTo(this.motorPositionOld, this.motorPosition); receiver.moveTo(this.motorPositionOld, this.motorPosition);