# Three-Dimensional Obstacle Avoidance Strategy for Fixed-Wing UAVs Based on Quaternion Method
## 6 Simulation
Figure 10 g shows the attitude, including the roll, pitch and yaw angle. During the period (\(t\) = 17.2-18.8 s), the yaw angle continues to decrease, indicating that the UAV has adopted the strategy of avoiding obstacles on the right side. The sudden increase in the attack angle and the sideslip angle are shown in Figure 10h reflects the fact that the \(b\)-frame cannot be aligned with the \(s\)-frame immediately due to the existence of the UAV's moment of inertia. As shown in Figure 10d, \(\mathbf{q}_{ds}^{*}\) has undergone two obvious divergence and reconvergence processes after experiencing the initial disturbance and then converging to 0. The first time is the process of converging to the obstacle avoidance point in the avoidance mode, and the latter is the process of re-converging to the destination point in the guidance mode. Figure 9: (**a**) Trajectory of fix-wing UAV and obstacle in inertial coordinate system, (**b**) distance between fixed-wing UAV and obstacle (Simulation 1). Simulation 2: Fixed avoidance plane with different rotation angles: \(\delta_{1}=0^{\circ}\), \(\delta_{2}=45^{\circ}\), \(\delta_{3}=-45\) and \(\delta_{4}=90^{\circ}\). We also performed a simulation where the UAV does not update the avoidance plane but chooses a fixed avoidance plane with a pre-set rotation angle, while the initial state and control parameters are the same as before. The simulation was implemented to quantify the impact of the rotation angle of the obstacle avoidance plane on the obstacle avoidance. Figure 11a shows four trajectories of the UAV with different avoidance planes. It can be seen from Figure 11b that different avoidance planes mainly affect the minimum distance and avoidance time in the macroscopic view. When the obstacle avoidance plane rotation angle is \(\delta=90^{\circ}\), 45, the flight time is 46.2 s and 44.9 s, respectively. However, the flight time is 42.4 s when the obstacle avoidance plane rotation angle is \(\delta=0^{\circ}\) or \(-45\), and the trajectory is smoother. When we adopted the strategy of updating the rotation angle, under the same initial conditions, the flight time was 41.35 s, which is less than that in the fixed avoidance plane case. By analyzing the minimum distance between the UAV and the moving obstacle, we can observe that the algorithm adopting an updated avoidance plane can guarantee a less conservative avoidance trajectory. The reason for this difference is that in the fixed-angle avoidance plane, the choice of the avoidance velocity cannot always be guaranteed to be the smallest deviation from the original velocity; thus, the UAV flew over an unnecessarily long path. As shown in Figure 11b the minimum distance between the UAV and the obstacle was 113.84 m when the rotation angle of avoidance planes was defined as \(\frac{\delta}{4}\). This is because the velocity of the UAV and the moving obstacle are almost simultaneously in the \(S^{\delta}\) plane during the avoidance stage. Therefore, comparing the fixed avoidance plane and updated avoidance plane implementations of the method, we found that the latter guarantees the trajectory to be a less conservative and faster process. Figure 10: Related parameters of fix-wing UAV (Simulation 1): (**a**) status signal of UAV, (**b**) control input, (**c**) thrust, (**d**) attitude tracking error, (**e**) error of angular velocity, (**f**) velocity in inertial coordinate system, (**g**) attitude, (**h**) alpha and beta.