# Affine Formation Maneuver Control for Multi-Agent Based on Optimal Flight System
## 4 Formation Control with Virtual Leader
### Discussion  
The experiments primarily focused on determining the optimal trajectory of each agent for affine maneuver control, revealing that a single mode of control may lack generality in complex environments to some extent. The proposed algorithm has been validated to be effective, particularly in addressing situations involving colliding obstacles. From the experiments, it was observed that each agent in the swarm autonomously carried out obstacles' detection, judgment, and decision-making, compared with the original algorithm. The virtual leader mainly influenced an agent if it was likely to enter the zone where obstacles react, while the other agents continued to track desired trajectories with less effect from the virtual leader forces and reach predefined positions. Notably, even in the presence of abrupt changes in trajectories or obstacles, the proposed algorithm remained effective. From Figures 7-9, it is demonstrated that the purpose of the proposed algorithm is to guarantee the configuration change to avoid the collision autonomously and maneuver continuously to track the predefined trajectory of an affine image set \(A(r)\). Thus, Figure 7b shows that the random formation is generated at the beginning and starts to form the nominal configuration and then reach each \(A(r)\) (\([p_{i}^{*}]^{T}\) from \([p_{i}]^{T}\)). However, a pre-defined trajectory would not avoid the obstacles effectively and could not provide the capability of changing velocity \(\mathbf{v}\) suddenly. Therefore, the proposed model is introduced to deal with the problem. It is shown that 11 desired positions have been pre-defined in Figure 7, and the original path shows the possibility of collision. Note that system of detecting and steering each agent is determined by distance \(||p_{i}-p_{obstacle}||\) only. In any case, the formation steered by an affine-based maneuver method would fall apart and lose the body integrity when encountering the obstacles. Moreover, a virtual leader is designed to operate based on the pre-defined trajectory of the centroid of the pre-defined configurations as Figure 3 demonstrates, denoted as \(p_{d}^{pl}\) (12). The advantage of this virtual strategy lies in its ability to enhance system functionality without significantly increasing complexity. Firstly, this strategy does not interfere with the formation motion. Secondly, the trajectory of the virtual agent is constructed based on the existing pre-defined trajectory. Lastly, this virtual agent can be seamlessly integrated into  
Figure 9: Simulation results of global algorithm: (**a**) acceleration of agents; (**b**) velocity error of agents; (**c**) minimum distance between agents; (**d**) trajectory error of agents. the control protocol, serving as an adjustment metric. Thus, the virtual leader introduced into the algorithm can modify the formation motion and improve the effectiveness of formation maneuvering. In order to evaluate the effectiveness of the proposed method, we use two indexes to evaluate the motion results. Table 1 intuitively shows the average value of all the experimental results with motion speed and track accuracy. It can been seen from Table 1 that the proposed method had the highest accuracy value. However, the time has been taken larger than that of the affine-based maneuvering method, which is due to the complexity of the proposed being higher than the affine-based maneuvering method (\(O(L^{2})\) and \(O(2L)\)). The second term Speed shows that the affine-based maneuvering took up 40 s, and the proposed method used 450 s. Obviously, the proposed method would use more time than the classic one with higher computational cost. Firstly, based on \(p^{*}(t)=[I_{n}\otimes A(t)]r+I_{n}b(t)\) (22), the classic method basically solved the changeable problem of formation configurations for multi-agent. Then, the proposed method took more within each time step due to the calculation from Algorithm 1 (15). The obstacle added to the experiment scenario is depicted in Figure 9(a), which is based on Figure 8(a).