# Trajectory Planning of Robotic Arm Based on Particle Swarm Optimization Algorithm
## 2 Trajectory Planning
### Velocity Planning  
Point-to-point velocity planning can be conceptualized as a method for transitioning from a start point to an end point within a specified time. Currently, widely used velocity planning algorithms in motion planning encompass the ladder-type velocity planning algorithm and the S-type velocity planning algorithm. The trapezoidal curve planning algorithm is characterized by its simplicity, minimal time requirement, swift motor response, and high efficiency. However, it exhibits discontinuous acceleration, leading to a significant flexible impact and relatively lower motion accuracy. Moreover, the S-shaped curve planning maintains continuous acceleration at any position, thereby avoiding the flexible impact observed in trapezoidal planning. This results in a smoother velocity profile and higher motion accuracy. Nonetheless, the S-shaped algorithm is more complex than trapezoidal programming. Both velocity curve planning approaches are introduced in the following paragraphs. Trapezoidal curve trajectory planning, also known as linear acceleration and deceleration or T-shaped acceleration and deceleration, stands out as the most widely employed speed control method in manipulator control. Its simple structure and ease of calculation make it a prevalent choice in several motor systems. The acceleration and deceleration process of the trapezoidal velocity curve involves uniform acceleration and uniform deceleration, with the acceleration value maintained as a constant. In trapezoidal curve planning, the velocity curve can be determined by specifying the starting and ending points of motion, the adding or subtracting of velocity, and the maximum velocity. This process is illustrated in Figure 2.  
The velocity curve of the trapezoidal velocity planning consists of three segments. The first one is a uniform acceleration, the second stage is a uniform velocity, and the third stage is a uniform deceleration. Notably, the rate of increase and decrease in speed during the rise and fall is the same, ensuring that the duration of both the uniform acceleration and deceleration stages is identical. This motion process can be expressed as a piecewise function, and its motion formula is given by  
\[\left\{ \begin{array}{l}s(t)=\frac{1}{2}at^{2},0\leq t\leq\frac{v}{a}\\ s(t)=vt-\frac{v^{2}}{2a^{2}},\frac{v}{2}\leq t\leq T-\frac{v}{a}\\ s(t)=\frac{2 avT-2v^{2}-a^{2}(t-T)^{2}}{2a}\end{array} \right. \tag{9}\]  
where \(T\) represents the total motion time; \(s\) represents position; \(a\) represents acceleration; and \(t\) represents time. Referring to Figure 2, it becomes evident that the acceleration curve in the trapezoidal velocity planning takes on a step-like form. It is notable that the acceleration is not continuous at the four time points: motion start time, acceleration end time, deceleration start time, and movement end time. This lack of continuity significantly affects the stationarity of the manipulator. The S-shaped velocity curve is another widely employed velocity planning algorithm in the realm of mechanical control. Diverging from trapezoidal velocity planning, it addresses certain shortcomings associated with the trapezoidal velocity. Moreover, the change rate of acceleration can be controlled by S-type velocity planning. Notably, the acceleration curve in S-type velocity planning is continuous and devoid of sudden acceleration. Consequently, S-type velocity planning emerges as a control strategy that effectively limits vibration. Furthermore, the S-shaped velocity planning is derived from the S-shaped velocity curve in the process of movement. The velocity curve of the most common S-shaped velocity planning is divided into seven segments as follows:  
The first segment: increase the acceleration from zero to the preset \(a\) value with the constant jerk \(J\). The second segment: accelerate the operation with a constant acceleration \(a\). The third segment: reduce the acceleration from the preset value to reach zero with a constant negative jerk \(J\).