# Affine Formation Maneuver Control for Multi-Agent Based on Optimal Flight System
## 3 Agent Motion by Forces
### APF-Based Virtual Leader Forces  
Previous research on affine-based formation control [21; 22] primarily relies on prior information about obstacles. However, when realistic constraints are introduced into the control law, such as communication loss or sudden situations, the proposed algorithm may not successfully navigate. This is due to the unknown obstacles causing the loss of rigidity during the transition to a predefined configuration. To address this issue, this paper introduces the APF-based virtual leader, which is more suitable for driving a large group of UAVs to make sudden changes in flight direction. The APF assists agents in local trajectory planning, ensuring that the force range between the virtual leader and the real agents remains appropriate. The dynamic generation of control forces for smooth group navigation is achieved through the use of APF, which effortlessly enables the swarm to navigate around obstacles  
Figure 2: Affine-based predefined configurations patterns for illustration: (**a**) Nominal; (**b**) rotation and scaling; (**c**) scaling; (**d**) shear; (**e**) shear and scaling; (**f**) linear style. It should be noted that in this paper, the dotted line segments only represent the outlines of the shape, but not the connectivity of the graph. Agents are sequentially numbered from 1 to 5 (marked at the center of the agent). while maintaining cohesion. The APF of the virtual leader is determined by each agent's position and the current placement of the virtual leader. The initial position of the virtual leader can be defined as the centroid of the real leaders group. To achieve the desired formation with a rigid body and ensure equilibrium for all agents, the virtual leader should be placed at the centroid, which can be defined as follows:  
\[p_{vl}=1/N\sum_{i=1}^{N}p_{l} \tag{12}\]  
As illustrated in Figure 3, our approach enhances the maneuverability of the affine-based formation by incorporating a virtual leader alongside conventional leader. This enables agents to change their flight direction and replan their local trajectories. Consequently, agents can interact with multiple obstacles, adaptively adjusting their local trajectories while iteratively evaluating collision possibilities. This concept allows for responsive behavior to environmental changes, as the APF directs agents away from obstacle positions towards new equilibrium positions. The equilibrium position for each agent is determined by following the steepest gradient towards the geometric point where the sum of these virtual forces is zero. The followers then track the plan of the virtual leader at the local level, seamlessly integrating trajectory planning with formation control. The virtual leader is initially positioned at the centroid of the leaders. The use of artificial potential between the virtual leader and the agents is illustrated in Figure 4. The virtual leader potential function is simply a function of each agent's position and the virtual leader's current placement. Let \(U_{ij}(||\mathbf{p}_{ij}||)\) represent a non-negative smooth pairwise artificial potential function associated with the relative distance between agent \((i,j)\). It governs the collective and individual movement within the swarm, which satisfies:  
\[U_{ij}(||\mathbf{p}_{ij}||)=\left\{ \begin{array}{ll}a\ln(||\mathbf{p}_{ij}||)+\frac{b }{c(||\mathbf{p}_{ij}||)^{2}}&||\mathbf{p}_{ij}||\leq d_{sen}\\ a\ln(r)+\frac{b}{c(r)^{2}}&||\mathbf{p}_{ij}||>d_{sen}\end{array} \right. \tag{13}\]  
where \(i,j=1,2,\ldots,N,i\
eq j\), \(a\), \(b\) and \(c\) are positive constants, \(U_{ij}(||\mathbf{p}_{ij}||)\) is bounded and continuously differentiable over interval \([0,+\infty)\). \(\
abla(b/\left(||\mathbf{p}_{ij}||\right)^{2})\) describes the gradient negative cube odd function, which is not defined at 0 point.