## 5 Control Algorithms for UAV Networking
### Decentralized Control Algorithm
#### 5.2.2 Artificial Potential Field (APF)  
Artificial potential field (APF) is an effective method in UAV formation control, especially in path planning and collision avoidance problems. Some studies have improved APF to solve the local minima [105] and jitter problems in three-dimensional space [106]. Figure 30 illustrates the artificial potential field method in UAV formation control. In it, a UAV is shown in the center, surrounded by four neighboring UAVs, representing other members in the formation. A large circle surrounds the central UAV, representing the area of influence of the potential field. Within this area, the central UAV can sense the status of neighboring UAVs through sensors or wireless communication. The central UAV has arrows connecting to neighboring UAVs, representing the interaction between them. Each neighboring UAV shows that it is within the area of influence of the central UAV. The status of neighboring UAVs is used as input to the artificial potential field function. It determines the appropriate direction of movement to maintain the formation. An improved APF method is proposed to help UAVs escape from local minima by adding a rotational force field and using a \"leader-follower\" model to maintain the  
Figure 30: Description of the range of force action represented by a circle using the artificial potential force field method. desired formation while ensuring system stability through the Lyapunov function [107]. During collision avoidance, APF can be combined with the virtual structure and the leader-follower model to ensure that the UAVs maintain an equilateral triangle formation. The gravitational force directs the UAVs to the target, and the repulsive force helps to distribute the UAVs reasonably on the virtual sphere surface. It allows the UAVs to choose the optimal path to overcome obstacles [108]. Some other studies have used the mass point model with kinematic constraints to design the gravitational force field between UAVs to ensure convergence to the desired formation from any initial condition. To suit the crowded environment with many dynamic and static obstacles, the improved APF is combined with the formation division method. It supports the UAV to change formation flexibly when encountering obstacles [109]. In environment with communication networks between UAVs, a distributed collision avoidance algorithm is designed based on the improved APF and consensus theory. It assists UAVs not only in avoiding collisions but also in quickly recovering the desired formation and reaching a consensus on distance, altitude, and velocity [110]. In particular, in complex urban environments, the APF can be combined with positioning information to minimize the risk of navigation errors, helping UAVs adjust their position and altitude quickly with high reliability [111]. For high-density UAV formations, such as drone light shows, the APF-based path planning algorithm is applied to optimize the motion of multiple UAVs. It helps to avoid trajectory oscillation and improve flight performance [112]. In the UAV group model, the improved APF is integrated with the quadratic consensus algorithm, enabling UAVs from any initial state to form a formation and fly to the target, while avoiding collisions by smoothing the potential force field [113]. In addition, the APF can be integrated with the sliding mode control method to achieve simultaneous formation control and target tracking, which enables UAVs to quickly establish a formation and minimize flight shaking [114]. Some studies have also proposed a method to control UAV formations in clusters using the k-means algorithm to optimize gravitational forces between UAVs, combined with virtual cores to ensure flexible formations adaptable to complex flight conditions [115]. Artificial potential force field (APF) is a powerful and effective method for UAV formation control, especially in path planning, collision avoidance, and formation stability problems.