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(); } }
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(); }
public bool IsLanded() { return(FlyingState.GetState() == FlyingState.State.Emergency || FlyingState.GetState() == FlyingState.State.Landed); }