1. Introduction
As the coating equipment manufacturing industry undergoes a transformation towards intelligent upgrading, using robots and other intelligent devices to assist or replace human labor in production processes has become an inevitable path [
1]. The increasing demand for products in the coating industry has driven the continuous growth of demand for coating machinery [
2]. In the processing of coating machinery, to meet the requirements for improved production efficiency, it is imperative to introduce intelligent equipment, such as robotic arms, to perform automated tasks like loading, unloading, and inspection [
3]. This will comprehensively enhance the mechanization and automation levels of the coating industry [
4]. Currently, among leading coating equipment manufacturers, the processing of aluminum plugs remains in a semi-automated production mode [
5]. Although automated machining and clamping of aluminum plugs have been achieved with CNC turning centers and automated gantries, loading and unloading tasks still rely on manual operations, significantly restricting the production line’s processing efficiency [
6]. To enhance industrial production and manufacturing efficiency, the robotic arm’s trajectory planning for loading and unloading aluminum plugs is essential. An appropriate trajectory interpolation algorithm can improve the operational stability of the robotic arm [
7], while a time-optimal trajectory planning algorithm with dynamic adjustment strategies can further boost processing efficiency, reducing dependence on manual labor [
8]. Therefore, trajectory planning and time optimization are crucial for enhancing operational safety, shortening the robotic arm’s loading and unloading time, and achieving a higher level of intelligent production. This study aims to address the scientific challenge of robotic arm trajectory planning during the automatic loading and unloading of aluminum block components in coating machinery. The scientific objective is to develop a time-optimal trajectory planning method based on a dynamically adaptive PSO algorithm to enhance operational efficiency and stability.
Currently, many scholars, both domestically and internationally, have conducted in-depth research on time-optimal, energy-optimal, and overall optimal trajectory planning for robotic arms, particularly for the time-optimal trajectory planning of six-degree-of-freedom robotic arms [
9]. Based on the different methods used to describe motion states, there are two typical types of trajectory planning: joint-space trajectory planning and Cartesian-space trajectory planning [
10]. Joint-space trajectory planning offers several advantages, such as simplicity in algorithms and high motion efficiency, and it typically avoids issues related to kinematic singularities [
11]. Therefore, for trajectories without specific path constraints, planning in joint space should be given priority. Common joint space trajectory planning methods include polynomial interpolation, trapezoidal velocity interpolation, spline space interpolation [
12], etc. Kielas-Jensen et al. [
13] proposed a Bernstein polynomial-based method to convert infinite-dimensional optimization problems into non-linear programming problems for optimal trajectory generation, ensuring smooth and efficient motion planning. Boryga et al. [
14] used asymmetric polynomial profiles for smooth trajectory planning, demonstrating their effectiveness in achieving smooth and efficient motion in robotic systems. Le Ying et al. [
15] conducted trajectory planning for the REBOT-V-6R robot using quintic and septic non-uniform B-splines. The study demonstrated that trajectory planning with quintic and septic non-uniform B-spline curves results in smoother motion and higher planning accuracy. However, as the polynomial degree increases, the trajectory becomes more precise and smooth, but it may lead to the Runge phenomenon [
16]. Therefore, to simplify computations while ensuring trajectory smoothness, the use of piecewise polynomial interpolation is a feasible approach.
Time-optimal trajectories refer to the motion paths of a six-degree-of-freedom robotic arm that completes a specific path in the shortest time within joint space. To achieve this, various trajectory optimization algorithms can be applied, such as Genetic Algorithm (GA) [
17], Whale Optimization Algorithm (WOA) [
18], Sparrow Search Algorithm (SSA) [
19], Particle Swarm Optimization (PSO) [
20], Ant Colony Optimization (ACO) [
21], and others. Particle swarm optimization (PSO) has been widely applied to various engineering problems due to its advantages, such as few parameters, simple implementation, and strong applicability. However, the basic PSO algorithm suffers from issues such as slow convergence speed, the tendency to get trapped in local optima, and insufficient accuracy. To address these issues, many researchers have proposed improvements. Akopov [
22] proposed a clustering-based hybrid particle swarm optimization algorithm for solving a multisectoral agent-based model, significantly improving optimization performance. Chen et al. [
23] introduced a particle swarm optimizer with crossover operation, demonstrating its effectiveness in enhancing optimization accuracy and computational efficiency. Du et al. [
24] proposed a trajectory planning method based on a piecewise interpolation function and the local chaotic particle swarm optimization (LCPSO) algorithm for the time-optimal trajectory planning problem in robotic arm motion. Ni et al. [
25] transformed the coordinated trajectory planning problem of space robots into an optimization problem to find the optimal trajectory of the base and manipulator using Particle Swarm Optimization (PSO). Zhao et al. [
26] introduced an improved hybrid method combining Whale Optimization and PSO algorithms, significantly improving the convergence speed. While these studies have made significant progress in the field of robotic arm trajectory planning, many still face challenges, such as high-order polynomials, complex calculations, and optimization algorithms being prone to premature convergence.
In summary, considering the actual production requirements and structural layout characteristics of the coating machine aluminum plug processing unit, how to ensure a smooth trajectory under the constraints of dynamic and geometric conditions while maintaining a small computational load, and how to integrate intelligent algorithms to achieve optimal results, thus improving the operational efficiency and stability of the robotic arm, is a critical technical challenge in the intelligent development of coating industry shaft-type parts production lines. Therefore, in order to improve the algorithm’s performance and reduce motion impact, this paper proposes a time-optimal trajectory planning method based on a dynamically adaptive PSO algorithm. The specific steps are as follows: First, the loading and unloading process of aluminum plug components in coating machinery is analyzed; then, a “3-5-3” hybrid polynomial interpolation method is used to fit the robotic arm’s loading and unloading trajectory; finally, the dynamically adaptive PSO algorithm is applied to optimize the trajectory, and the effectiveness of the proposed method is validated through experiments, achieving automatic loading and unloading of aluminum plug components in coating machinery and improving the processing efficiency of the production line.
4. Time-Optimal Robotic Arm Trajectory Planning
4.1. Time-Optimal Trajectory Planning Based on Standard PSO Algorithm
Particle Swarm Optimization (PSO) is a typical heuristic algorithm that abstracts the numerical feasible solutions of a problem as individual particles, each with two attributes: position and velocity. The possibility of each particle reaching an optimal solution within the feasible domain is represented by its fitness. Each particle can remember all the positions it has visited and find the best position among them, which is the local optimum in the PSO algorithm. The best position reached by all particles in the entire swarm can be regarded as the global optimum, which is the global best solution in the PSO algorithm. Compared to other optimization algorithms, PSO has the advantage of particles sharing information with each other during the optimization process, allowing for faster convergence. In addition, PSO has a simple algorithm structure and easily adjustable parameters.
During the optimization process, each particle updates its position and velocity iteratively by tracking the local best solution and the global best solution. Suppose there are
m particles searching for the optimal solution in a
D-dimensional space, the position and velocity update formulas for the PSO algorithm are:
In the formula:
w—Inertia weight, indicating the degree to which the particle’s velocity is influenced by its previous velocity during the update process;
c1—Local learning factor, indicating the statistical acceleration weight for the particle towards the local best position;
c2—Global learning factor, indicating the statistical acceleration weight for the particle towards the global best position;
r1, r2—Pseudo-random numbers in the range [0, 1], used to increase the randomness in the optimization process;
pid—The local best position of particle i in the d-th dimension;
gd—The global best position of all particles in the current population in the d-th dimension;
—The d-dimensional position of particle i at the k-th iteration of the optimization;
—The d-dimensional velocity of particle i at the k-th iteration of the optimization.
From Equation (11), it can be observed that the particle’s velocity update includes three components: the memory term, the self-cognitive term, and the social-cognitive term. The memory term reflects the influence of the previous optimization result during the velocity update; the self-cognitive term indicates that the particle’s movement is influenced by its own experience; the social-cognitive term reflects the information sharing between particles, where the optimal position in the swarm is used to determine the next movement. The flowchart of the trajectory planning algorithm based on the standard PSO algorithm is shown in
Figure 9.
The key to applying the Particle Swarm Optimization (PSO) algorithm in “3-5-3” hybrid polynomial trajectory planning lies in selecting the variables for particle optimization to obtain the optimal trajectory [
29]. When optimizing the trajectory, if the polynomial coefficients in Equation (8) are chosen as the variables to be optimized, each joint’s trajectory polynomial would have a 14-dimensional optimization search space. By selecting time as the optimization variable, however, the total search space would have only three dimensions, significantly reducing both the computational load and code complexity. Based on Equation (8), given the time and joint angle displacements, the undetermined coefficient matrix
a for each joint can be derived.
The objective of trajectory optimization, with joint movement time as the variable to be optimized, is to minimize the joint movement time under given constraints—this is time-optimal trajectory planning. This approach avoids complex mapping relationship calculations, limiting the search space to three dimensions. The fitness function and optimization constraints are then defined as follows:
In the formula:
Vmax—Maximum joint velocity;
Vj1—Actual velocity of the first cubic polynomial segment for the j-th joint;
Vj2—Actual velocity of the quintic polynomial segment for the j-th joint;
Vj3—Actual velocity of the second cubic polynomial segment for the j-th joint.
When addressing multi-dimensional optimization problems, the standard PSO algorithm tends to get trapped in local optima, and its convergence speed can be relatively slow. The core issue lies in the fact that, typically, the inertia weight and learning factors in the standard PSO algorithm remain constant throughout iterations, leading to a fixed optimization search strategy. However, complex multi-dimensional optimization problems require a dynamic optimization strategy that can adaptively adjust parameters as the algorithm iterates. Therefore, this paper requires improvements to the standard PSO algorithm to adapt it for time-optimal trajectory planning of the “3-5-3” hybrid polynomial.
4.2. Time-Optimal Trajectory Planning Based on Dynamically Adaptive PSO Algorithm
The standard PSO algorithm relies on a fixed search strategy, making it difficult to adapt to dynamic environmental changes. In contrast, the dynamic adaptive PSO algorithm dynamically adjusts the particles’ search strategies and parameters, enabling it to more effectively search for the optimal trajectory in an ever-changing environment. By analyzing the search strategy of the PSO algorithm, we can summarize two key points that support improvements to the algorithm:
(1) Larger global search steps in early optimization: In the early stages of optimization, a larger global search step size is needed to increase the diversity of the population. Premature convergence in optimization algorithms typically occurs when the similarity among individuals in the population is high, leading to a rapid decline in diversity. If a “super individual” with a fitness value far exceeding the population average emerges, it can dominate the “reproduction rights” within the population.
(2) Enhanced local search ability in late optimization: In the later stages, when the population already has high diversity, the focus should shift to optimization precision and convergence speed. Stronger local search capabilities are therefore needed as the algorithm progresses. Adjusting to the changing iteration count, and increasing the local search step size in later optimization stages is crucial.
To address the above points, improvements are made to the inertia weight
w, local learning factor
c1, and global learning factor
c2 in Equation (11). The inertia weight
w, which represents the influence of the particle’s original velocity on its updated speed, affects the particle’s optimization ability. A non-linear dynamic function can be used to replace the constant inertia weight in the basic PSO algorithm, as shown in Equation (13):
In the formula:
wmin—minimum inertia weight;
wmax—maximum inertia weight;
n—current iteration count;
N—maximum iteration count.
Similarly, a non-linear dynamic function is used as the fixed learning factor in the PSO algorithm, as shown in Equation (14):
In the formula:
The process of the PSO algorithm with a dynamic adjustment strategy is shown in
Figure 10.
The main difference between the improved PSO algorithm and the basic PSO algorithm is that the improved version has a dynamically adaptive particle update phase. This dynamic adaptability allows particles to adjust their search strategy based on the iteration count, improving the efficiency of the planning and better handling uncertainty, thereby meeting the real-time and accuracy requirements in practical applications.
4.3. Simulation Results and Analysis
In this paper, the maximum number of particles in the population is initialized to 20, with a maximum number of iterations set to 50. The initial individual learning factor
c1 and global learning factor
c2 are both set to 2. The minimum learning factor
cmin is 1.5, and the maximum learning factor
cmax is 2.5. The maximum inertia weight
wmax is 0.9, and the minimum inertia weight
wmin is 0.1. The algorithm’s search space has three dimensions. The solution space for each particle is within the range of [0, 2], and the velocity boundary for the particles is set to [−4, 4]. The maximum joint angular velocity is 5 rad/s. The initialization of the first-generation particle positions and velocities is given by the Formula (15):
In the formula:
xmax—Upper limit of the particle solution space;
xmin—Lower limit of the particle solution space;
Pop—Maximum number of individuals in the population;
Dim—Size of the optimization dimensions.
Based on the interpolation point data in
Table 3, the optimal time trajectory planning was performed using the dynamic adaptive PSO algorithm proposed in this paper. The resulting joint angular displacement changes, joint angular velocity changes, and joint angular acceleration changes are shown in
Figure 11,
Figure 12, and
Figure 13, respectively.
By comparing
Figure 6 and
Figure 11, it can be observed that the time-optimal trajectory planning proposed in this paper significantly reduces the time taken for all three stages of the “3-5-3” polynomial trajectory planning. The trajectory planning time of work condition 1 is reduced from 6 s to 3.59 s, resulting in an overall work efficiency improvement of 40.2%. Similarly, the trajectory planning time of work condition 2 is reduced from 6 s to 3.14 s, improving the overall work efficiency by 47.7%. The specific values are shown in
Table 5.
Fitness value is a metric used in genetic, evolutionary, or optimization algorithms to assess the quality of each candidate solution (individual).
Figure 14 illustrates a comparison of fitness changes under condition 1 for the basic PSO algorithm and the improved dynamically adaptive PSO algorithm.
The adaptive PSO algorithm significantly improves fitness values and convergence time by dynamically adjusting the learning factors and inertia weight, balancing global and local search capabilities. Its optimization performance far exceeds that of the standard PSO. Analysis indicates that the proposed improved PSO algorithm is most effective in enhancing performance in the following two aspects:
(1) Significant Improvement in Fitness Values. The adaptive PSO algorithm achieves lower fitness values throughout the optimization process of all joints. For example, in subplot (a) of
Figure 14, the fitness value of the standard PSO converges around 3.4, while the adaptive PSO further optimizes it to approximately 3.3. In subplot (c) of
Figure 14, the fitness value of the standard PSO remains around 1.6, while the adaptive PSO reaches about 1.5. Subplots (b), (d), (e), and (f) in
Figure 14 also show a significant downward trend, with the final fitness being better than that of the standard PSO. Therefore, the lower the fitness value, the better the performance of the objective function.
(2) Significant Acceleration of Convergence Time. The adaptive PSO demonstrates faster convergence in most joints. For example, in subplot (a) of
Figure 14, the adaptive PSO converges after about 15 iterations, while the standard PSO takes approximately 40 iterations to converge. In subplot (d) of
Figure 14, the adaptive PSO reaches stability within 10–20 iterations, while the standard PSO requires nearly 40 iterations. Subplots (b), (c), (d), (e), and (f) in
Figure 14 also show a faster convergence trend, with the final convergence time being better than that of the standard PSO. Therefore, a faster convergence speed means that the algorithm can find high-quality solutions in a shorter time, improving computational efficiency and real-time performance, which is particularly important for robotic arm trajectory planning.
Based on the analysis of the results, it can be concluded that the time-optimal algorithm based on the dynamically adaptive PSO proposed in this paper significantly reduces the operating time of the robotic arm while satisfying maximum velocity constraints. Additionally, the time-optimal trajectory planning using the “3-5-3” hybrid polynomial allows for more flexible adjustments to changes in velocity and acceleration, making it suitable for trajectory planning in the loading and unloading tasks of the aluminum block by the robotic arm.
5. Summary
Aiming at the issue of low trajectory planning efficiency and high motion impact in the robotic arm’s loading and unloading tasks of aluminum blocks in coating machinery, this study proposes a time-optimal trajectory planning method based on a dynamically adaptive PSO algorithm. The main conclusions are as follows:
(1) Kinematic analysis of the robotic arm is conducted in joint space, and a “3-5-3” hybrid polynomial interpolation method is used to fit the motion trajectory. The results show that the “3-5-3” interpolation method effectively balances trajectory smoothness and kinematic performance, providing a stable foundation for robotic arm operation.
(2) By optimizing the robotic arm’s operation time as the objective function, the dynamically adaptive PSO algorithm is employed to minimize loading and unloading times, achieving time-optimal trajectory planning. This method significantly reduces the robotic arm’s operational time, thus improving efficiency. By optimizing the robotic arm’s operating time as the objective function, an improved dynamically adaptive PSO algorithm is employed to minimize the loading and unloading time, yielding the shortest trajectory for handling aluminum blocks, which is validated through simulation.
(3) Experimental results demonstrate that the “3-5-3” hybrid polynomial interpolation effectively balances path smoothness and kinematic performance. Furthermore, the time-optimal trajectory planning method based on the dynamically adaptive PSO reduces trajectory planning time from 6 s to 3.59 s and 3.14 s for condition 1 and condition 2, respectively, achieving efficiency improvements of 40.2% and 47.7%. These findings confirm the feasibility and effectiveness of the proposed method in enhancing the efficiency of automated aluminum block loading and unloading.