# Linear Parameter-Varying Model Predictive Control of AUV for Docking Scenarios
## Appendix A
#### Rigid-Body Dynamics Model
The hydrodynamic damping factors for marine vehicles may be classified as potential damping, viscous damping, wave drift damping, vortex shedding damping and lifting forces. The proposed model considers a nonlinear representation of damping effects with respect to instantaneous vehicle velocities, such that \(D(v)=[X_{D},Y_{D},Z_{D},K_{D},M_{D},N_{D}]^{T}\) with  
\[X_{D}=X_{uu}|u|u\] (A16)  
\[Y_{D}=Y_{vv}|v|v+Y_{rr}|r|r+Y_{L}\] (A17)  
\[Z_{D}=Z_{ww}|w|w+Z_{qq}|q|q+Z_{L}\] (A18)  
\[K_{D}=K_{pp}|p|p\] (A19)  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]0 (A20)  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]1 (A21)  
The set of actuators include the main thruster, side thrusters (front and rear) and fins (stern planes and rudders). They are characterized in terms of the type, the position and the orientation with respect to the vehicle-fixed reference frame and described below. The main thruster is positioned at the stern of the vehicle, aligned with the \(x\)-axis of the body-fixed reference frame, but it cannot provide forces, or moments, different from the force over this axis. The force generated by this thruster depends on the control action and its dynamics include different nonlinearities. The generated force \(X_{M}\) is modelled by the following relationship:  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]2 (A22)  
where \(\rho=1024\)\(\frac{\kappa g}{m^{3}}\) is the water density, \(u_{M}=n[\text{rpm}]\) is the control input (the required rotation speed), \(D_{0}=0.152\) m is the nominal thruster diameter, \(k_{t}(J)\) represents the nonlinear relationship between actual speed and control input such that:  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]3 (A23)  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]4 (A24)  
where \(J=u_{r}/(nD_{0})\), and \(u_{r}\) [m/s] is the vehicle forward speed with respect to the water, \(s\) is the Laplace variable, \(\omega_{n}=1\) Hz is the nominal frequency of the first-order actuator dynamic system representing the thruster-dynamics and \(\xi=1.5\) is the damping factor of the first-order actuator representing the thruster transition dynamics. The main rear thruster has two discontinuities in its dynamics, relating to the saturation (\(\pm\)2000 [rpm]) and dead zone (\(\pm\)400 [rpm]) in the control input channel. The fins are placed at the rear of the vehicle, near the main rear thruster. The dynamic response of the fins is directly related to vehicle pose and velocities, according to a set of relationships determined by the fins' lift coefficients. The force and moment provided by the rudder fins (\(Y_{r}\) and \(N_{r}\)), stern planes (\(Z_{s}\) and \(M_{s}\)) and their combined effects (\(K_{rs}\)) are:  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]5  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]6  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]7  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]8  
\[Y_{R}=-(W-B)\cos(\theta)\sin(\Phi)\]9  
The control input for the fins is the deviation angle with respect to the zero position (in the body-fixed reference frame, \(\delta_{r1,2}\) and \(\delta_{s1,2}\) for rudders and stern-planes, respectively), and it is subject to saturation on maximum/minimum values (\(\pm\)30 degrees) according to the specifications provided. The dynamics of the fins' angular position response, with respect to the reference provided by the control system, are represented by a second-order system with a natural frequency \(\omega_{n}=4\) Hz and a damping factor \(\zeta=0.7\). The side thrusters are placed on the side of the vehicle's hull to drive the AUV at low speeds when the forward speed of the vehicle is too low for the fins to provide an effective control action. Because of the orientation of the thruster set, with respect to the body-fixed reference frame, the effort provided by each thruster can be split into two components. Given the position and the orientation of the thrusters, the combination of the thrusters' effort may be modelled by the following relationships:  
\[\tau_{ST}=\left(