# A Heterogeneous Robotic Swarm for Long-Term Monitoring of Marine Environments
## 5 Swarm Behaviours
### Formation Control
In the case where agents were instructed to rotate the shape of their formation around its centre by 180\({}^{\circ}\), the formation control algorithm generated velocity signals to achieve the shortest path to the destination. Subsequently, the superposition of forces generated by the collision avoidance algorithm acted in the opposite direction, leading to oscillations in agent movement visible in Figure 1(b). In other words, when the formation control algorithm set a vehicle velocity which would have caused the agents to collide, the collision avoidance algorithm generated velocity in the opposite direction. Hence a modification of the virtual force formula to generate additional force perpendicular to the repelling force is proposed. With this addition, collision avoidance favours left-hand vehicle passing and situations where the system is stuck oscillating are avoided. The following vector is introduced:  
\[\mathbf{v}_{ji}=\frac{\mathbf{n}_{ji}+0.5*\mathbf{n}_{ji}*\mathbf{R}}{\parallel \mathbf{n}_{ji}+0.5*\mathbf{n}_{ji}*\mathbf{R}\parallel} \tag{8}\]  
where \(\mathbf{R}\) is a rotation matrix (9) providing counterclockwise rotation by 90\({}^{\circ}\) used in generating the perpendicular vector. \[\mathbf{R}= \begin{bmatrix}0&-1\\ 1&0\end{bmatrix}  \tag{9}\]  
The proposed modified virtual force replaces \(\mathbf{n}_{ji}\) with \(\mathbf{v}_{ji}\), resulting in the following expression:  
\[\Delta F_{i}= \begin{cases}\sum_{j=1}^{n}-\left(\frac{2k_{f}}{r_{ji}^{2}}+k_{g }\right)\mathbf{v}_{ji},&0<r_{ji}<r_{d}\\ 0,&r_{ji}\geq r_{d}\end{cases}  \tag{10}\]  
Using the same starting conditions and formation shape reference as in the previous simulations, experiments were reproduced using the modified collision avoidance algorithm and the results are shown in Figure 23. The modification to the algorithm reduced the aforementioned oscillations, shortening normalised stabilisation time to 4.2 s/m and making it closer in performance to results using the formation control algorithm without collision avoidance. In the following section, experimental  
Figure 22: Simulation results of rotating a formation around its centre by 180\({}^{\circ}\) without (**a**) and with (**b**) collision avoidance. results acquired using formation control with the modified collision avoidance algorithm on real vehicles will be presented. Experimental Results and Discussion  
Experimental results collected during field trials in Biograd na Moru, Croatia using three vehicles are shown in Figure 24. Figure 24a shows a decrease in normalised stabilisation time in comparison to simulations using the same algorithm, as well as an overall reduction in oscillatory behaviour. During the experiment, the aPads did not collide with each other as distances between them did not fall below the collision radius. Figure 24b shows a differently shaped formation rotating around its centre by 180\({}^{\circ}\). Stabilisation time increased to 23.8 s from the 12.2 s shown in Figure 24a, but normalised stabilisation time was smaller at 2.8 s/m compared to 3.1 s/m. These results validate the simulation results and the feasibility of using the formation control algorithm on actual vehicles in a real life environment. Additionally, experiments with four vehicles were conducted. The results of the experiments using different formation shape references are shown in Figure 25. The task given was the rotation of a four vehicle formation around its centre by 90\({}^{\circ}\). The results show noisier position measurements compared to previous experiments which negatively impact stabilisation time. For the experiment in Figure 25a, stabilisation time and normalised stabilisation time are 25.0 s and 6.1 s/m respectively. Increasing the victory radius to 1 m (as opposed to the originally selected 0.5 m) helps compensate for the higher position noise present in the four vehicle system and leads to the stabilisation time and  
Figure 23: Simulation results of rotating a formation around its centre by 180\({}^{\circ}\) with the modified collision avoidance algorithm.