# On Unmanned Aerial Vehicles Light Show Systems: Algorithms, Software and Hardware
## 5 Simulation and Experiment Results
### Simulation  
Three methods are compared in the simulation. Method 1 is the traditional method which separates the task assignment and trajectory planning, i.e., task assignment is performed offline only before the formation transformation. Method 2* is the proposed dynamic formation transformation algorithm where a global TAP is solved offline once and local TAPs are formulated and solved in connected components online. Method 3 sets as a benchmark where global TAPs are solved online once collision avoidance movement occurs. The simulations consider a three-dimensional environment with the length, width, and height of \(50\times 50\times 50\) m. The initial and target states in the formation are randomly generated. The attractive gain coefficient \(\eta\) is set to 0.8, and the repulsive gain coefficient \(k_{p}\) is set to 0.3. The influence radius of repulsion point \(\rho_{o}\) is set to 2.3 m. The sampling time is 20 ms. A UAV is considered to have arrived at its target when the distance between them is less than 0.01 m.  
The simulation platform is MATLAB2020a running on a PC with AMD 3970X. It should be noted that only a single CPU core is utilized. The simulation is repeated 100 times in which the initial and target positions of the UAVs are randomly generated. For a fair comparison, the initial and target positions are the same for three methods in each test. The average computation time for each iteration, the average flight distance of the UAVs arrived at the target position, the maximum distance moved among the UAVs, the time taken for all UAVs to reach their targets and the number of the UAVs reached the destination are shown in Table 3.  
It can be seen that Method 1 has the shortest average computation time because the TAP is solved only once. The proposed Method 2* has a slightly longer computation time \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **Method 1** & **Method 2*** & **Method 3** \\ \hline Computation time (ms) & 9.55 & 13.8 & 21.6 \\ Flight distance (m) & 4.8327 & 4.8132 & 4.8027 \\ Maximum distance (m) & 16.3102 & 14.3991 & 14.3725 \\ Arrival time (s) & 73.63 & 62.01 & 61.62 \\ Arrived UAVs & 565.97 & 566.64 & 566.67 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Comparison of simulation results of the formation transformation of 600 UAVs using three methods. Figure 9: Schematic of the hardware components of the UAV-LS system. than Method 1 but it is far less than that of Method 3. However, the number of arrived UAVs for Method 2* and Method 3 is almost the same, and is larger than Method 1. The average flight distance and the maximum flight distance of Method 2* is slightly longer than Method 3 by only solving local TAPs in connected components, while Method 1 has the longest average flight distance and maximum flight distance since it solves a global TAP once offline without guaranteeing the optimality of the TAP during collision avoidance. Similarly, Method 1 has the longest arrival time, Method 2* and Method 3 are obviously lower than Method 1 which benefit from the TAP solution during the formation transformation. The targets of part of UAVs are updated after solving the TAP, and the flight distance is shortened so that all drones may transform the desired formation in a faster way. In conclusion, the proposed Method 2* achieves a good trade-off between performance and efficiency. Method 2* is better than the traditional static Method 1 in terms of flight distance, arrival time and arrived UAVs, and is also computationally efficient when compared to the global optimal Method 3. The initial and target positions of the UAVs are uniformly randomly generated in the simulation. While most UAVs are allocated to nearby targets with a straight-line trajectory, a small number of UAVs need to avoid inter-collisions hence deviate from the straight-line trajectories. Since the flight distance of the three methods is averaged in Table 3, the distance differences among the three methods seem small.