class RobotData{
    constructor(l1, l2, l3) {

        this.l1 = l1;   // Oberarm
        this.l2 = l2;   // Unterarm
        this.l3 = l3;   // Hand-Länge

        // Plan-Koordinaten - XYZ FingerSpitze
        this.x = 0;
        this.y = 0;
        this.z = 0;

        // Plan-Koordinaten - HandRichtung
        this.theta = 0.0; // Euler-Winkel zwischen Z-Achse und P - Breitengrad
        this.phi = 0.0;   // Euler-Winkel zwischen X-Achse  - Laengengrad
        this.psi = 0.0;   // Euler-Winkel: Drehung des Handgelenks abweichend vom Breitengrad

         // Motor-Koordinaten - Schulter, Ellebogen, Hand-Dreher
         this.xMotor = -70;
         this.alpha = .4; // =Y Motor
         this.beta = -.8; // =Z Motor = Winkel die der Unterarm unter der Y-Achse ist. 
 
         // Motor-Winkel fuer's Handgelenk
         this.a = 0.5;     // aMotor am Ellebogen
         this.b = 0.5;     // bMotor Handgelenk-Knicker
         this.c = 1.4;     // cMotor Hand-Dreher

         this.e = 10;        // Hand-Öffnung

         this.showFunctions = [];
    }

    receiveCoordinates(obj){
        this.x  = obj.position.x;
        this.y  = obj.position.y;
        this.z  = obj.position.z;
        
        this.xMotor = obj.motorCounts.x;
        this.alpha = obj.motorCounts.y;
        this.beta = obj.motorCounts.z;
        this.a = obj.motorCounts.a;
        this.b = obj.motorCounts.b;
        this.c = obj.motorCounts.c;

        this.e = obj.motorCounts.e;

        console.log("Received Coordinates " + this.xMotor+ ", "+ this.alpha+", "+this.beta);
        
    }
    showRobot(){
        
        for(const oneFunction of this.showFunctions){
            oneFunction(this);
        }
    }

}

robot = new RobotData(250,250,100)