nur wenn xyz genaendert, dann senden

This commit is contained in:
ChK
2026-04-07 09:30:46 +02:00
parent 3d33ecd747
commit a47c168a22
11 changed files with 250 additions and 159 deletions

View File

@@ -17,16 +17,9 @@ class GCode{
m = m.split(" ");
if(m[0] == "M1"){
m.forEach((s) => {
if(s.includes("X")){ robot.xMotor += Number(s.substring(1, s.length));}
if(s.includes("x")){ robot.xMotor += Number(s.substring(1, s.length));}
if(s.includes("Y")){ robot.alpha += Number(s.substring(1, s.length));}
if(s.includes("y")){ robot.alpha += Number(s.substring(1, s.length));}
if(s.includes("Z")){ robot.beta += Number(s.substring(1, s.length));}
if(s.includes("z")){ robot.beta += Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("X")){ robot.xMotor += Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("Y")){ robot.alpha += Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("Z")){ robot.beta += Number(s.substring(1, s.length));}
})
}
@@ -118,109 +111,68 @@ class GCode{
}
else if(g[0] == "G1" && robot.moveRelative){
g.forEach((s) => {
if(s.includes("X")){ robot.x += Number(s.substring(1, s.length));}
if(s.includes("x")){ robot.x += Number(s.substring(1, s.length));}
if(s.includes("Y")){ robot.y += Number(s.substring(1, s.length));}
if(s.includes("y")){ robot.y += Number(s.substring(1, s.length));}
if(s.includes("Z")){ robot.z += Number(s.substring(1, s.length));}
if(s.includes("z")){ robot.z += Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("X")){ robot.x += Number(s.substring(1, s.length)); robot.xMotorChanged = true;}
if(s.toUpperCase().includes("Y")){ robot.y += Number(s.substring(1, s.length)); robot.yMotorChanged = true;}
if(s.toUpperCase().includes("Z")){ robot.z += Number(s.substring(1, s.length)); robot.zMotorChanged = true;}
// abc in 2Pi-Angles
if(s.includes("A")){ robot.phi += Number(s.substring(1, s.length));}
if(s.includes("a")){ robot.phi += Number(s.substring(1, s.length));}
if(s.includes("B")){ robot.theta += Number(s.substring(1, s.length));}
if(s.includes("b")){ robot.theta += Number(s.substring(1, s.length));}
if(s.includes("C")){ robot.psi += Number(s.substring(1, s.length));}
if(s.includes("c")){ robot.psi += Number(s.substring(1, s.length));}
if(s.includes("E")){ robot.e += Number(s.substring(1, s.length));}
if(s.includes("e")){ robot.e += Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("A")){ robot.phi += Number(s.substring(1, s.length)); robot.aMotorChanged = true;}
if(s.toUpperCase().includes("B")){ robot.theta += Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.psi += Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e += Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
});
}
else if(g[0] == "M1" && robot.moveRelative){
calculateFromMotorCoordinates = true;
g.forEach((s) => {
if(s.includes("X")){ robot.xMotor += Number(s.substring(1, s.length));}
if(s.includes("x")){ robot.xMotor += Number(s.substring(1, s.length));}
if(s.includes("Y")){ robot.alpha += Number(s.substring(1, s.length));}
if(s.includes("y")){ robot.alpha += Number(s.substring(1, s.length));}
if(s.includes("Z")){ robot.beta += Number(s.substring(1, s.length));}
if(s.includes("z")){ robot.beta += Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("X")){ robot.xMotor += Number(s.substring(1, s.length)); robot.xMotorChanged = true;}
if(s.toUpperCase().includes("Y")){ robot.alpha += Number(s.substring(1, s.length)); robot.yMotorChanged = true;}
if(s.toUpperCase().includes("Z")){ robot.beta += Number(s.substring(1, s.length)); robot.zMotorChanged = true;}
if(s.includes("A")){ robot.a += Number(s.substring(1, s.length));}
if(s.includes("a")){ robot.a += Number(s.substring(1, s.length));}
if(s.includes("B")){ robot.b += Number(s.substring(1, s.length));}
if(s.includes("b")){ robot.b += Number(s.substring(1, s.length));}
if(s.includes("C")){ robot.c += Number(s.substring(1, s.length));}
if(s.includes("c")){ robot.c += Number(s.substring(1, s.length));}
if(s.includes("E")){ robot.e += Number(s.substring(1, s.length));}
if(s.includes("e")){ robot.e += Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("A")){ robot.a += Number(s.substring(1, s.length)); robot.aMotorChanged = true;}
if(s.toUpperCase().includes("B")){ robot.b += Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.c += Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e += Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
});
}
// Absolute-Positioning
else if(g[0] == "G1" && !robot.moveRelative){
g.forEach((s) => {
if(s.includes("X")){ robot.x = Number(s.substring(1, s.length));}
if(s.includes("x")){ robot.x = Number(s.substring(1, s.length));}
if(s.includes("Y")){ robot.y = Number(s.substring(1, s.length));}
if(s.includes("y")){ robot.y = Number(s.substring(1, s.length));}
if(s.includes("Z")){ robot.z = Number(s.substring(1, s.length));}
if(s.includes("z")){ robot.z = Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("X")){ robot.x = Number(s.substring(1, s.length)); robot.xMotorChanged = true;}
if(s.toUpperCase().includes("Y")){ robot.y = Number(s.substring(1, s.length)); robot.yMotorChanged = true;}
if(s.toUpperCase().includes("Z")){ robot.z = Number(s.substring(1, s.length)); robot.zMotorChanged = true;}
if(s.includes("A")){ robot.phi = Number(s.substring(1, s.length));}
if(s.includes("a")){ robot.phi = Number(s.substring(1, s.length));}
if(s.includes("B")){ robot.theta = Number(s.substring(1, s.length));}
if(s.includes("b")){ robot.theta = Number(s.substring(1, s.length));}
if(s.includes("C")){ robot.psi = Number(s.substring(1, s.length));}
if(s.includes("c")){ robot.psi = Number(s.substring(1, s.length));}
if(s.includes("E")){ robot.e = Number(s.substring(1, s.length));}
if(s.includes("e")){ robot.e = Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("A")){ robot.phi = Number(s.substring(1, s.length)); robot.aMotorChanged = true;}
if(s.toUpperCase().includes("B")){ robot.theta = Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.psi = Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e = Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
});
}
else if(g[0] == "M1" && !robot.moveRelative){
calculateFromMotorCoordinates = true;
g.forEach((s) => {
if(s.includes("X")){ robot.xMotor = Number(s.substring(1, s.length));}
if(s.includes("x")){ robot.xMotor = Number(s.substring(1, s.length));}
if(s.includes("Y")){ robot.alpha = Number(s.substring(1, s.length));}
if(s.includes("y")){ robot.alpha = Number(s.substring(1, s.length));}
if(s.includes("Z")){ robot.beta = Number(s.substring(1, s.length));}
if(s.includes("z")){ robot.beta = Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("X")){ robot.xMotor = Number(s.substring(1, s.length)); robot.xMotorChanged = true;}
if(s.toUpperCase().includes("Y")){ robot.alpha = Number(s.substring(1, s.length)); robot.yMotorChanged = true;}
if(s.toUpperCase().includes("Z")){ robot.beta = Number(s.substring(1, s.length)); robot.zMotorChanged = true;}
if(s.includes("A")){ robot.a = Number(s.substring(1, s.length));}
if(s.includes("a")){ robot.a = Number(s.substring(1, s.length));}
if(s.includes("B")){ robot.b = Number(s.substring(1, s.length));}
if(s.includes("b")){ robot.b = Number(s.substring(1, s.length));}
if(s.includes("C")){ robot.c = Number(s.substring(1, s.length));}
if(s.includes("c")){ robot.c = Number(s.substring(1, s.length));}
if(s.includes("E")){ robot.e = Number(s.substring(1, s.length));}
if(s.includes("e")){ robot.e = Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("A")){ robot.a = Number(s.substring(1, s.length)); robot.aMotorChanged = true;}
if(s.toUpperCase().includes("B")){ robot.b = Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.c = Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e = Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
});
robot.calculatePositionFromMotorAngles();
}
else if(g[0] == "M92"){ // G92 - Set Position --- M92 in Radiant
robot.createMotorPosition();
g.forEach((s) => {
if(s.includes("X")){ robot.xMotor = Number(s.substring(1, s.length));}
if(s.includes("x")){ robot.xMotor = Number(s.substring(1, s.length));}
if(s.includes("Y")){ robot.alpha = Number(s.substring(1, s.length));}
if(s.includes("y")){ robot.alpha = Number(s.substring(1, s.length));}
if(s.includes("Z")){ robot.beta = Number(s.substring(1, s.length));}
if(s.includes("z")){ robot.beta = Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("X")){ robot.xMotor = Number(s.substring(1, s.length)); robot.xMotorChanged = true;}
if(s.toUpperCase().includes("Y")){ robot.alpha = Number(s.substring(1, s.length)); robot.yMotorChanged = true;}
if(s.toUpperCase().includes("Z")){ robot.beta = Number(s.substring(1, s.length)); robot.zMotorChanged = true;}
if(s.includes("A")){ robot.a = Number(s.substring(1, s.length));}
if(s.includes("a")){ robot.a = Number(s.substring(1, s.length));}
if(s.includes("B")){ robot.b = Number(s.substring(1, s.length));}
if(s.includes("b")){ robot.b = Number(s.substring(1, s.length));}
if(s.includes("C")){ robot.c = Number(s.substring(1, s.length));}
if(s.includes("c")){ robot.c = Number(s.substring(1, s.length));}
if(s.includes("E")){ robot.e = Number(s.substring(1, s.length));}
if(s.includes("e")){ robot.e = Number(s.substring(1, s.length));}
if(s.toUpperCase().includes("A")){ robot.a = Number(s.substring(1, s.length)); robot.aMotorChanged = true;}
if(s.toUpperCase().includes("B")){ robot.b = Number(s.substring(1, s.length)); robot.bMotorChanged = true;}
if(s.toUpperCase().includes("C")){ robot.c = Number(s.substring(1, s.length)); robot.cMotorChanged = true;}
if(s.toUpperCase().includes("E")){ robot.e = Number(s.substring(1, s.length)); robot.eMotorChanged = true;}
});
robot.calculatePositionFromMotorAngles();
calculateNew = false;

View File

@@ -1,68 +1,116 @@
const MotorPosition = require('./RobotMotorPosition.js')
const telnetSender = require('./TelnetSenderGRBL.js')
class Robot{
constructor(l1, l2, l3) {
this.speedX = 200; // mm/min
this.speedY = 200;
/** @type {number} Bewegungsgeschwindigkeit X-Achse in mm/min */
this.speedX = 200;
/** @type {number} Bewegungsgeschwindigkeit Y-Achse in mm/min */
this.speedY = 200;
/** @type {number} Bewegungsgeschwindigkeit Z-Achse in mm/min */
this.speedZ = 200;
/** @type {number} Zeitstempel des zuletzt gesendeten Kommandos */
this.lastCommandSend = 0;
if(this.lastCommandSend == 0){ this.lastCommandSend = Date.now() };
/** @type {boolean} Animation aktiviert */
this.doAnimate = false;
this.l1 = l1; // Oberarm
this.l2 = l2; // Unterarm
this.l3 = l3; // Hand-Länge
/** @type {number} Länge des Oberarms in mm */
this.l1 = l1;
/** @type {number} Länge des Unterarms in mm */
this.l2 = l2;
/** @type {number} Länge der Hand (Endeffector) in mm */
this.l3 = l3;
// Plan-Koordinaten - XYZ FingerSpitze
/** @type {number} X-Position der Fingerspitze in mm */
this.x = 0;
/** @type {number} Y-Position der Fingerspitze in mm */
this.y = 0;
/** @type {number} Z-Position der Fingerspitze in mm */
this.z = 0;
// Plan-Koordinaten - HandRichtung
this.phi = 0.0; // Euler-Winkel zwischen X-Achse - Laengengrad
this.theta = -Math.PI/2; // Euler-Winkel zwischen Z-Achse und P - Breitengrad
this.psi = 0.0; // Euler-Winkel: Drehung des Handgelenks abweichend vom Breitengrad
// Plan-Koordinaten - HandRichtung (Euler-Winkel)
/** @type {number} Phi - Euler-Winkel (Längengrad): Rotation um Z-Achse in rad */
this.phi = 0.0;
/** @type {number} Theta - Euler-Winkel (Breitengrad): Neigungswinkel der Handachse in rad */
this.theta = -Math.PI/2;
/** @type {number} Psi - Euler-Winkel: Zusätzliche Drehung des Handgelenks in rad */
this.psi = 0.0;
this.e = 0.0 // Finger-Distance
/** @type {number} Finger-Abstands-Einstellung (Öffnungsweite) */
this.e = 0.0;
// Zwischen-Ergebnisse: Hand Punkt (nur für Tests sind die Public)
// Zwischen-Ergebnisse: Handgelenk-Punkt (Koordinaten des Handgelenks, nur für Tests public)
/** @type {number} Handgelenk-Position X in mm (berechneter Zwischenwert) */
this.pX = 0.0;
/** @type {number} Handgelenk-Position Y in mm (berechneter Zwischenwert) */
this.pY = 0.0;
/** @type {number} Handgelenk-Position Z in mm (berechneter Zwischenwert) */
this.pZ = 0.0;
// Motor-Koordinaten - Schulter, Ellebogen, Hand-Dreher
/** @type {number} X-Motor-Position (Schulterposition auf X-Schiene) in mm */
this.xMotor = 0;
this.alpha = 0; // =Y Motor
this.beta = 0; // =Z Motor = Winkel die der Unterarm unter der Y-Achse ist.
/** @type {number} Alpha - Y-Motor-Winkel (Schulterposition) in rad */
this.alpha = 0;
/** @type {number} Beta - Z-Motor-Winkel (Unterarm-Neigung unter Y-Achse) in rad */
this.beta = 0;
// Motor-Winkel fuer's Handgelenk
this.a = 0; // aMotor am Ellebogen
this.b = 0; // bMotor Handgelenk-Knicker
this.c = 0; // cMotor Hand-Dreher
this.xMotorChanged = false;
this.yMotorChanged = false;
this.zMotorChanged = false;
this.eMotor = 0; // eMotor Finger-Distanz
// Motor-Winkel für's Handgelenk
/** @type {number} a-Motor-Winkel: Rotation am Ellbogen in rad */
this.a = 0;
/** @type {number} b-Motor-Winkel: Handgelenk-Knicker-Winkel in rad */
this.b = 0;
/** @type {number} c-Motor-Winkel: Hand-Dreher-Rotation in rad */
this.c = 0;
this.aMotorChanged = false;
this.bMotorChanged = false;
this.cMotorChanged = false;
this.eMotorChanged = false;
/** @type {number} e-Motor-Wert: Finger-Abstands-Motor-Position */
this.eMotor = 0;
/** @type {number} Zeitstempel des letzten verarbeiteten Kommandos */
this.oldCommandTime = Date.now();
/** @type {Function[]} Array von Visualisierungs-Funktionen */
this.showFunctions = [];
/** @type {Object[]} Gespeicherte Roboterpositionen/Punkte */
this.savedPoints = [];
/** @type {number} Index des aktuell angesteuerten Punktes */
this.atPointNr = 0;
this.t = 0; // TimeStamp of this Point
/** @type {number} Zeitstempel des aktuellen Punktes in ms */
this.t = 0;
/** @type {boolean} Relative oder absolute Bewegung (true = relativ) */
this.moveRelative = true;
/** @type {Object|null} Python-Sender-Instanz für GCode-Kommunikation */
this.pythonSender = null;
/** @type {Object[]} Array von Kommando-Empfängern */
this.cmdReceivers = [];
}
createMotorPosition(){
this.motorPosition = new MotorPosition(this.xMotor, this.alpha, this.beta, this.a, this.b, this.c, this.eMotor);
this.motorPosition.xMotorChanged = this.xMotorChanged;
this.motorPosition.yMotorChanged = this.yMotorChanged;
this.motorPosition.zMotorChanged = this.zMotorChanged;
this.motorPosition.aMotorChanged = this.aMotorChanged;
this.motorPosition.bMotorChanged = this.bMotorChanged;
this.motorPosition.cMotorChanged = this.cMotorChanged;
this.motorPosition.eMotorChanged = this.eMotorChanged;
}
// Berechnet aus XYZ die Motor-Winkel für den GCode
@@ -188,12 +236,7 @@ class Robot{
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 => {
if(cmd == "G1"){
receiver.moveTo(this.motorPositionOld, this.motorPosition);
}
else{
receiver.execCommand(cmd,this.motorPositionOld, this.motorPosition);
}
});
}
}

View File

@@ -13,6 +13,14 @@ module.exports = class RobotMotorPosition{
this.e = e; // Finger open
this.time = Date.now();
this.xMotorChanged = false;
this.yMotorChanged = false;
this.zMotorChanged = false;
this.aMotorChanged = false;
this.bMotorChanged = false;
this.cMotorChanged = false;
this.eMotorChanged = false;
}
}

View File

@@ -75,27 +75,27 @@ module.exports = class TelnetSenderGRBL{
var data = strCommand.toString("utf-8");
if(this.xAxisGrbl == "x"){
if(this.xAxisGrbl == "x" && mNew.xMotorChanged){
data += " x" + (mNew.x).toFixed(2).toString();
}
if(this.xAxisGrbl == "y"){
if(this.xAxisGrbl == "y" && mNew.yMotorChanged){
data += " x" + (mNew.y * 180 / Math.PI).toFixed(2).toString();
}
if(this.xAxisGrbl == "z"){
if(this.xAxisGrbl == "z" && mNew.zMotorChanged){
data += " x" + ((mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI) ).toFixed(2).toString();
}
if(this.xAxisGrbl == "a"){
if(this.xAxisGrbl == "a" && mNew.aMotorChanged){
// This is the case for the Ellbow, when the Motor is connected to the X-Port of the FluidNC
data += " x" + (mNew.a * 180 / Math.PI).toFixed(2).toString();
}
if(this.xAxisGrbl == "b"){
if(this.xAxisGrbl == "b" && (mNew.bMotorChanged || mNew.cMotorChanged)){
data += " x" + (mNew.b * 180 / Math.PI+(mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI)).toFixed(2).toString();
}
if(this.xAxisGrbl == "c"){
if(this.xAxisGrbl == "c" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
// Runs correctly, substracts the "b" axis, uses the "c" axis to send to the x-Motor wich is in this case the hand-twist
data += " x" + ((-1)*mNew.b * 180 / Math.PI + (mNew.c * 180 / Math.PI) ).toFixed(2).toString();
}
if(this.xAxisGrbl == "e"){
if(this.xAxisGrbl == "e" && mNew.eMotorChanged){
//This is the case for the Hand, when the Open-Close Motor is connected to the X-Port of FluidNC
var handUpDown = mNew.b * 180 * factorTurnLift / Math.PI ;
var handTurn = mNew.c*180/Math.PI ;
@@ -104,111 +104,109 @@ module.exports = class TelnetSenderGRBL{
if(this.yAxisGrbl == "x"){
if(this.yAxisGrbl == "x" && mNew.xMotorChanged){
data += " y" + (mNew.x ).toFixed(2).toString();
}
if(this.yAxisGrbl == "y"){
if(this.yAxisGrbl == "y" && mNew.yMotorChanged){
data += " y" + (mNew.y * 180 / Math.PI).toFixed(2).toString();
}
if(this.yAxisGrbl == "z"){
if(this.yAxisGrbl == "z" && mNew.zMotorChanged){
data += " y" + ((mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI) ).toFixed(2).toString();
}
if(this.yAxisGrbl == "a"){
if(this.yAxisGrbl == "a" && mNew.aMotorChanged){
data += " y" + (mNew.a * 180 / Math.PI).toFixed(2).toString();
}
if(this.yAxisGrbl == "b"){
if(this.yAxisGrbl == "b" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
data += " y" + (mNew.b * 180 / Math.PI+(mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI)).toFixed(2).toString();
}
if(this.yAxisGrbl == "c"){
if(this.yAxisGrbl == "c" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
// This is the case if the hand-rotation-turner is connected to the FluidNC-Y
var handUpDown = (mNew.b * 180 / Math.PI ) * factorTurnLift;
var handTurn = ( mNew.c*180/Math.PI ) ;
data += " y" + (-1.0*(handUpDown) + handTurn).toFixed(2).toString();
}
if(this.yAxisGrbl == "e"){
if(this.yAxisGrbl == "e" && (mNew.eMotorChanged)){
data += " y" + (mNew.e * 180 / Math.PI).toFixed(2).toString();
}
if(this.zAxisGrbl == "x"){
if(this.zAxisGrbl == "x" && mNew.xMotorChanged){
data += " z" + (mNew.x).toFixed(2).toString();
}
if(this.zAxisGrbl == "y"){
if(this.zAxisGrbl == "y" && mNew.yMotorChanged){
data += " z" + (mNew.y * 180 / Math.PI).toFixed(2).toString();
}
if(this.zAxisGrbl == "z"){
if(this.zAxisGrbl == "z" && mNew.zMotorChanged){
data += " z" + ((mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI) ).toFixed(2).toString();
}
if(this.zAxisGrbl == "a"){
if(this.zAxisGrbl == "a" && mNew.aMotorChanged){
data += " z" + (mNew.a * 180 / Math.PI).toFixed(2).toString();
}
if(this.zAxisGrbl == "b"){
if(this.zAxisGrbl == "b" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
// This is the case of the Hand, when the Up-Down-Motor is connected to the FluidNC-Z
data += " z" + ( mNew.b * 180 / Math.PI ).toFixed(2).toString();
}
if(this.zAxisGrbl == "c"){
if(this.zAxisGrbl == "c" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
data += " z" + (mNew.c * 180 / Math.PI + (mNew.b * 180 / Math.PI) + (mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI)).toFixed(2).toString();
}
if(this.zAxisGrbl == "e"){
if(this.zAxisGrbl == "e" && (mNew.eMotorChanged)){
data += " z" + (mNew.e * 180 / Math.PI).toFixed(2).toString();
}
if(this.aAxisGrbl == "x"){
if(this.aAxisGrbl == "x" && mNew.xMotorChanged){
data += " a" + (mNew.y * 180 / Math.PI).toFixed(2).toString();
}
if(this.aAxisGrbl == "y"){
if(this.aAxisGrbl == "y" && mNew.yMotorChanged){
data += " a" + (mNew.y * 180 / Math.PI).toFixed(2).toString();
}
if(this.aAxisGrbl == "z"){
if(this.aAxisGrbl == "z" && mNew.zMotorChanged){
data += " a" + ((mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI) ).toFixed(2).toString();
}
if(this.aAxisGrbl == "a"){
if(this.aAxisGrbl == "a" && mNew.aMotorChanged){
data += " a" + (mNew.a * 180 / Math.PI).toFixed(2).toString();
}
if(this.aAxisGrbl == "b"){
if(this.aAxisGrbl == "b" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
data += " a" + (mNew.b * 180 / Math.PI+(mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI)).toFixed(2).toString();
}
if(this.aAxisGrbl == "c"){
if(this.aAxisGrbl == "c" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
data += " a" + (mNew.c * 180 / Math.PI + (mNew.b * 180 / Math.PI) + (mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI)).toFixed(2).toString();
}
if(this.aAxisGrbl == "e"){
if(this.aAxisGrbl == "e" && mNew.eMotorChanged){
// ToDo Mai 2024
data += " a" + (mNew.e * 180 / Math.PI).toFixed(2).toString();
}
if(this.bAxisGrbl == "x"){
if(this.bAxisGrbl == "x" && mNew.xMotorChanged){
data += " b" + (mNew.x).toFixed(2).toString();
}
if(this.bAxisGrbl == "y"){
if(this.bAxisGrbl == "y" && mNew.yMotorChanged){
data += " b" + (mNew.y * 180 / Math.PI).toFixed(2).toString();
}
if(this.bAxisGrbl == "z"){
if(this.bAxisGrbl == "z" && mNew.zMotorChanged){
data += " b" + ((mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI) ).toFixed(2).toString();
}
if(this.bAxisGrbl == "a"){
if(this.bAxisGrbl == "a" && mNew.aMotorChanged){
data += " b" + (mNew.a * 180 / Math.PI).toFixed(2).toString();
}
if(this.bAxisGrbl == "b"){
if(this.bAxisGrbl == "b" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
data += " b" + (mNew.b * 180 / Math.PI).toFixed(2).toString();
}
if(this.bAxisGrbl == "c"){
if(this.bAxisGrbl == "c" && (mNew.bMotorChanged || mNew.cMotorChanged || mNew.zMotorChanged)){
data += " b" + (mNew.c * 180 / Math.PI + (mNew.b * 180 / Math.PI) + (mNew.z * 180 / Math.PI) - (mNew.y * 180 / Math.PI)).toFixed(2).toString();
}
if(this.bAxisGrbl == "e"){
if(this.bAxisGrbl == "e" && mNew.eMotorChanged){
data += " b" + (mNew.e * 180 / Math.PI).toFixed(2).toString();
}
if(strCommand == "G1"){
data += " f"+(maxSpeedF.toFixed(2).toString())
}
if(this.tSocket && data.toString("utf-8").length > 3){
if(strCommand == "G1"){
data += " f"+(maxSpeedF.toFixed(2).toString())
}
if(!this.isTestMode){ console.log("" + this.urlGRBLstr + " gets the message: " + data.toString("utf-8"))}
this.tSocket.write( data.toString("utf-8") + "\r\n");
}