# Three-Dimensional Formation Control for Robot Swarms
## 3 Assumptions and Definitions  
### Definitions  
We address the definitions used in this paper. Let \(min(a,b)\) return a smaller value between \(a\) and \(b\). According to graph theory [25], a graph \(G\) is defined as \(G=(V(G),E(G))\), in which \(V(G)\) represents the vertex set, and \(E(G)\) represents the edge set. In a graph, a _path_ is an alternative sequence of vertexes and edges. We say that \(G\) is _connected_ if one can find a connected path between any two vertexes in \(G\). Any two end vertexes of an edge in \(E(G)\) are _neighbors_ to each other. A _tree_\(T\) is a connected graph containing no cycles. A _spanning tree_ of \(G\) is a tree having all vertexes in \(G\). One vertex of \(T\) is selected as the _root_. Let \(v\) present one vertex in \(T\). In \(T\), \(p(v)\), the _parent_ of \(v\), defines the neighbor of \(v\) along the path to the root. Furthermore, \(c(v)\), _child_ of \(v\), defines a vertex, satisfying that \(v\) is the parent of \(c(v)\). A vertex having no children is called the _leaf_. A _descendant_ of \(v\) represents a vertex which is either \(c(v)\) or is the descendant of \(c(v)\) (recursively). An _ancestor_ of \(v\) represents a vertex which is either \(p(v)\) or is the ancestor of \(p(v)\) (recursively). Suppose \(N\) ARs are located in a 3D environment. Let \(u_{i}\) represent the \(i\)-th AR (\(i\in\{1,2,\ldots,N\}\)). In the inertial frame, let \(\mathbf{u}_{i}\in\mathcal{R}^{3}\) define the 3D location of \(u_{i}\) (\(i\in\{1,2,\ldots,N\}\)). Every AR has local communication modules. Among all ARs, only the leader, say, \(u_{1}\), is able to locate itself in global coordinates. In addition, the leader has a communication ability superior to all other ARs so that the leader can directly send a communication signal to any other AR inside the user-specified shape. Initially, all ARs are positioned such that one can find a connected path between any two ARs in the network. This _initial network connection_ is crucial since each AR maneuvers through local communication, while not relying on GPS. Utilizing the proposed formation controls, every AR maneuvers, while guaranteeing that the network connection is maintained. Let \(r_{s}\) present the maximum range of an AR local sensor. In addition, let \(r_{c}\) present the maximum range of AR local communication. Moreover, \(r_{sc}\) is defined as  
\[r_{sc}=min\big{(}r_{s},r_{c}\big{)}. \tag{1}\]  
The _coverage_ of an AR, say \(u_{i}\), represents a sphere with radius \(r_{sc}\), centered at \(\mathbf{u}_{i}\). Let _senseSphere_ of an AR present the boundary of the AR coverage. \(Q\) points are uniformly formed on the senseSphere of an AR \(u_{i}\). For instance, we address the process of building \(Q=20\times 20\) points on a senseSphere of \(u_{i}\). This method is used in MATLAB simulations (see Section 6). Centered at the \(y\)-axis, we rotate a vector \([r_{sc},0,0]\) by an angle in \([\frac{\pi}{10},\frac{2\pi}{10},\frac{3\pi}{10},\dots,2\pi]\). The rotation of \(\theta\) with respect to the \(y\)-axis is performed through the rotation matrix  
\[\mathbf{R}(\theta)=\left( \begin{array}{ccc}c(\theta)&0&s(\theta)\\ 0&1&0\\ -s(\theta)&0&c(\theta)\end{array} \right). \tag{2}\]  
Thereafter, centered at the \(z\)-axis, we rotate \(\mathbf{R}(\theta)[r_{sc},0,0]^{T}\) by an angle in \([\pi/10,2\times\pi/10,3\times\pi/10\dots,2\pi]\). The rotation of \(\psi\) with respect to the \(z\)-axis is performed through the rotation matrix  
\[\mathbf{R}(\psi)=\left( \begin{array}{ccc}c(\psi)&-s(\psi)&0\\ s(\psi)&c(\psi)&0\\ 0&0&1\end{array} \right). \tag{3}\]  
Thereafter, we calculate  
\[\mathbf{fp}(\psi,\theta)=\mathbf{R}(\psi)\mathbf{R}(\theta)[r_{sc},0,0]^{T}. \tag{4}\]  
By adding \(\mathbf{u}_{i}\) to \(\mathbf{fp}(\psi,\theta)\), we obtain the 3D coordinates of a point on a senseSphere of \(u_{i}\). \(\psi\) and \(\theta\) are selected from \([\pi/10,2\times\pi/10,3\times\pi/10\dots,2\pi]\), respectively. Therefore, one calculates \(Q=20\times 20\) points on a senseSphere of \(u_{i}\).