Beispiel #1
0
    /// <summary>
    /// Main Method of the UAV Control Logic
    /// Will be called when the System is fully loaded and running
    /// If this Mehthod is completed the Program will exit :-(
    /// </summary>
    public override void run()
    {
        initialised = true;                 // Wir sind fertig mit dem Laden und Starten unser eigentliches Programm daher erlauben wir auch den Empfang von Daten der Bodenstation
        servo1.ConnectHardware();
        //// public ParameterPID (UAVParameter pG, UAVParameter iG, UAVParameter dG, UAVParameter pv, UAVParameter diff, UAVParameter output,UAVParameter sp)
        //PID_Höhe = new PID(kp_Höhe, ki_Höhe, kd_Höhe, lagesensor["theta"], lagesensor ["gyroalphastrich"],PID_Out_Höhe, sp_Höhe);
        //PID_Quer = new PID(kp_Quer, ki_Quer, kd_Quer, lagesensor["phi"], lagesensor ["gyrogammastrich"],PID_Out_Quer, sp_Quer);

        ////starte 100Hz Schleife  //keine Ahnung wie das geht
        //  lagesensor.DataRecieved+=new UAVCommons.UAVStructure.ValueChangedHandler(Ausgaberoutine);
        //    servo1.DoubleValue = -100;
        counter = 0;
        do       // läuft immer durch damit run nicht beendet und somit das Programm beendet wird
        {
            Thread.Sleep(10);
            // Console.WriteLine("Counter: " + servo1.DoubleValue);
            counter++;
            //  servo1.DoubleValue++;
            servo1.DoubleValue = counter;
            servo2.DoubleValue = counter;
            servo3.DoubleValue = counter;
            servo4.DoubleValue = counter;
            servo5.DoubleValue = counter;

            PWM.UpdateServos();
            Console.WriteLine("throttle" + this.kd_Höhe.MaxDoubleValue);
            //  servo1.DoubleValue = counter;
            //  servo1.DoubleValue = counter;
            if (counter == 99)
            {
                counter = 0;
            }
        } while (running == true);
    }