## 4 Simulation and Results Discussion  
To verify the control effect of the PID controller optimized by a genetic algorithm, the circular trajectory which is commonly used in industrial applications is selected as the trajectory. The system control block diagram is shown in Figure 7. The trajectory equation is as follows,  
\[ \begin{array}{c}X_{P}=0.03-0.03\cos(50t)\\ Y_{P}=0.03\sin(50t)\\ \theta=\pi/6\end{array}  \tag{18}\]  
The radius of the circle where the active revolute joints are located is \(R\) = 0.25 m. The radius of the circle where the triangle of the mobile platform is located is \(r\) = 0.0825 m; the length of the links \(l_{1}\) = \(l_{2}\) = 0.16 m; the concentrated mass of the links \(mg\) = 0.2 kg; the concentrated mass of the moving platform \(mp\) = 1 kg. To better describe the trajectory tracking error, \(e_{i}\) (\(i\) = 1, 2) are defined as the tracking errors. The control parameters of the classic PID controller are \(K_{p}\)1 = 10, \(K_{i1}\) = 100, \(K_{d1}\) = 5, \(K_{p2}\) = 0.35, \(K_{\text{i2}}\) = 500, \(K_{d2}\) = 0.0003. \[\left\{ \begin{array}{c}e_{1}=\sqrt{\big{(}x_{p}-x_{d}\big{)}^{2}+\big{(}y_{p }-y_{d}\big{)}^{2}}\\ e_{2}=\sqrt{\big{(}x_{g}-x_{d}\big{)}^{2}+\big{(}y_{g}-y_{d}\big{)}^{2}}\end{array} \right. \tag{19}\]  
where  
\(x_{d}\) is the \(x\) coordinate of the desired trajectory. \(y_{d}\) is the \(y\) coordinate of the desired trajectory. \(x_{p}\) is the \(x\) coordinate of the trajectory obtained by the classic PID controller. \(y_{p}\) is the \(y\) coordinate of the trajectory obtained by the classic PID controller. \(x_{g}\) is the \(x\) coordinate of the trajectory obtained by the PID controller optimized by a genetic algorithm. \(y_{g}\) is the \(y\) coordinate of the trajectory obtained by the PID controller optimized by a genetic algorithm. The trajectory tracking errors of the classic PID and the PID optimized by a genetic algorithm are shown in Figure 8. It is found that the PID controller optimized by the genetic algorithm has a higher control accuracy. The trajectories of the end-effector using the classic PID and the PID optimized by a genetic algorithm are shown in Figure 9. It can be found that the running trajectory of the PID controller optimized by a genetic algorithm is closer to the desired trajectory; therefore, the genetic algorithm-optimized PID controller designed in this paper has a higher trajectory tracking accuracy. Moreover, the PID controller obtained by a genetic algorithm saves more time than the PID controller obtained by the trial and error method, which is simple and practical. To further verify the robustness of the controller designed in this paper, an artificial disturbance is added to the model. The curve of the disturbance is as follows:  
\[ \begin{split}\mathrm{x_{d}}&=0.003\cos(50t)\\ \mathrm{y_{d}}&=0.003\sin(50t)\end{split}  \tag{20}\]  
Figure 8: The trajectory tracking errors of the classic PID and the PID optimized by a genetic algorithm. Figure 7: System control block diagram. The trajectory tracking errors of the classic PID and the PID optimized by a genetic algorithm are shown in Figure 10. The maximum error is still less than 1 mm. It is found that the controller designed in this paper still has a higher accuracy when the interference is added. The trajectories of the end-effector using the classic PID and the PID optimized by a genetic algorithm are shown in Figure 11. It can be found that the running trajectory of the PID controller optimized by a genetic algorithm is closer to the desired trajectory. Therefore, the genetic algorithm-optimized PID controller designed in this paper has a higher trajectory tracking accuracy and has better robustness when the interference is added. Figure 12 shows the torque curves produced by the classic PID controller and the PID controller optimized by a genetic algorithm. These torque curves are measured using a torque transducer built in SimMechanics.