public int startNavigation() { if (mDrone == null) { System.Diagnostics.Debug.WriteLine("startNavigation -> mDrone null"); return(-1); } // Check: is Compass ready? if (!mDrone.iDroneCup_isCompassReady()) { System.Diagnostics.Debug.WriteLine("startNavigation -> Compass error"); return(-2); } // Check: is GPS ready? if (!mDrone.iDroneCup_isGpsReady()) { System.Diagnostics.Debug.WriteLine("startNavigation -> GPS not ready"); return(-3); } // Check: home coordinates missing? if (homeCoordinates.latitude == 0 || homeCoordinates.longitude == 0) { System.Diagnostics.Debug.WriteLine("startNavigation -> Home Coordinates not defined"); return(-4); } // Check: next waypoint missing? if (nextCoordinates.latitude == 0 || nextCoordinates.longitude == 0) { System.Diagnostics.Debug.WriteLine("startNavigation -> Next Waypoint not defined"); return(-5); } // Check: is the drone on ground or landing if (mDrone.iDroneCup_isLanded() || mDrone.iDroneCup_isLanding()) { System.Diagnostics.Debug.WriteLine("startNavigation -> mDrone landed or landing"); return(-6); } runNavigation = true; return(0); }