# Trajectory Planning of Robotic Arm Based on Particle Swarm Optimization Algorithm
## 4 Experimental Simulation  
### Experiment  
In the practical utilization process, specific requirements exist for the speed and synchronization of the sample manipulator. In order to better realize the trajectory planning operation of the robot arm, the parameters used are designed as follows according to the following marks. The number of iterations is set to 9, the total number of particles is set to 7, and parameter \(w_{\text{min}}\) is set to 0, \(w_{\text{max}}\) is set to 1, \(\alpha\) is set to 2.05, and \(\beta\) is set to 0.5 in the particle swarm optimization algorithm. To meet these requirements, in the simulation experiments, each action of the robotic arm must be completed within 3 s, as indicated by the red box annotations in Figure 4(a),(b). First of all, a simulation is conducted comparing the trapezoidal velocity curve to the S-shaped velocity curve. The S-shaped curve is designed in five sections. For a comprehensive analysis, the same maximum speed and movement time are used to ensure a clear comparison. The velocity and acceleration curves of both are shown in Figure 6. It is evident from the figure that despite having the same maximum speed and displacement, the trapezoidal curve exhibits obvious acceleration discontinuity. This discontinuity is likely to cause a certain degree of jitter during the movement of the mechanical arm. Moreover, the S-shaped curve, owing to its continuous change in acceleration, avoids the impact of sudden acceleration during operation. However, the acceleration curve reveals that the maximum acceleration of the S-shaped curve surpasses that of the trapezoidal curve. When the maximum acceleration is excessively high and the acceleration time is short, the mechanical arm may experience jitter due to rapid acceleration changes. Consequently, adjustments are required for maximum acceleration in the S-shaped curve. The manipulator's displacement is determined based on the starting point and the ending point. Velocity curve planning is then executed for this path, employing an improved particle swarm optimization algorithm for learning. Figure 7 illustrates the optimal particle velocity curve of the \(X\) axis after the first iteration. In the figure, the \(X\) axis represents time, and the \(Y\) axis represents motor speed. Observing the figure, it becomes apparent that the maximum velocity and acceleration of the first iteration are relatively large, with a relatively short running time. The acceleration time is small, and the acceleration is significant, indicating that the mechanical arm is greatly influenced by inertia during movement. Figure 5: Machine arm motion illustration. This influence is not conducive to the stable operation of the mechanical arm. After multiple learning iterations, the global optimal solution is obtained. The iterative results enable the deviation of the velocity curve and acceleration curve, as shown in Figure 8. Compared to the results of the first iteration, the speed curve, optimized by the PSO algorithm, is smoother than that of the first iteration in the specified running time. Moreover, the maximum acceleration is greatly reduced, and the acceleration and deceleration time are also significantly improved. This is conducive to the stable operation of the manipulator. According to the fitness function, the fitness value at the end of each iteration is computed, and the fitness learning curve is obtained as illustrated in Figure 9. According to the learning curve, using the improved PSO algorithm to plan the velocity curve, the optimal solution of the system is generated after a few iterations. This effectively improves the slow convergence of the traditional PSO algorithm and effectively avoids the influence of the local optimal solution on the result by altering the learning factor. Figure 8: Velocity curve of global optimal solution. Figure 6: Comparison of trapezoidal curve and S-curve. Figure 7: Velocity curve of the first iteration.