## 3 Gaussian-Process-Based MPC  
### MPC for AUV Control  
Model predictive control, as a method for resolving local optimal solutions, has demonstrated its efficacy in addressing constraints arising from the structure of the AUV itself and the surrounding environment during underwater operations. The MPC method solves an online optimization problem at each sampling interval based on current measurements. The first element of the resulting control sequence is then applied to the controlled system, and this process is repeated at subsequent time steps with the optimization problem continuously being updated using fresh measurements. To utilize MPC for controlling AUV motion, it is essential to discretize both the kinematic and dynamic models. Furthermore,when employing Gaussian-process-based MPC to analyze the efficacy of AUV control in 3D space trajectory tracking tasks, an approach involving the use of AUV acceleration as the input \(\mathbf{u}^{\prime}\in\mathbb{R}^{6}\) is adopted to alleviate the computational burden. The models can be reconstructed as follows:  
\[\dot{\mathbf{v}}=\mathbf{u}^{\prime} \tag{20}\]  
\[\dot{\mathbf{\eta}}=\mathbf{I}(\mathbf{\eta})\mathbf{v} \tag{21}\]  
where \(\mathbf{v}\) represents the linear velocity and \(\mathbf{\eta}\) represents the position and orientation of the AUV. Under the assumption of a sampling period \(T\), the aforementioned equations can be discretized in the following form:  
\[\frac{\mathbf{v}(k+1)-\mathbf{v}(k)}{T}=\mathbf{u}^{\prime}(k) \tag{22}\]  
\[\frac{\mathbf{\eta}(k+1)-\mathbf{\eta}(k)}{T}=\mathbf{J}(\mathbf{\eta}(k))\mathbf{v}(k) \tag{23}\]  
Set \(\mathbf{x}(k)=[\mathbf{v}(k),\mathbf{\eta}(k)]^{\mathrm{T}}\in\mathbb{R}^{12}\) to present the status input variable of the MPC at moment instant \(k\). In that way, the input variable at time instant \(k+1\) can be represented as follows:  
\[ \begin{split} x(k+1)=\left[\begin{array}{c}\mathbf{v}(k+1)\\ \mathbf{\eta}(k+1)\end{array}\right]&=\left[\begin{array}{c}T\mathbf{u}^{\prime}(k) +\mathbf{v}(k)\\ T\mathbf{J}(\mathbf{\eta}(k))\mathbf{v}(k)+\mathbf{\eta}(k)\end{array}\right]\\ &=\left[\begin{array}{c}\mathbf{v}(k)\\ T\mathbf{J}(\mathbf{\eta}(k))\mathbf{v}(k)+\mathbf{\eta}(k)\end{array}\right]+\left[\begin{array} []{c}T\mathbf{u}^{\prime}(k)\\ \mathbf{O}\end{array}\right]\\ &=\left[\begin{array}{cc}\mathbf{I}&\mathbf{O}\\ T\mathbf{J}(\mathbf{\eta}(k))&\mathbf{I}\end{array}\right]\left[\begin{array}{c}\mathbf{v}(k )\\ \mathbf{\eta}(k)\end{array}\right]+\left[\begin{array}{c}T\mathbf{I}\\ \mathbf{O}\end{array}\right]\mathbf{u}^{\prime}(k)\\ &=\left[\begin{array}{cc}\mathbf{I}&\mathbf{O}\\ T\mathbf{J}(\mathbf{\eta}(k))&\mathbf{I}\end{array}\right]x(k)+\left[\begin{array}{c}T \mathbf{I}\\ \mathbf{O}\end{array}\right]\mathbf{u}^{\prime}(k)\end{split}  \tag{24}\]  
Taking the Cartesian coordinates \((x,y,z,\phi,\theta,\psi)\) of AUV as the controlled output variable \(\mathbf{y}(k)\in\mathbb{R}^{6}\), Equation (24) can be rewritten in the following concise form:  
\[\mathbf{x}(k+1)=\mathbf{a}(k)\mathbf{x}(k)+\mathbf{b}(k)\mathbf{u}^{\prime}(k) \tag{25}\]  
\[\mathbf{y}(k)=\mathbf{c}(k)\mathbf{x}(k) \tag{26}\]  
With  
\[\mathbf{a}(k)=\left[\begin{array}{cc}\mathbf{I}^{\mathbf{\delta}\times 6}&\mathbf{O}^{\mathbf{ \delta}\times 6}\\ \mathbf{T}\mathbf{J}(\mathbf{\eta}(k))&\bm  
state sequence, and output sequence are compressed into vectors \(\mathbf{X}_{p}(k)\), \(\mathbf{U}(k)\), and \(\mathbf{Y}_{p}(k)\), respectively, as expressed below:  
\[\mathbf{X}_{p}(k+1|k)= \begin{bmatrix}\mathbf{x}(k+1|k)\\ \mathbf{x}(k+2|k)\\ \vdots\\ \mathbf{x}(k+p|k)\end{bmatrix}  \tag{30}\]  
\[\mathbf{U}(k)= \begin{bmatrix}\mathbf{u}^{\prime}(k|k)\\ \mathbf{u}^{\prime}(k+1|k)\\ \vdots\\ \mathbf{u}^{\prime}(k+p-1|k)\end{bmatrix}  \tag{31}\]  
\[\mathbf{Y}_{p}(k)= \begin{bmatrix}\mathbf{y}(k+1|k)\\ \mathbf{y}(k+2|k)\\ \vdots\\ \mathbf{y}(k+p|k)\end{bmatrix}  \tag{32}\]  
The three matrices mentioned above can be obtained through the following derivation process:  
\[