Пример #1
0
        static void ApplyABA(string predVal)
        {
            var needGoUp = currentHeight < targetHeight; // Should the drone go upwards?
            var goingUp  = double.Parse(predVal) > 0;    // Is the drone going upwards?

            if (needGoUp && goingUp)
            {
                bci_client.PutEvent(new BufferEvent("shrdcontrol.prediction", 2, -1));
            }
            else if (!needGoUp && !goingUp)
            {
                bci_client.PutEvent(new BufferEvent("shrdcontrol.prediction", -2, -1));
            }
            else if (needGoUp && !goingUp)
            {
                // What to do when need to go up, but going down?
                bci_client.PutEvent(new BufferEvent("shrdcontrol.prediction", 0, -1));
            }
            else if (!needGoUp && goingUp)
            {
                // What if need to go down, but going up?
                bci_client.PutEvent(new BufferEvent("shrdcontrol.prediction", 0, -1));
            }
        }