# A Hybrid Linear Quadratic Regulator Controller for Unmanned Free-Swimming Submersible
## 5 Proposed HLQR Controller Design  
The proposed controller, named as HLQR, is composed of two LQR controllers. The complete architecture of the HLQR is shown in Figure 8. The HLQR is a second order derivative controller. The required primary and secondary integrator blocks are highlighted in Figure 8. The primary LQR controller is responsible to remove the steady-state error and improves other parameters of the system's response (i.e., rise time and settling time). On the other hand, the secondary LQR controller plays a vital role in the robustness and handles the hydrodynamic disturbances in an efficient manner.  
The error of HLQR is controlled by \(K_{1}\) and \(K_{2}\) feedback gains for primary and secondary integrators, respectively. In Figure 8, the blocks represented as, A, B, C, and D are the state space metrics of head and pitch systems for UFSS, as shown in Equation (5), (6), (11) and (12), respectively. The controller settings (regulating) for the pitch and head systems of UFSS are accomplished by utilizing Equation (21). It allows to cut down the value of structure factor with weighted elements. This results in an efficient handling of error when the amplitude of water disturbances is varying with depth and direction.  
Concerning the structure of HLQR (shown in Figure 8), we have introduced the weighing matrix Q in primary and secondary integrator blocks. It allows diverting the system dynamics towards a specified value (R). Furthermore, it aids to stabilize the system with lesser energy [21]. It is important to note that Q and R are the configuration parameters that are normally required to design the LQR controller. The continuous-time linear system is written in Equation (15). Where, \(\dot{x}\) represents the secondary integrator of HLQR controller, as shown in Figure 8.  
\[\ddot{x} =A\dot{x}+Bu \tag{15}\] \[\dot{x} =Ax+Bu\] (16) \[y =Cx+Du \tag{17}\]  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**K** & **Overshoot** & **Settling Time** & **Rise Time** & **Peak Amplitude** \\ \hline
1 & 8.82\% & 22.8 s & 6.65 s & 0.787 \\
15 & 71.1\% & 28.6 s & 1.05 s & 1.67 \\
27 & undefined & undefined & undefined & increasing \\ \hline \hline \end{tabular}
\end{table}
Table 4: Pitch control system responses at different gains.  
Figure 8: Schematic diagram of HLQR and its integration into UFSS.  
\begin{table}
\begin{tabular}{c c c c c} \hline \hline
**K** & **Overshoot** & **Settling Time** & **Rise Time** & **Peak Amplitude** \\ \hline
1 & 6.06\% & 27.7 s & 8.88 s & 1.06 \\
15 & 70.6\% & 26.6 s & 1.07 s & 1.71 \\
27 & undefined & undefined & undefined & increasing \\ \hline \hline \end{tabular}
\end{table}
Table 5: Head control system responses at different gains.  
The control activity magnitude may likewise be remembered for the cost work of the UFSS. Equation (18) defines the cost function of the LQR controller.  
\[J=\int_{0}^{\infty}(x^{T}Qx+u^{T}Ru+2x^{T}Nu)dt \tag{18}\]  
As shown in Figure 8, the \(K_{1}\) and \(K_{2}\) blocks are feedback gains of primary and secondary integrators and these are configured by Riccati equation, presented in Equations (19) and (20) [22]. The Equation (21) is the simplified form of Equation (19) which is used to calculate the value for \(K_{2}\). A required matrix, termed as weighing matrix \(Q\), is constructed for the shifting of complex conjugate poles to complex plane as given in Equation (21).  
\[0=K_{1}A+A^{T}K_{1}+Q-K_{1}BR^{-1}B^{T} \tag{19}\]  
\[K_{2}=-R^{-1}B^{T}K_{1} \tag{20}\]  
\[q_{11}^{\sim}=\frac{2(\sigma^{2}+\alpha^{2})-2(\beta^{2}+\omega^{2})}{h_{11}+h _{22}} \tag{21}\]  
where in Equation (21), the term \(h\) represents the solution elements of the matrix \(\alpha\pm j\beta\) (these are the old complex eigenvalues) and \(\sigma\pm j\omega\) (these are the desired complex eigenvalues).