## 3 Flight Coordination Control Methods
### Collision Detection and Avoidance Method  
For flight collision detection and avoidance, we adopt a collision-avoidance algorithm called the \"right-turn or stop\" method, as shown in Figure 8. In this algorithm, when UAV\({}_{n}\) detects a possibility of collision, it rotates to the right at an angle of \(\Delta_{\mathrm{A}}\) and flies for a certain time \(\Delta_{\mathrm{T}}\) to avoid the potential collision. If the collision is from the right-hand side of UAV\({}_{n}\), it stops flying and stays for a duration of time \(\Delta_{\mathrm{T}}\). Here, a collision occurs when there is a difference in flight direction between UAV\({}_{n}\) and another UAV\({}_{k}\) and we denote this difference as \(\Theta_{n,k}\). An usual collision is classified as \(\Theta_{n,k}\in\Phi_{\mathrm{f}}\), while a collision from the right-hand side is classified as \(\Theta_{n,k}\in\Phi_{\mathrm{r}}\). The parameter \(\Theta_{n,k}\) is calculated by  
\[\Theta_{n,k}=\left\{\begin{array}{ll}\theta_{n,k}-\theta_{n,n}&\theta_{n,k} \geqslant\theta_{n,n}\\ \theta_{n,k}-\theta_{n,n}+2\pi&\theta_{n,k}<\theta_{n,n}\end{array}\right., \tag{3}\]  
where the range of \(\theta_{n,n}\) for all values of \(n\) extends from \(0\) to \(2\pi\), excluding the point \(2\pi\) itself. Mathematically, it is denoted as \(\theta_{n,n}\in[0,2\pi)\) for all of \(n\in\{1,\cdots,N\}\). The range parameters of \(\Phi_{\mathrm{f}}\) and \(\Phi_{\mathrm{r}}\) are mathematically expressed by  
\[\Phi_{\mathrm{f}}=[\pi-\beta,\pi+\beta] \tag{4}\]  
and  
\[\Phi_{\mathrm{r}}=[\beta,\pi-\beta), \tag{5}\]  
respectively, where \(\beta\in[0,\pi/4]\) is a given parameter in the system.  
The proposed \"right-turn or stop\" algorithm is activated when a potential collision is detected. The collision-detection mechanism remains active with continuous calculation of the distance between two UAVs. If the distance between UAV\({}_{n}\) and UAV\({}_{k}\) satisfies the condition  
\[\left|\left|\left(x_{n,n},y_{n,n},z_{n,n}\right)-\left(x_{n,k},y_{n,k},z_{n,k} \right)\right|\right|_{2}<r_{n,n}+r_{n,k}, \tag{6}\]  
then a collision is assumed to occur. Here, \(x_{n,n}\), \(y_{n,n}\), \(z_{n,n}\), and \(r_{n,n}\) denote the local information of UAV\({}_{n}\), while \(x_{n,k}\), \(y_{n,k}\), \(z_{n,k}\), and \(r_{n,k}\) denote the shared information received from UAV\({}_{k}\). It is important to note that due to channel delays, the information available to UAV\({}_{n}\) may not always match the actual information of UAV\({}_{k}\). For instance, \(x_{k,k}\) may not equal \(x_{n,k}\) in a typical scenario. This discrepancy can introduce security risks stemming from inaccuracies. Increasing the frequency of information sharing among UAVs using the wireless transmission module LoRa or FSK in the Drone Mapper device is a possible solution, and reasonable allocation of wireless resources needs to be considered. We provide further evaluations related to this solution in the following section about experimental evaluations. For better understanding, we provide a flowchart of collision detection and the \"right-turn or stop\" avoidance algorithm in Figure 9 and Algorithm 1, respectively. Furthermore, we illustrate an example to show how to determine where the collision is coming from in Figure 10a.  
Figure 8: An example of a V2V-based collision-avoidance method.  
Figure 9: A flowchart of collision detection in the considered experiments.