# Cooperative Multi-UAV Collision Avoidance Based on a Complex Network
## 3 Core Algorithm Analysis
### Representation of Cooperative UAV Flight and Conflict Detection
Let \(\varphi_{i}^{t}\) represent the angle of climb, which is the direction of speed \(V_{i}(t)\) in the vertical plane (measured from the \(x-y\) plane, with positive being the upwards direction and negative being the downwards direction). The maximum climb (tilt) angle, which is determined by the performance of the UAV, is defined to limit the maximum angle at which the UAV will rise and fall in the vertical plane when performing a CA mission, thus setting the maximum pitch change angle. The constraint can be expressed as follows:  
\[\varphi_{i,\text{min}}\leq\varphi_{i}(t)\leq\varphi_{i,\text{max}} \tag{2}\]  
The collection of points in the next time step is as follows:  
\[P(i)=\{s\in V\|\overset{\cdot}{R_{i}}-\overset{\cdot}{R_{s}}\|=v\cdot\Delta t ;\varphi_{\text{max}}=\arg\sin(|z_{i}-z_{s}|/\|\overset{\cdot}{R_{i}}- \overset{\cdot}{R_{s}}\|)\} \tag{3}\]  
Note that \(z_{i}\) and \(z_{s}\) are defined as the current attitude of \(UAV_{i}\) and the candidate attitude of \(UAV_{i}\) in the next time step, respectively. The symbols \(v\) and \(\Delta t\) refer to the absolute velocity of UAVs and time interval of each time step, respectively. When the first pair of UAVs involved in the conflict is detected, each UAV maintains its speed before the first pair of UAVs reaches the danger point to simplify the conflict situation. To determine if a threat of conflict exists, the scope and vertical criteria must be met. This time interval is defined as the time closest to the point of approach (CPA) on the horizontal plane:  
\[T_{h,ij}^{t}=\frac{\left|\overrightarrow{r}_{h,i}^{t}-\overrightarrow{r}_{h,j}^{t}\right|}{\left|\overrightarrow{v}_{h,i}^{t}-\overrightarrow{v}_{h,j}^ {t}\right|\cdot\cos(\alpha_{ij}^{t}-\beta_{ij}^{t})},(\overrightarrow{r}_{h,ij}^{t}\cdot\overrightarrow{v}_{h,ij}^{t}<0) \tag{4}\]  
\[\alpha_{ij}^{t}=\arctan(\left|\overrightarrow{r}_{x,ij}^{t}\right|/\left| \overrightarrow{r}_{y,ij}^{t}\right|) \tag{5}\]  
\[\beta_{ij}^{t}=\arctan(\left|\overrightarrow{v}_{x,ij}^{t}\right|/\left| \overrightarrow{v}_{y,ij}^{t}\right|) \tag{6}\]  
The formula defines \(T_{h,ij}^{t}\) as the time to CPA in the case of a horizontal plane between \(UAV_{i}\) and \(UAV_{j}\) at time \(t\). The subscript \(h\) indicates the horizontal plane, while \(i\) and \(j\) indicate the serial numbersof the UAVs. The equation is defined on the condition that the denominator is not equal to zero. The following equation is defined as the time CPA in the case of a vertical plane:  
\[T_{z,ij}^{t}=\frac{\left|\frac{\overrightarrow{r}_{z,ij}^{t}}{\overrightarrow{v }_{z,ij}^{t}}\right|},(\overrightarrow{r}_{z,ij}^{t}\cdot\overrightarrow{v}_{ z,ij}^{t}<0) \tag{7}\]  
A traffic alert (TA) event will be triggered if the following conditions are satisfied:  
\[(0<T_{h,ij}^{t}<T_{TA})\wedge(0<T_{z,ij}^{t}<T_{TA})\wedge(D_{h,ij}^{t+T_{h,ij }^{t}}<DMOR_{RA})\wedge(D_{z,ij}^{t+T_{h,ij}^{t}}<ZTHR_{RA}) \tag{8}\]  
\(DMOR_{RA}\) and \(ZTHR_{RA}\) are the range and altitude limit values for safe aviation, respectively, in case of the appearance of slow-closure-rate encounters which make the time threshold values not feasible. \(D_{h,ij}^{t+T_{h,ij}^{t}}\) and \(D_{z,ij}^{t+T_{h,ij}^{t}}\) are the horizontal and vertical distances between \(UAV_{i}\) and \(UAV_{j}\) at CPA, respectively. We used the time when the first pair of \(UAV_{s}\) triggers a TA alert. From that moment, we built a network where each UAV is represented as a node. If a pair of nodes collides, the node will establish a connection. At that moment, all nodes in the system will verify if they are approaching; if they are approaching each other, the two nodes are connected:  
\[(\overrightarrow{r}_{h,ij}^{t}\cdot\overrightarrow{v}_{h,ij}^{t}<0)\wedge( \overrightarrow{r}_{z,ij}^{t}\cdot\overrightarrow{v}_{z,ij}^{t}<0) \tag{9}\]  
In the case of a pair of UAVs, CA is based on the following principles. As shown in Figure 1, \(UAV_{1}\) cruises from the right side to the left side, whereas \(UAV_{2}\) and \(UAV_{3}\) cruise from the left side to the right side.