# A Relative Coordinate-Based Topology Shaping Method for UAV Swarm with Low Computational Complexity
## 2 System Model  
A UAV swarm (target topology shape is a cube denoted by the blue dots) consisting of \(N\) homogeneous nodes in a 3D Euclidean space is shown in Figure 1. All UAV nodes can obtain the relative distance between each other without external localization information.  
The coordinate system of the initial topology is constructed based on the inter-distance between nodes. Given that the coordinates of node \(i\) in the initial topology are \(\textbf{x}_{i}=[a_{i},\ b_{i},\ c_{i}]^{T}\in\mathbb{R}^{3\times 1},i=1,\ 2,\ \ldots,\ N\), and \(\textbf{X}=[\textbf{x}_{i}^{T}]_{N\times 1}=[\textbf{x}_{1},\ \textbf{x}_{2},\ \textbf{x}_{3},\ \ldots,\ \textbf{x}_{N}]^{T}\in \mathbb{R}^{N\times 3}\) denotes the coordinate matrix of initial topology. The distance between node \(i\) and \(j\) in the initial topology is denoted as \(\delta_{ij}\), where  
\[\delta_{ij} =\left\|\textbf{x}_{i}-\textbf{x}_{j}\right\|\] \[=\sqrt{\left(a_{i}-a_{j}\right)^{2}+\left(b_{i}-b_{j}\right)^{2}+ \left(c_{i}-c_{j}\right)^{2}}, \tag{1}\]  
and \(\left\|.\right\|\) denotes the Euclidean norm.  
The coordinate system of target topology is constructed based on the inter-distance derived from the topology shape. Assuming that the coordinates of position \(l\) in the target topology are \(\mathbf{z}_{l}=[a_{l},b_{l},c_{l}]^{T}\in\mathbb{R}^{3\times 1},l=1,2,\ldots,N\), and \(\mathbf{Z}=[\mathbf{z}_{1}^{T}]_{N\times 1}=[\mathbf{z}_{1},\mathbf{z}_{2}, \mathbf{z}_{3},\ldots,\mathbf{z}_{N}]^{T}\)\(\in\mathbb{R}^{N\times 3}\) denotes the coordinate matrix of target topology. The distance between \(z_{l}\) and \(z_{m}\) is denoted by  
\[d_{lm}=\|\mathbf{z}_{l}-\mathbf{z}_{m}\|. \tag{2}\]  
The energy consumption \(c_{i,l}\) from node \(i\) to position \(z_{l}\) in the topology forming process is assumed to be only related to the Euclidean distance between \(x_{i}\) and \(z_{l}\). Here, for the convenience of analysis, the coordinate origin and standard direction of the target coordinate system are assumed to be overlapped with the initial coordinate system, thus  
\[c_{i,l}=\|\mathbf{x}_{i}-\mathbf{z}_{l}\|. \tag{3}\]  
The energy consumption matrix, formed by the energy consumption of all possible mapping relationships, is denoted as  
\[\mathbf{C} =[c_{i,l}]_{N\times N}\] \[=\left[\begin{array}{ccccc}c_{1,1}&c_{1,2}&c_{1,3}&\cdots&c_{1,N}\\ c_{2,1}&c_{2,2}&c_{2,3}&\cdots&c_{2,N}\\ c_{3,1}&c_{3,2}&c_{3,3}&\cdots&c_{3,N}\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ c_{N,1}&c_{N,2}&c_{N,3}&\cdots&c_{N,N}\\ \end{array}\right]. \tag{4}\]  
Figure 1: An example of topology mapping for UAV swarm.  
Let \(M_{i,l}\) denote the mapping relationship between \(\mathbf{x}_{i}\) and \(\mathbf{z}_{l}\), \(M_{i,l}=1\) means that the target position of \(\mathbf{x}_{i}\) is \(\mathbf{z}_{l}\), otherwise, \(M_{i,l}=0\). \(\mathbf{M}=[M_{i,l}]_{N\times N}\) is the matrix of mapping relationship, which is expressed by  
\[\mathbf{M} =[M_{i,l}]_{N\times N}\] \[=\left[\begin{array}{cccc}M_{1,1}&M_{1,2}&M_{1,3}&\cdots&M_{1,N} \\ M_{2,1}&M_{2,2}&M_{2,3}&\cdots&M_{2,N}\\ M_{3,1}&M_{3,2}&M_{3,3}&\cdots&M_{3,N}\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ M_{N,1}&M_{N,2}&M_{N,3}&\cdots&M_{N,N}\\ \end{array}\right]. \tag{5}\]  
Only when \(M_{i,l}=1\) will the \(c_{i,l}\) in \(\mathbf{C}\) be chosen to calculate the global energy consumption \(C_{g}\) of topology forming. \(C_{g}\) is expressed by  
\[C_{g}=\left\|\mathbf{CM}^{T}\right\|_{1}=\sum_{i=1}^{N}\sum_{l=1}^{N}c_{i,l}M_ {i,l}, \tag{6}\]  
where \(\left\|.\right\|_{1}\) denotes the entrywise matrix norm [36].  
In the following sections, according to the system model described above, the initial coordinate system is first established to determine the relative coordinates of the initial topology. Then, based on the target topology shape, the target coordinate system is established to obtain the coordinates of each target position. Finally, the optimal coordinate mapping relationship for topology shaping is derived with the minimized global energy consumption.