# Data-Driven Control Algorithm for Snake Manipulator
## 4 Control Simulation of Snake Manipulator Based on Data-Drive
### Comparative Experimental Analysis  
In order to test the influence of intelligent agent single-episode training times and agent network setting on the control system, a comparative experiment was designed. The first group of simulations is the original network, but the number of single-process training episodes is 10. The simulation results are shown in Figure 13. In the second group of simulations, the number of single training episodes is set to 10, and the agent action network adds a hidden layer. The hidden layer is set to the full connection layer, and the number of network nodes is set to 150. The simulation results are shown in Figure 14. The third group of simulations is based on the second group of experiments. The number of single training episodes is set to 100. The simulation results are shown in Figure 15.  
As observed in Figure 13, the training simulation chart converges slowly and fluctuates greatly compared with Figure 11. The average error of the sampling sample is 0.0301, and the Mean Square Error (MSE) is \(4.7225\times 10^{-5}\). Compared with the simulation of 100 samples, the average error and MSE are larger. This shows that the number of training  
\begin{table}
\begin{tabular}{l l l l l} \hline \hline  & **FWA-BPNN-PID** & **12 th** & **1000 th** & **3000 th** \\ \hline Average & 0.0119 & 0.1420 & 0.0060 & 0.0034 \\ MSE (\(10^{-5}\)) & 2.543 & 8.119 & 0.265 & 0.284 \\ \hline \hline \end{tabular}
\end{table}
Table 2: Training error data of data-driven control method based on DDPG.  
Figure 13: The first group of simulations.  
samples is too small, which results in deterioration of the accuracy and stability of the control system.  
When comparing the training chart of Figure 13(a) to the training chart of Figure 13(a), we can observe that, after adding the network, the fluctuation value and convergence speed of the network do not change much. However, after increasing the network, the average error is 0.0271, and the MSE is \(8.2381\times 10^{-6}\). From numerical analysis, the increase in the number of network layers improves the accuracy and stability of the system.  
By comparing the training chart of Figure 15(a) with that of Figure 11, it can be concluded that the convergence speed of the network is faster when the number of samples is the same. However, there are large fluctuations in the early stage, and the overall training time is longer. The average error value of 0.0061, and the MSE value of \(1.1585\times 10^{-6}\) can be obtained from the sampling error curve. Compared with the original network, the control accuracy of the simulation training system is reduced, but the stability is improved. The simulation results are shown in Table 3.  
Figure 14: The second group of simulations.  
Figure 15: The third group of simulations.  
It can be observed from Table 3 that the number of samples and the number of network layers have an impact on the stability and accuracy of the system. Too few samples result in deterioration of the accuracy and stability of the control system. The control performance of the system can be improved by increasing the number of samples and training network layers. However, when the number of samples reaches a certain value, increasing the number of network layers can continue to improve the stability of the system. This, however, results in a decline in the accuracy of the system. In addition, increasing the number of samples and the number of network layers results in a longer training time of the system. In practical application, according to the needs of control, the number of samples of training or the number of network layers can be increased. This adjusts the manipulator control speed, stability, and accuracy to achieve a relative balance.