# A Heterogeneous Robotic Swarm for Long-Term Monitoring of Marine Environments
## 5 Swarm Behaviours
### Formation Control  
As the developed underwater monitoring system is used for data collection or the detection of underwater events, effective interpretation of collected sensor data relies on knowing the positions of all agents in the system while submerged. Therefore, it stands to reason that long-term monitoring system deployment requires an autonomous method of underwater localisation. As previously mentioned, aPads can be used as a type of localisation anchor within the subCULTron swarm. In underwater sensor localisation, anchors positioned at known locations provide the source of information necessary for the localisation of unlocalised underwater nodes. In range-based types of localisation, unlocalised nodes collect measurements to gather information about the ranges between them and anchors with known positions. Then, using these measurements and simple algorithms such as multilateration, the unknown node positions can be calculated. In the process of underwater node localisation, it is advantageous to ensure proper spatial configuration of the anchors [25; 26]. For this reason, a formation control algorithm based on achieving information consensus was developed. The formation control algorithm used in this paper is based on the algorithm proposed in [13]. The collision avoidance algorithm used virtual force as expressed with (7) to repel neighbouring vehicles if they were within the repelling radius. \[\Delta F_{i}= \begin{cases}\sum_{j=1}^{n}-\left(\frac{2k_{j}}{\gamma_{ji}^{2}}+ k_{\delta}\right)\mathbf{n}_{ji},&0<r_{ji}<r_{d}\\ 0,&r_{ji}\geq r_{d}\end{cases}  \tag{7}\]  
where \(\Delta F_{i}\) is the sum of virtual forces between vehicle \(i\) and other vehicles in its formation, \(k_{r}\) and \(k_{\delta}\) are regulation parameters, \(r_{ji}\) is the Euclidean distance between vehicle \(j\) and \(i\), and \(r_{d}\) is the radius of the repelling zone around the vehicle. \(\mathbf{n}_{ji}\) is the normalised vector which points from vehicle \(i\) to vehicle \(j\), the mathematical expression of which is: \(\mathbf{n}_{ji}=\frac{\boldsymbol{\eta}_{j}-\boldsymbol{\eta}_{i}}{\left\| \boldsymbol{\eta}_{j}-\boldsymbol{\eta}_{i}\right\|}\) where \(\boldsymbol{\eta}\) is the position of a vehicle in the x-y coordinate plane. The simulation results for formation control experiments without collision avoidance and experiments with collision avoidance added are shown in Figure 22. Let us say that the largest width of the aPad is not larger than 1 m, which is then defined as the collision radius. For safety reasons, the repelling radius for collision avoidance is set to 2 m. It can be seen from the experiment shown in Figure 22a that the distance between vehicles falls below 1 m during the rotation of the formation, which means that collision would happen in a real life experiment. In Figure 22b the same experiment was reproduced with a collision avoidance algorithm added. During the simulation, the distances between vehicles noticeably do not fall below the defined collision radius, instead oscillating around the repelling radius while the vehicles were circling around each other. In order to quantify results and enable comparison, formation stabilisation time is introduced. Stabilisation time is defined as the time it takes for all errors in desired distances between agents to fall and stay below a threshold of 0.5 m, called a victory radius, after a change in formation shape reference. This time is heavily dependent on the differences between the original and new formation shape, meaning the distance each agent needs to traverse in order to change formation shape greatly impacts stabilisation time. For that reason, normalised stabilisation time is defined by dividingdetermined stabilisation time with the longest distance between the starting and ending points of an agent's trajectory. While the collisions were mitigated by introducing virtual force as described in [13], the stabilisation time increased from 10.6 s to 32.7 s, while normalised stabilisation time increased from 2.8 s/m to 8.6 s/m.