# A Lateral-Directional Control Method for High Aspect Ratio Full-Wing UAV and Flight Tests
## 3 Lateral-Directional Control Law Design
### Lateral-Directional Trajectory Tracking Control Law Based on VF  
Presently, the flight path of the UAV is still dominated by a linear trajectory, and a mission path is composed of many linear trajectories. The linear trajectory is usually defined by waypoints, and the line segment defined by two waypoints is a straight line trajectory, as shown in Figure 6.  
In practical applications, the drone cannot reach the waypoint accurately, so it is necessary to design the switching logic of the waypoints. One way is by judging the distance between the drone and its waypoint: assuming that the UAV is tracking path \(i\), then when the distance between the drone and waypoint \(i+1\) is less than \(R\), the tracking path is switched to \(i+1\). However, the flying speed of the high aspect ratio full-wing UAV in this paper is too low, and it may not be able to reach the waypoint in a strong wind. Therefore, it is necessary to supplement the switching logic. Another way is by judging the relative position of the drone and its path: assuming that the UAV is tracking path \(i\), the dotted line in Figure 6 passes through the waypoint \(i+1\) and is perpendicular to path \(i\). When the drone passes through this dotted line, the tracking path is switched to \(i+1\). Figure 7 shows the calculation process of the waypoint switching logic. First, \(C_{wp}\) and \(L_{wp}\) are the current and last target waypoints, so the line between the two waypoints is the current path. \(wp_{n}\) is the number of waypoints. \(C_{wp}<1\) or \(C_{wp}>wp_{n}\) are irrational; when this happens, set \(C_{wp}=1\). When \(C_{wp}=1\), set \(L_{wp}=wp_{n}\); thus, let the waypoints form a closed loop. Second, determine whether the waypoint needs to be switched considering the distance between the drone and the waypoint or the relative position of the path. If necessary, add one to the current waypoint, which is \(C_{wp}+=1\). \(C_{upx}\).\(C_{upy}\).\(L_{upy}\).\(L_{upx}\) and \(L_{upy}\) are the east and north positions of the current and last target waypoints. Figure 6: Waypoints and paths. \(P_{x}\) and \(P_{y}\) are the drone's positions. Finally, calculate the direction angle of the straight line path \(\psi_{t}\) and the distance between the drone and path \(d\). Presently, most small UAVs use the global navigation satellite system (GNSS) to get 3D position information in the World Geodetic System 1984 (WGS84) coordinate system. WGS84 is too complex for small UAVs. In order to simplify the calculation, the Earth is approximated as a sphere. After ignoring the flying height, the relative distance between the two points can be expressed as:  
\[ \begin{cases}x=R_{e}\cos{(lat2)}(lat2-lat1)\\ y=R_{e}(lon2-lon1)\end{cases}  \tag{20}\]  
where \(x,y\) are the distances between the two points in the east and north. \(R_{e}=6371\) km is the average radius of the Earth. \(lat1,lon1,lat2\), and \(lon2\) are the latitudes and longitudes of the two points. During the experiment, all the positions are obtained by calculating the relative positions in relation to Waypoint 1. When analyzing a straight path separately, the position relationship between the drone and the path is as shown in Figure 8.  
Figure 7: Switching logic of the waypoints. \(d\) is the distance between the drone and the path. \(\psi_{t}\) is the direction angle of the straight line path. When the error between the course angle \(\chi\) and the yaw angle \(\psi\) is not considered:  
\[d=V_{e}\sin\left(\psi-\psi_{t}\right) \tag{21}\]  
Based on the vector field (VF) trajectory tracking theory, the yaw angle control command can be expressed as:  
\[\psi_{c}=\psi_{t}-\psi^{\infty}\frac{2}{\pi}\tan^{-1}(K_{d}d)+2\pi m \tag{22}\]  
When \(d\) is large enough, the UAV is directed to approach the path at a \(\psi^{\infty}\) angle, so the range of \(\psi^{\infty}\) is \(\left(0,\frac{\pi}{2}\right]\). \(m\) is an integer that ensures \(-\pi<\psi_{c}\leq\pi\). Obviously, Formula (22) does not consider the effect of the velocity. Usually, the higher the speed, the smaller \(K_{d}\) should be.