## 4 Verification and Analysis  
The underwater robot in the simulation example [35] has a body length of 1.33 m, an inner diameter of 0.36 m, a mass of 31.41 kg, and a rotational inertia of \(I_{2}=1.77\times 10^{-1}\) kg\(\cdot\)m\({}^{2}\) around the \begin{table}
\begin{tabular}{c} \hline \hline
**Adaptive Gaussian Pseudo-Spectral Algorithm** \\ \hline
**(1) Step 1:** Import the mathematical models for robot dynamics optimization control. \\
**(2) Step 2:** Set algorithm optimization parameters. \\
**(3) Step 3:** The state variable LG allocation and control variable pair LG allocation in the first stage are used to obtain a finite dimensional NLP optimization solution problem. \\
**(4) Step 4:** Solve the NLP problems. If the solution is successful, proceed to step 5. Otherwise, determine whether LG point reselection is needed. If so, proceed to step 3. Otherwise, the solution ends. \\
**(5) Step 5:** In the second stage of point allocation reconstruction, the slope change is calculated based on the solution results of the first stage, and the control variable LG is reconstructed to obtain a new finite dimensional NLP problem. Then, the step 6 is entered. \\
**(6) Step 6:** Solve the finite dimensional NLP problems. If the solution is successful, end the process. Otherwise, \\ determine whether LG point reselection is needed. If it is necessary, proceed to step 3. Otherwise, end the process. \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Pseudocode of the adaptive Gaussian pseudo-spectral algorithm. body coordinate system, \(I_{y}=I_{z}=3.45\) kg\(\cdot\)m\({}^{2}\). The length of the \(y\)-axis and \(z\)-axis from the driver to the connected coordinate system is 0.075 m. In addition, assuming that the center of gravity and center of gravity of the robot coincide, the gravity and buoyancy of the robot are equal, and the density of water is 1000 kg/m\({}^{3}\). Using a control moment gyroscope for attitude control of underwater vehicles, in order to avoid the loss of steering effect and reduced maneuverability caused by zero or low speed of underwater vehicles. The parameters of the control torque gyroscope are as follows: the radius of the control torque gyroscope rotor is 0.048 m, the width is 0.05 m, and the installation angle is 54.7\({}^{\circ}\). The constant speed of a single control torque gyroscope rotor is about 15,000 r/min, with a moment of inertia of \(3.25\times 10^{-3}\) kg\(\cdot\)m\({}^{2}\), and the angular momentum of a single control torque gyroscope rotor is 5 kg\(\cdot\)m\({}^{2}\)/s. The structural parameters of the pyramid shaped gyroscope group are as follows: the bottom layout width is 0.24 m, the frame height is 0.15 m, and it can be placed inside the underwater robot to achieve attitude control of the underwater robot. Due to the fact that the driving method used in this design relies on the interaction between the driver and water, the greater the driving force, the greater the impact on the surrounding flow field. Therefore, it is necessary to consider constraining the maximum values of multiple sets of driving forces and based on this, calculate the optimal control of the underwater robot. According to the driving performance of the driver, the control constraints for the resultant force and resultant torque applied to the robot are set to 20 N and 15 Nm, respectively. Using Simulink software to build a simulation model of the underwater robots, corresponding robot dynamics models and control system models were established based on the above model parameters and setting conditions, and comparative simulation tests and analysis of dynamic optimal control were conducted. In the simulation, the velocity of water flow in the x-axis, y-axis, and z-axis directions is set to 0.1 m/s. The industrial robot starts from the coordinate origin and ends at (20, 10, 5). The CVP method utilizes the approximate control effect of piecewise functions to transform the optimal control problem into a class of NLP problems for a solution.