# Discrete-Time Position Control for Autonomous Underwater Vehicle under Noisy Conditions
## 3 Discrete-Time Controller Design in Trajectory Tracking
### Discrete-Time Control Law  
For a continuous system, as a rule, there are two methods to design a discrete-time controller, either by discretizing an analog controller, or by building a discrete-time model of a continuous system and subsequently deriving the discrete-time controller. The difference between these two methods is that the first one uses the derivative of the system state in the control law. However, the system state is obtained through sensors that are affected by the noise, and thus, if the control law contains the derivative of the state of the system, it will increase the influence of the noise factor. Therefore, the second method is adopted in this work. Hence, Equation (1) can be rewritten as follows:  
\[M_{RB}\dot{v}+M_{A}\dot{v}+C(v)v+D(v)v+g(\eta)=\tau \tag{9}\]  
let \(f(t)=C(v)v+D(v)v+g(\eta)\), and one can obtain:  
\[M_{RB}\dot{v}(t)+M_{A}\dot{v}(t)+f(t)=\tau(t) \tag{10}\]  
In Equation (10), \(f(t)\) and \(M_{A}\) are assumed to be unknown. In other words, only the parameter \(M_{RB}\) is known. For the sampling time \(T\), the control input generated from the discrete-time controller is considered to be constant during the sample interval, on account of zero-order holder (see Figure 2). Thus, the control input \(\tau(t)\) remains constant \(\tau(k)\) from time \(kT\) to time \((k+1)T\). The relationship between the control input and the consequent velocity is presented in Figure 3. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Symbol** & **Description** & **Unit** \\ \hline \(T\) & The sampling time & \(s\) \\ \(\eta(k)\) & The real position at time \(kT\) & \(m\) \\ \(\eta_{r}(k)\) & The reference position at time \(kT\) & \(m\) \\ \(\dot{\eta}(k)\) & The estimated position generated by proposed & \(m\) \\  & modified algorithm at time \(kT\) & \(m\) \\ \(\vec{\mathbf{r}}^{\prime}(k)\) & The estimated position error at time \(kT\), & \(m\) \\ \(\vec{\mathbf{q}}^{\prime}(k)=\eta_{r}(k)-\dot{\mathbf{q}}(k)\) & The position error at time \(kT\), & \(m\) \\ \(\vec{\mathbf{q}}(k)\) & \(\vec{\mathbf{q}}(k)=\mathbf{\eta}_{r}(k)-\eta(k)\) & \(m/s\) \\ \(v(k)\) & The real velocity at time \(kT\) & \(m/s\) \\ \(v_{r}(k)\) & The reference velocity at time \(kT\) & \(m/s\) \\ \(\dot{\sigma}(k)\) & The estimated velocity generated by proposed & \(m/s\) \\  & modified algorithm at time \(kT\) & \(m/s\) \\ \(\vec{\mathbf{v}}^{\prime}(k)\) & The estimated velocity error at time \(kT\), & \(m/s\) \\  & \(\vec{\mathbf{v}}(k)=\mathbf{v}_{r}(k)-\dot{\mathbf{v}}(k)\) & \(m/s\) \\ \(\vec{\mathbf{v}}(k)\) & The velocity error at time \(kT\), & \(m/s\) \\ \(\vec{\mathbf{v}}(k)=\mathbf{v}_{r}(k)-\mathbf{v}(k)\) & & \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The nomenclature. Figure 3: Schematic diagram of the transformation from control input to velocity. By integrating Equation (10) concerning the time over the sample interval,  
\[\mathbf{M}_{\mathbf{RB}}(\mathbf{v}(k+1)-\mathbf{v}(k))+\mathbf{H}(k)=T\mathbf{\tau}(k) \tag{11}\]  
where  
\[\mathbf{H}(k)=\mathbf{M}_{\mathbf{A}}(\mathbf{v}(k+1)-\mathbf{v}(k))+\int_{kT}^{kT+T}\mathbf{f}(\xi)d\xi \tag{12}\]  
with \(\mathbf{H}(k)\) representing the entire uncertainty of the AUV hydrodynamics. According to [17], Equation (11) is considered to be an accurate discrete-time model of the continuous system of Equation (10). From Equation (11), one can write the following:  
\[\mathbf{v}(k+1)=\mathbf{M}_{\mathbf{RB}}^{-1}(T\mathbf{\tau}(k)-\mathbf{H}(k))+\mathbf{v}(k) \tag{13}\]  
The control law is given as follows:  
\[\mathbf{\tau}(k)=T^{-1}(\mathbf{M}_{\mathbf{RB}}(\mathbf{u}(k)-\hat{\mathbf{v}}(k))+\hat{\mathbf{H}}(k)) \tag{14}\]  
where  
\[\mathbf{u}(k)=\mathbf{J}^{-1}(\hat{\mathbf{\eta}}_{\mathbf{r}}(k+1)+\mathbf{K}_{\mathbf{P}}\hat{\mathbf{ \eta}}^{\prime}(k)+\mathbf{K}_{\mathbf{D}}\hat{\mathbf{\eta}}^{\prime}(k)) \tag{15}\]  
with \(\mathbf{K}_{\mathbf{P}}\) and \(\mathbf{K}_{\mathbf{D}}\) being the proportional gain matrix and the derivative gain matrix, respectively.