# Affine Formation Maneuver Control for Multi-Agent Based on Optimal Flight System
## 4 Formation Control with Virtual Leader
### Proof of Main Results  
In this subsection, the primary outcomes of the motion consensus and formation control protocol for a UAV swarm with virtual agents are presented, supported by the following theorem. The formation stability of the novel control protocol is theoretically analyzed and proved, as stated in the following theorem. **Theorem 1**. : _Supposing a disordered swarm of agents is described by (5) in dynamics and steered by protocol (20) in formation control, if the interaction between agents within the graph \((G,p)\) is undirected and connected for the whole time, \(Z_{0}\) is denoted as the sum of total artificial potential (formation, virtual agent and obstacles), and then the following conclusions are:_  
1. _The graph is connected mutually if_ \(Z_{0}<U_{r}\) _for all_ \(t\geq 0\)_._
2. _Obstacles collision can be prevented between the agent and obstacles if_ \(Z_{t}<U_{0}\)_._
3. _The trajectories of all agents converge to the desired values asymptotically._  
Proof of Theorem 1.: We firstly prove part 1 of Theorem 1. For the sake of simplicity and without sacrificing generality, it is assumed that \(M(1\leq M\leq N)\) agents function as leaders. Therefore, the kinematic error of the leaders in the system is defined as follows:  
\[\left\{ \begin{array}{l}\widetilde{\mathbf{p}}_{i}=\mathbf{p}_{i}-\mathbf{p}_{d}\\ \widetilde{\mathbf{v}}_{i}=\mathbf{v}_{i}-\mathbf{v}_{d}\end{array} ,i=1,2,\ldots,M\right. \tag{24}\]based on the fact that the global trajectory is twice differentiable with respect to time and all agents have access to global information. It also satisfies that \(\hat{\mathbf{p}}_{d}=\mathbf{v}_{d}\), \(\hat{\mathbf{v}}_{d}=\mathbf{u}_{d}\) and we have \(\widetilde{\mathbf{p}}_{ij}=\widetilde{\mathbf{p}}_{i}-\widetilde{\mathbf{p}}_{j}\); \(\dot{\widetilde{\mathbf{p}}}_{i}=\widetilde{\mathbf{v}}_{i}\), \(\ddot{\widetilde{\mathbf{v}}}_{i}=\widetilde{\mathbf{u}}_{i}\). Given that \(Z_{t}\) represents the summation of the total relative kinetic energy of an agent at time \(t\), it can be deduced that:  
\[Z(t)=1/2{\sum_{i=1,i\in O}^{N}}\Big{\{}[U_{i}(||\widetilde{\mathbf{p}}_{ij^{ \prime}}||)]+C_{2}(\mathbf{p}_{i}-\mathbf{p}_{d})^{\mathsf{T}}(\mathbf{p}_{i}-\mathbf{p}_{d})+ C_{3}(\mathbf{v}_{i}-\mathbf{v}_{d})^{\mathsf{T}}(\mathbf{v}_{i}-\mathbf{v}_{d})\Big{\}} \tag{25}\]  
Denote \(V_{i}={\sum_{i=1,i\in O}^{N}}\Big{\{}\widetilde{\mathbf{p}}_{i}^{\mathsf{T}} \widetilde{\mathbf{p}}_{i}+U(||\widetilde{\mathbf{p}}_{i}||)\Big{\}}\) as the total artificial of agent \(i\). Then in the error system, \(Z(t)\) can be re-written as follows:  
\[Z(t)=\frac{1}{2}{\sum_{i=1,i\in O}^{N}}\big{[}V_{i}+\widetilde{\mathbf{v}}_{i}^{ \mathsf{T}}\widetilde{\mathbf{v}}_{i}\big{]} \tag{26}\]  
It can be easily demonstrated that \(Z(t)\) is positive semi-definite, making it a suitable candidate function for Lyapunov analysis. Considering the symmetry of \(U_{ij}\) with respect to \(\widetilde{\mathbf{p}}_{ij}\), we have the following:  
\[\frac{\partial U_{i}}{\partial\widetilde{\mathbf{p}}_{ij^{\prime}}}=\frac{ \partial U_{i}}{\partial\widetilde{\mathbf{p}}_{i}}=-\frac{\partial U_{i}}{ \partial\widetilde{\mathbf{p}}_{j^{\prime}}} \tag{27}\]  
Thus, we have  
\[\frac{d}{dt}\bigg{(}\frac{1}{2}{\sum_{i=1,i\in O}^{N}}V_{i}\bigg{)}={\sum_{i =1,i\in O}^{N}}\Big{\{}\widetilde{\mathbf{v}}_{i}^{\mathsf{T}}(\
abla_{p_{i}}U_{ i})+C_{2}\widetilde{\mathbf{v}}_{i}^{\mathsf{T}}\widetilde{\mathbf{p}}_{i}\Big{\}} \tag{28}\]  
where \(U_{i}={\sum_{i\in O}^{N}}U_{ij^{\prime}}(||\widetilde{\mathbf{p}}_{ij^{\prime}}||)\), \(j^{\prime}\) means other agents, obstacles, and virtual leaders.