예제 #1
0
        public void Land(int timeout)
        {
            // We do not want to fly while landing
            lock (ThisLock)
            {
                FlyVector.ResetVector();

                Logger.Debug("Landing...");
                CommandTuple cmdTuple = new CommandTuple(1, 0, 3);

                SendNoParam(cmdTuple);

                Stopwatch sw = new Stopwatch();
                sw.Start();
                while (FlyingState.GetState() != FlyingState.State.Landed && sw.ElapsedMilliseconds < timeout)
                {
                    if (FlyingState.GetState() == FlyingState.State.Emergency)
                    {
                        break;
                    }

                    SmartSleep(100);
                }

                sw.Stop();
            }
        }
예제 #2
0
        public void TakeOff(int timeout)
        {
            Logger.Debug("Performing takeoff...");
            CommandTuple cmdTuple = new CommandTuple(1, 0, 1);

            if (FlyingState.GetState() == FlyingState.State.Landed || FlyingState.GetState() == FlyingState.State.UnKn0wn)
            {
                SendNoParam(cmdTuple);
            }
            else
            {
                return;
            }

            Stopwatch sw = new Stopwatch();

            sw.Start();
            while (FlyingState.GetState() != FlyingState.State.Hovering && FlyingState.GetState() != FlyingState.State.Flying && sw.ElapsedMilliseconds < timeout)
            {
                if (FlyingState.GetState() == FlyingState.State.Emergency)
                {
                    break;
                }

                SmartSleep(100);
            }

            sw.Stop();
        }
예제 #3
0
 public bool IsLanded()
 {
     return(FlyingState.GetState() == FlyingState.State.Emergency || FlyingState.GetState() == FlyingState.State.Landed);
 }