## 4 Software-Based Implementation of the System and the Mathematical Models of UUV and MM
To maintain the specified accuracy of MM working tool's movement along the trajectory in conditions of small but unavoidable displacements of the UUV in the stabilization mode, the method [27] was implemented in the system. On the basis of information about linear and angular displacements of the UUV from the initial position, this method allows finding coordinates of the vector \(\overset{\rightarrow}{x}\in R^{3}\) that defines the current desired position of the MM working tool on the object surface in the CS _Oxyz_ as follows:  
\[\overset{\rightarrow}{x}^{*}=R^{T}\Big{(}\overset{\rightarrow}{x}-\overset{ \rightarrow}{r}\Big{)},\] \begin{table}
\begin{tabular}{c c c} \hline \multicolumn{2}{c}{**Parameters**} & \multicolumn{2}{c}{**Values (Unit)**} \\ \hline \multirow{2}{*}{UUV} & L \(\times\) H \(\times\) W & \(1.2\times 1.5\times 0.9\)\((\mathrm{m}^{3})\) \\  & Mass & 170 (kg) \\ \hline \multirow{2}{*}{Link 1} & Length & 0.05 (m) \\  & Mass & 0.4 (kg) \\ \hline \multirow{2}{*}{Link 2} & Length & 0.5 (m) \\  & Mass & 4 (kg) \\ \hline \multirow{2}{*}{Link 3} & Length & 0.5 (m) \\  & Mass & 4 (kg) \\ \hline \multirow{2}{*}{Link 4} & Length & 0.1 (m) \\  & Mass & 0.5 (kg) \\ \hline \end{tabular}
\end{table} 
Table 1: Parameters of UUV and MM. Figure 7: A scene in the V-REP simulator. \[\text{where }R=\left[ \begin{array}{ccc}C\theta C\psi&C\theta S\varphi S\varphi-S \theta C\varphi&S\theta S\varphi+C\theta S\psi C\varphi\\ S\theta C\psi&C\theta C\varphi+S\theta S\psi S\varphi&S\theta S\psi C\varphi-C \theta S\varphi\\ -S\psi&C\psi S\varphi&C\psi C\varphi\end{array} \right]\]  
is the matrix of rotations of the CS \(Oxyz\) relative to the absolute CS, calculated taking into account the directions of its axes; \(S(0)=sin()\); \(C0=cos()\); \(\varphi,\psi,\theta\) are the roll, yaw and pitch angles of the UUV, respectively; \(\overset{\rightarrow}{r}\in R^{3}\) is the vector defining linear displacements of the UUV in the absolute CS; \(\overset{\rightarrow}{x}^{*}\in R^{3}\) is the vector defining the current desired position of the working tool's characteristic point in the CS \(Oxyz\). To provide accurate movements of the working tool along programmed trajectories, SCD [26] have been synthesized. These SCD generate control signals of the MM electric drives taking into account the estimated external torques in the respective drives, and also the variations in the viscous and coulomb friction torques in the drives that are identified by the additional observers. Figure 8 shows a block diagram of the subsystem for the dynamic control of movements of an UUV and its manipulator implemented in Matlab/Simulink. The acronyms used in the figure are as follows: TCB is the block for correcting the trajectory of the MM working tool [27]; MM and its SC are the model for the manipulator and the system of its control [26]; \(\overset{\rightarrow}{f}\in R^{3}\), \(\overset{\rightarrow}{m}\in R^{3}\) are the vectors of, respectively, force and torque effects of the manipulator on the UUV calculated by the IDP solving block [13]; UUV SS is the stabilization system [13] that forms the resulting vector of thrusts and torques \(\tau\in R^{6}\) created by the UUV thrusters to compensate for the vectors of the force \(\overset{\rightarrow}{f}\in R^{3}\) and torque \(\overset{\rightarrow}{\widetilde{m}}\in R^{3}\) effects from the manipulator; UUV NS is the navigation system of the UUV; \(\overset{\rightarrow}{\widetilde{x}}\) is the vector of the actual position of the MM working tool in the CS \(Oxyz\).