# Unmanned Surface Vehicle Using a Leader-Follower Swarm Control Algorithm
## 2 USV Modeling and Leader-Follower Swarm Formation
### Modeling of the Leader-Follower Swarm Formation  
The USV uses the method of moving two thrusters independently. At this time, assuming that the thruster does not cause slip or cavitation in water, the USV has nonholonomic constraints such as Equations (3) and (4).  
\[\dot{X}_{c}\sin\theta_{c}-\dot{Y}_{c}\sin\theta_{c}=0 \tag{3}\]  
\[\begin{bmatrix}\dot{X}_{c}(t)\\ \dot{Y}_{c}(t)\\ \dot{\theta}_{c}(t)\end{bmatrix}=\begin{bmatrix}\cos(\theta_{c}(t))&0\\ \sin(\theta_{c}(t))&0\\ 0&1\end{bmatrix}\begin{bmatrix}v_{c}(t)\\ w_{c}(t)\end{bmatrix} \tag{4}\]  
Here, \(X_{c}(t)\) and \(Y_{c}(t)\) denote the X and Y axes of the USV, and \(\theta_{c}(t)\) denotes its direction angle. The \(v_{c}(t)\) and \(w_{c}(t)\) denote the linear and angular velocities of the USV, and \(v_{c}\) and \(w_{c}\) denote the control input of the USV.  
Figure 2 shows a kinematic model of a leader-follower swarm with nonholonomic constraints.  
The leader USV is expressed using the subscript L, and the follower USV is expressed using the subscript F. The variables \(X_{L}\) and \(Y_{L}\) represent the current position of the leader USV, and \(\theta_{L}\) is its direction angle. Similarly, \(X_{F}\) and \(Y_{F}\) denote the current position of the follower USV, and \(\theta_{F}\) denotes its direction angle. Additionally, \(v_{L}\) and \(v_{F}\) indicate the straight-line speed of each USV. The distance coordinates \(d_{X}\) and \(d_{Y}\) between the leader USV and the follower USV are expressed in the Cartesian coordinate system as Equation (5)  
\[\begin{array}{l}d_{X}(t)=X_{L}(t)-X_{F}(t)=-d(t)\cos(\phi(t)+\theta_{L}(t)) \\ d_{Y}(t)=Y_{L}(t)-Y_{F}(t)=-d(t)\sin(\phi(t)+\theta_{L}(t))\end{array} \tag{5}\]  
Here, the current position of the follower USV is expressed as a relational expression with the leader USV as Equation (6).  
\[\begin{array}{l}X_{F}(t)=X_{L}(t)+d\cos(\phi(t)+\theta_{L}(t))\\ Y_{F}(t)=Y_{L}(t)+d\sin(\phi(t)+\theta_{L}(t))\end{array} \tag{6}\]  
Here, the distance \(d^{2}=d\chi^{2}+d_{Y}{}^{2}\) between the leader USV and the follower USV is the azimuth \(\phi(t)=\tan^{-1}\left(\frac{d_{Y}}{d_{X}}\right)-\theta_{L}(t)+\pi\) between the leader USV and the follower USV.  
Figure 2: Kinematic model of the leader–follower unmanned surface vehicles.  
The role of the follower USV is to take a position with a specific distance and a specific angle designated by the land operation console relative to the position of the leader USV and to follow the trajectory. Equation (7) express the formation position of the USV following the leader USV.  
\[\begin{split} X_{F}^{d}(t)&=X_{L}(t)+d_{ref}\cos \Bigl{(}\phi_{ref}+\theta_{L}(t)\Bigr{)}\\ Y_{F}^{d}(t)&=Y_{L}(t)+d_{ref}\sin\Bigl{(}\phi_{ ref}+\theta_{L}(t)\Bigr{)}\\ &\theta_{F}^{d}(t)=\theta_{L}(t)\end{split} \tag{7}\]  
Here, \(X_{F}^{d}(t)\) and \(Y_{F}^{d}(t)\) indicate the position to be attained by the follower USV, and \(d_{ref}\) is the distance between a trajectory to be followed by the leader USV and the follower USV. In this case, the distance cannot be negative, so it is always expressed as a positive number. The \(\phi_{ref}\) represents the angle that the follower USV aims to maintain from the leader USV, and this value is expressed as a constant, not a function. By differentiating Equation (7), the coordinate change in the follower USV can be obtained Equation (8).  
\[\begin{split}\dot{X}_{F}^{d}(t)&=v_{L}(t)\cos( \theta_{L}(t))-d_{ref}\sin(\phi_{ref}+\theta_{L}(t))w_{L}(t)\\ \dot{Y}_{F}^{d}(t)&=v_{L}(t)\sin(\theta_{L}(t))+d_{ ref}\cos\Bigl{(}\phi_{ref}+\theta_{L}(t)\Bigr{)}w_{L}(t)\end{split} \tag{8}\]  
The definitions of the variables and conditions related to these equations can be found in [20].