# A Heterogeneous Robotic Swarm for Long-Term Monitoring of Marine Environments
## 5 Swarm Behaviours
### Information Consensus
#### 5.2.1 Consensus Protocol for Sequenced Communication  
A distributed system of \(n\) integrator agents with dynamics \(\dot{x}_{i}=u_{i}\) is being considered, where \(x_{i}\in\mathbb{R}\) represents agent \(i\)'s state, whereas \(u_{i}\) is the control input. The goal of consensus protocols, in general, is to design a control algorithm that enables agents to reach a homogeneous stationary state \(x^{*}\in\mathbb{R}\), that is,  
\[x_{1}=x_{2}=\ldots=x_{n}=x^{*}. \tag{11}\]  
State variables \(x_{i}\) can correspond to some physical property. Initial states of all agents are represented by a vector \(x_{0}=[x_{1}(0)\ldots x_{n}(0)]^{T}\).  
Agents update their values based on the information exchanged via local communication with their neighbours. The underlying communication graph is defined as \(G=(V,E)\) with the set of nodes \(V=1,2,\ldots,n\) and edges \(E\subseteq V\times V\).  
An iterative form of the discrete-time consensus algorithm for reaching the average value of \(n\) integrator agents [27] is stated as follows:  
\[x_{i}(k+1)=x_{i}(k)+\epsilon\sum_{j\in N_{i}}(x_{j}(k)-x_{i}(k)), \tag{12}\]  
where \(k\) and \(k+1\) denote discrete time steps of the algorithm, and \(N_{i}=\{j\in V:(i,j)\in E\}\) represents a set of all nodes adjacent to the \(i\)th node, and \(\epsilon\in\langle 0,1\rvert\) is the step-size.  
The collective dynamics of the network under this algorithm can be written as  
\[x(k+1)=Px(k) \tag{13}\]  
with \(P=I-\epsilon L\). \(I\) is the identity matrix and \(L\) is known as _graph Laplacian of \(G\)_. Matrix \(L\) is defined as  
\[L=D-A \tag{14}\]  
where \(D=diag(d_{1},\ldots,d_{n})\) is the degree matrix of \(G\) with elements \(d_{i}=\sum_{j\
eq i}a_{ij}\) and zero off-diagonal elements. \(A=[a_{ij}]\) is the adjacency matrix of the graph \(\mathbb{G}\).  
The consensus algorithm (12) assumes synchronous information exchange at every time step k with no time delays, and its convergence into the average value of all initial states is mathematically proven [27]. Although some algorithms take into account systems with delayed and asynchronous communication [38], there are none to the authors' knowledge that operate under the scheduledsequenced communication. The following algorithm has been developed in [39] and is in short outlined below.  
The described behaviour is modelled through manipulating the Laplacian matrix to switch the communication topology depending on the current state of the system. The modified Equation (13) is given by  
\[x(k+1)=P^{\prime}x(k) \tag{15}\]  
with \(P^{\prime}=I-\epsilon L^{\prime}\), where \(L^{\prime}\) represents the graph Laplacian calculated as \(L^{\prime}=D^{\prime}-A^{\prime}\). Both \(D^{\prime}\) and \(A^{\prime}\) are calculated using a specially devised vector \(m\) used as a _mask_ of the underlying communication topology. Assuming a communication scheme as defined earlier and round-robin scheduling of time slots in a system of \(n\) agents, elements of vector \(m=(m_{j})\) are defined as  
\[m_{j}(t)=\begin{cases}1,&t=t_{1}+(i-1)T\\ 0,&otherwise\end{cases} \tag{16}\]  
where \(j=i\mod n\), and \(i\) represents the index of the time slot. Each change of the vector \(m\) triggers the execution of the algorithm described with (15). Degree and adjacency matrices are defined as  
\[D^{\prime} =diag(Am),\] \[A^{\prime} =A\;diag(m).\]