Unmanned aerial vehicle flying leg switching method based on leg distance and relative location vector dot product

The invention discloses an unmanned aerial vehicle flying leg switching method based on a leg distance and a relative location vector dot product. The unmanned aerial vehicle achieves the whole airline operation through switching of legs. A leg distance at the moment can be obtained according to a distance to go and a lateral deflection distance calculated in real time by a flight control computer. When a global position system (GPS) signal is normal during the whole journey, the leg switching method based on the leg distance is adopted. When the GPS signal is not effective, no leg switching is carried out. After the GPS signals are recovered, according to current position of the unmanned aerial vehicle and start point / finish point of the leg, the relative position vector dot product is calculated, the vector dot product and the calculated leg distance form a composite judging condition, and therefore the correct switching of the aerial leg of the unmanned aerial vehicle of all situations is achieved.