## 3 Incorporation of DANNC and Collision-Obstacle Avoidance for a Group of UUVs
### Leader-Follower Formation Tracking
#### 3.1.2 Neural Network Control Term  
Because the dynamics of UUV have unmodeled and unknown terms, a neural network control \(u_{iNN}\) is introduced to compensate for these terms. Each following UUV will have a neural network term locally to keep track of the current estimates. Therefore, the control input for UUV \(i\) in Equation (13) is the added \(u_{iNN}\) term, which is given by following  
\[u_{in}=u_{iC}-u_{iNN} \tag{16}\]  
with  
\[u_{iNN}=\hat{W}_{i}^{\top}\varphi\left(\mathbf{x}_{i}\right) \tag{17}\]  
where \(\hat{W}_{i}\in R^{s_{i}\times m}\) is the estimation of \(W_{i}\), \(s_{i}\) is the number of neural network neurons for the UUV \(i\), \(m\) is the number of input values, and the input vector \(\mathbf{x}_{i}=\left(\eta_{ib},\mathbf{v}_{i}\right)^{\top}=\left(x_{ib},y_{ ib},\psi_{ib},u_{i},v_{i},r_{i}\right)^{\top}\in R^{6}\). That means \(m=6\) in this work. The activation function \(\varphi(\mathbf{x}_{i})\in R^{s\times 1}\).  
To guarantee the weight matrices of neural network retain bounded, the projection algorithm [5; 28] is adopted to update the parameters  
\[\dot{\hat{W}}_{i}=\Gamma_{iW}\Pr\left(\hat{W}_{i},\varphi_{i}\left(\mathbf{x} _{i}\right)e_{i}^{\top}PB\right) \tag{18}\]  
where \(\Gamma_{iW}\in R\) is a positive constant. \(\Pr\) is the projection operator (a matrix \(n\times m\)), with the general form described as  
\[\Pr(\mathbf{\Theta},\mathbf{Y},\mathbf{\Phi})=\left[\Pr(\theta_{1},y_{1}, \phi_{1}),...,\Pr(\theta_{m},y_{m},\phi_{m})\right] \tag{19}\]  
with  
\[\Pr(\theta_{i},y_{i},\phi_{i})=\left\{\begin{aligned} y_{i}- \frac{\bigtriangledown\phi_{i}(\theta_{i})(\bigtriangledown\phi_{i}(\theta_ {i}))^{\top}}{\parallel\bigtriangledown\phi_{i}(\theta_{i})\parallel^{2}}y_{ i}\phi_{i}(\theta_{i})&\text{if }\phi_{i}(\theta_{i})>0\wedge y_{i}^{\top}\bigtriangledown\phi_{i}(\theta_{i} )>0\\ y_{i}&\text{otherwise}\end{aligned}\right. \tag{20}\]  
where \(i=1\) to \(m\); \(\Theta=\begin{bmatrix}\theta_{1}&\cdots&\theta_{m}\end{bmatrix}\in R^{s \times m}\); \(\mathbf{Y}=\begin{bmatrix}y_{1}&\cdots&y_{m}\end{bmatrix}\in R^{s\times m}\); \(\mathbf{\Phi}=\begin{bmatrix}\phi_{1}&\cdots&\phi_{m}\end{bmatrix}\in R^{s \times m}\); \(\phi_{i}:R^{k}\to R\) is a convex function.  
In this work, \(\phi_{i}\) is chosen as  
\[\phi_{i}(\theta_{i})=\frac{\theta_{i}^{\top}\theta-\theta_{iM}^{2}}{\epsilon_ {\theta_{i}}\theta_{iM}^{2}} \tag{21}\]  
with \(\theta_{iM}\in R\) is a projection norm bound, and \(\epsilon_{\theta_{i}}\) is a projection tolerance bound.  
**Lemma 1** ([28]).: _The projection operator has an important property, which is given as_  
\[trace\{(\mathbf{\hat{\Theta}}-\mathbf{\Theta})^{\top}(\Pr(\mathbf{\hat{\Theta} },\mathbf{Y},\mathbf{\Phi})-\mathbf{Y})\}\leq 0 \tag{22}\]  
The objective here is to use the states from the neighbors of UUV \(i\) to evaluate the performance of the current control of UUV \(i\) with the current estimates \(\hat{f}_{i}(\mathbf{x}_{i})\) of the function \(f_{i}(\mathbf{x}_{i})\). This is done through online adjustment of the weight of the neural network \(\hat{W}_{i}\) in Equation (18).