Mechanical arm trajectory planning method and system based on hybrid particle swarm optimization
By introducing a hybrid particle swarm optimization algorithm with a cross-search strategy and an adaptive mechanism, the problem of premature convergence in the trajectory planning of robotic arms by the traditional particle swarm optimization algorithm is solved, and efficient and stable global optimal trajectory planning is achieved, thereby improving the working cycle and production efficiency of the robotic arm.
Patent Information
- Application Number
- CN202511490052.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-10-17
- Publication Date
- 2026-01-23
AI Technical Summary
Traditional particle swarm optimization algorithms are prone to getting stuck in local optima in robotic arm trajectory planning, making it difficult to obtain the globally optimal motion trajectory. Furthermore, they tend to converge prematurely in high-dimensional and complex problems.
By introducing a cross-search strategy and an adaptive mechanism, and through multi-stage velocity updates and adaptive cross-probability, combined with dynamic adjustments to inertia weights and learning factors, we enhance population diversity and global exploration capabilities, preserve velocity information of locally optimal particles, and avoid premature convergence.
It significantly improves the global search capability of robotic arm trajectory planning, shortens motion time, increases production efficiency, and enhances system stability and convergence efficiency.
Smart Images

Figure CN121374560A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of industrial robot control, and particularly relates to a mechanical arm trajectory planning method and system based on a hybrid particle swarm algorithm. BACKGROUND
[0002] Trajectory planning of an industrial robot arm is one of its core control technologies, and its goal is to generate a smooth, efficient and time-optimal motion trajectory under the constraints of joint displacement, velocity, acceleration and torque. Traditional trajectory planning methods, such as polynomial interpolation and spline curve, can ensure the smoothness of motion, but often have shortcomings in seeking a globally time-optimal solution. Particle swarm optimization (PSO) algorithm has been applied to solve such optimization problems due to its simple structure and fast convergence speed. However, the traditional particle swarm optimization algorithm is prone to fall into local optimal solution and premature convergence when dealing with high-dimensional and complex mechanical arm trajectory optimization problems, making it difficult to obtain a globally optimal trajectory scheme. SUMMARY
[0003] The present application aims to overcome the shortcomings of the prior art and provide a mechanical arm trajectory planning method and system based on a hybrid particle swarm algorithm. By introducing a crossover search strategy and an adaptive mechanism, the diversity and global exploration ability of the population are effectively enhanced, so that the time-optimal motion trajectory of the mechanical arm can be efficiently solved.
[0004] In a first aspect, the present application provides a mechanical arm trajectory planning method based on a hybrid particle swarm algorithm, which comprises:
[0005] A 3-5-3 polynomial is used to interpolate a multi-degree-of-freedom robot arm, four key nodes are set, and the interpolation angles of each joint of the robot arm at the key nodes are obtained through inverse kinematics analysis; a general formula of 3-5-3 polynomial interpolation is constructed, and the duration of each trajectory segment is used as a particle to obtain an optimal time distribution scheme for the three trajectory segments between the four key nodes using a particle swarm algorithm; and the optimal time distribution scheme is substituted into the 3-5-3 polynomial trajectory planning to generate the motion trajectory of each joint of the robot arm.
[0006] In the particle speed updating process of the particle swarm algorithm, the particle speed of the next iteration process of the local optimal particle in the current iteration process is equal to the particle speed in the current iteration process; and the particle speed of the next iteration process of the remaining particles is obtained as follows:
[0007] The particle velocity in the next iteration process is obtained by three-stage updating of the particle velocity in the current iteration process; the first-stage velocity updating method is: obtaining an initial updating velocity according to the velocity and position of the particle; the second-stage velocity updating method is: updating the initial updating velocity based on an adaptive crossover probability updated with the iteration number to obtain an intermediate updating velocity; the third-stage velocity updating method is: mutating the intermediate updating velocity based on a mutation probability to obtain a final updating velocity, and taking the final updating velocity as the particle velocity in the next iteration process.
[0008] As preferred, the intermediate updating velocity is obtained as follows:
[0009] An adaptive crossover probability is set; the adaptive crossover probability decreases with the increase of the iteration number; if a random number is greater than the adaptive crossover probability, the initial updating velocity of the particle is taken as the intermediate updating velocity; if the random number is less than or equal to the adaptive crossover probability, a crossover strategy is adopted to obtain the intermediate updating velocity.
[0010] As preferred, the crossover strategy is randomly adopting two-point crossover or uniform crossover to update the initial updating velocity to obtain the intermediate updating velocity.
[0011] As preferred, the two-point crossover updates the velocity as follows:
[0012] Two crossover positions are randomly selected, and a crossover interval is constructed based on the crossover positions; the crossover interval of the initial updating velocity of the current particle is exchanged with the corresponding interval of the initial updating velocity of another random particle; the particle velocity after the interval exchange is taken as the intermediate updating velocity.
[0013] As preferred, the uniform crossover updates the velocity as follows: for each dimension in the initial updating velocity of the current particle, a fixed probability is exchanged with the corresponding dimension of another random particle to obtain the intermediate updating velocity.
[0014] As preferred, the final updating velocity is obtained as follows: if a random variable is greater than or equal to a mutation probability, the intermediate updating velocity of the particle is taken as the final updating velocity; if the random variable is less than the mutation probability, the velocity component of the intermediate updating velocity of the particle j in the d-th dimension is updated as follows: The following update is performed:
[0015]
[0016] wherein, is the velocity component of the final updating velocity in the d-th dimension; N(0,1) represents a standard Gaussian distribution random number with a mean of 0 and a variance of 1; σ is a mutation strength parameter.
[0017] As preferred, the method for obtaining the initial update velocity is as follows:
[0018]
[0019] wherein, is the component of the initial update velocity of the particle j in the dth dimension in the next iteration process; is the inertia weight; is the learning factor; is the random number; is the component of the particle velocity of the particle j in the dth dimension in the current iteration process; is the component of the individual optimal position of the particle j in the dth dimension; is the component of the particle position of the particle j in the dth dimension in the current iteration process; is the component of the global optimal position in the dth dimension.
[0020] As preferred, the inertia weight and the learning factor are both updated with the change of the iteration number; the inertia weight decreases with the increase of the iteration number; the learning factor c1 increases first and then decreases in the whole iteration process; and the learning factor c2 decreases first and then increases in the whole iteration process.
[0021] As preferred, the specific process of obtaining the optimal time allocation scheme by the particle swarm algorithm is as follows:
[0022] The particle swarm is initialized, and the fitness of all initial particles is calculated based on the fitness function; the local optimal particle is obtained based on the fitness of all initial particles, and the local optimal particle is taken as the global optimal particle; the velocity and position of the particle are updated in turn, and the fitness of the particle is obtained based on the updated particle position; the local optimal particle in the next iteration process is obtained based on the fitness of all particles, and the global optimal particle is updated; the above process is repeated until the iteration termination condition is reached, and the particle position of the global optimal particle is taken as the optimal time allocation scheme.
[0023] In the second aspect, the application provides a mechanical arm trajectory planning system based on a hybrid particle swarm algorithm, which is used to execute the mechanical arm trajectory planning method described above; the mechanical arm trajectory planning system comprises a multi-degree-of-freedom mechanical arm and a sensor module and a trajectory planning module carried on the mechanical arm; the sensor module is used to collect environmental information; and the trajectory planning module is used to generate the motion trajectory of each joint.
[0024] The application has the following beneficial effects:
[0025] 1.The present application balances global exploration and local development by multi-stage speed update and preserving the speed information of local optimal particles, widely searches in the early stage, and converges finely in the later stage, finally efficiently and stably solves the time optimal trajectory of the robot arm, can significantly improve the work rhythm and production efficiency of the robot arm, and has extremely high application value and popularization prospect in the fields of intelligent manufacturing and automated production line.
[0026] 2.The present application introduces multiple crossover strategies in speed update, greatly enhances the diversity of the population, effectively overcomes the defects of early mature convergence of the traditional particle swarm algorithm in complex and high-dimensional robot arm trajectory optimization problems, and significantly improves the global search ability; meanwhile, the present application can introduce subtle disturbance for particles in the local convergence stage by mutation operation based on mutation probability, avoid stagnation, and increase the possibility of jumping out of the local optimal solution, ensures that the mutation amplitude is controlled by the mutation strength parameter, and does not destroy the stability of the original solution.
[0027] 3.The present application updates the learning factor and inertia weight with the number of iterations, can realize a more smooth and reasonable transition between exploration and development stages, and thus improves the probability of finding the global optimal solution while ensuring the convergence speed. BRIEF DESCRIPTION OF DRAWINGS
[0028] Figure 1 is the overall flowchart of the present application.
[0029] Figure 2 is the position, velocity and acceleration curve diagram of each joint before and after planning of the present application.
[0030] Figure 3 is the comparison diagram of the convergence process of each joint of the present application and the standard particle swarm algorithm. DETAILED DESCRIPTION
[0031] The present application will be further described below in combination with the drawings.
[0032] A robot arm trajectory planning method based on a hybrid particle swarm algorithm, which adopts a robot arm trajectory planning system including a multi-degree-of-freedom robot arm and a sensor module and a trajectory planning carried on the robot arm. The sensor module is used to collect environmental information. The trajectory planning module is used to generate the motion trajectory of each joint.
[0033] As shown in Figure 1 , the robot arm trajectory planning method includes the following steps:
[0034] Step one, robot kinematics modeling and inverse kinematics solving
[0035] Take the INFOS2L6 robot arm as an example, the kinematics modeling of the robot arm is carried out based on the classic D-H method, and the geometric parameters and relative position relationship of each link of the robot arm are determined according to the shape of the robot arm and the D-H parameter coordinate system, as shown in Table 1.
[0036] Table 1 D-H parameter table
[0037] Joint i a i link length i link angle d i link offset i joint angle 1 0 π / 2 118 [theta1] 2 -235 0 0 [theta2] 3 -182 0 0 [theta]3 4 0 π / 2 86 [theta]4 5 0 -π / 2 86 [theta]5 6 -235 0 85 [theta]6
[0038] Where, θ i is the angle of rotation around the coordinate system z axis of joint i; α i is the angle of rotation around the coordinate system x axis of joint i; d i is the distance of translation along the coordinate system z axis of joint i; ɑ i is the distance of translation along the coordinate system x axis of joint i.
[0039] Step two, trajectory planning based on 3-5-3 polynomial
[0040] When performing 3-5-3 polynomial interpolation, first divide the spatial working trajectory of the robot arm into three sections, and insert two transition points in the trajectory to form four key nodes of initial point, transition point 1, transition point 2 and end point. Based on the data in Table 1, the interpolation angles of each joint of the robot arm in joint space are determined through inverse kinematics analysis, which provides boundary conditions for trajectory interpolation. The interpolation angles of each joint in joint space are shown in Table 2.
[0041] Table 2 Interpolation angles of each joint
[0042] Joint Starting point Transition point 1 Transition point 2 End point 1 1.3991 1.399 -1.325 -0.9588 2 1.06 0.748 0.776 1.01 3 0.4801 0.592 0.987 0.626 4 0.028 0.229 -1.76 -1.64 5 -1.57 -1.57 -0.245 -0.61 6 -0.171 -0.1717 1.57 1.57
[0043] The general formula for constructing 3-5-3 polynomial interpolation is as follows:
[0044]
[0045]
[0046]
[0047] Where, q i1 (t), q i2(t) , q i3(t) is the angular displacement trajectory function of joint i; a imn is the nth coefficient of the mth interpolation of joint i; t is the time variable of interpolation.
[0048] Step three, constructing a time optimal trajectory optimization model
[0049] The time optimal trajectory optimization model takes the minimization of total motion time as the optimization objective, and its mathematical expression is:
[0050]
[0051] wherein, denotes the total motion time, i.e. the duration of the 3-5-3 polynomial trajectory; n is the number of key nodes.
[0052] To ensure the safety and feasibility of the motion of the robot arm, the following constraints are established:
[0053]
[0054] wherein, is the joint angle of joint i at the current time; is the maximum velocity of joint i; is the maximum acceleration of joint i.
[0055] In this embodiment, the maximum velocity is 3 m / s; the maximum acceleration is 3 m / s 2 .
[0056] Step four, initialization
[0057] The size of the particle swarm (NPon=20) and the maximum number of iterations (K=300) are set. The particle position is initialized, wherein each particle represents a solution vector, the dimension (D=3) of which is determined by the three interpolation times of the 3-5-3 trajectory, and the position information is the duration of each trajectory Δt1, Δt2, Δt3. The fitness of all initial particles is calculated based on the optimization objective in the above as the fitness function; the local optimal particle is obtained based on the fitness of all initial particles, and the local optimal particle is taken as the global optimal particle.
[0058] Step five, velocity update
[0059] The velocity of all particles is updated to obtain the particle velocity in the next iteration process. If the updated particle is the local optimal particle in the current iteration process, the velocity of the particle before updating is taken as the velocity of the particle after updating; if the updated particle is not the local optimal particle, the particle is updated as follows:
[0060] 5-1. Obtain the initial update velocity of the particle
[0061] The initial update velocity of the particle is obtained according to the particle velocity and position in the current iteration process, as well as the individual optimal position and the position of the global optimal particle , and the expression is:
[0062]
[0063] wherein, is the inertia weight; is a learning factor; is a random number obeying uniform distribution; is the d-th component of the velocity of the particle j in the current iteration; is the d-th component of the individual optimal position of the particle j; is the d-th component of the position of the particle j in the current iteration; is the d-th component of the global optimal position.
[0064] In order to balance the global exploration and local exploitation ability, the inertia weight and the learning factor are updated in the iteration process; wherein, the updating method of the inertia weight w is as follows:
[0065]
[0066] wherein, w s is an initial inertia weight; w e is a final inertia weight; k is the current iteration number; K is the maximum iteration number.
[0067] In this embodiment, the initial inertia weight is 0.9; and the final inertia weight is 0.4.
[0068] The method ensures that the algorithm has strong global search ability in the early stage, and gradually enhances the local convergence ability in the later stage.
[0069] The updating method of the learning factors c1 and c2 is as follows:
[0070]
[0071]
[0072] wherein, and are the initial value and the final value of the cognitive component of the learning factor c1 respectively; and are the initial value and the final value of the social component of the learning factor c2 respectively.
[0073] The updating method of the learning factor increases the individual learning factor c1 in the early stage of iteration, enhances the dependence of the particle on its own historical optimum, and promotes global exploration; with the iteration, the group learning factor c2 is gradually increased, the convergence ability of the particle to the global optimum is strengthened, the balance transition of exploration and development is realized, and the stable learning ability of the algorithm in the whole optimization process is ensured.
[0074] Through the above adaptive parameter dynamic adjustment method, the search resources can be reasonably allocated in different stages of particle swarm optimization, so as to avoid premature convergence, improve the global optimization ability, and obtain higher solution accuracy in the later stage.
[0075] 5-2. Intermediate update velocity of particles
[0076] To enhance the diversity of the population and avoid premature convergence, an adaptive crossover probability is set to dynamically adjust with the number of iterations , whose expression is:
[0077]
[0078] wherein, is the initial crossover probability; is the final crossover probability.
[0079] In this embodiment, the initial crossover probability is 0.8, and the final crossover probability is 0.2.
[0080] If the random number r is greater than the adaptive crossover probability , the initial update velocity of the particle is taken as the intermediate update velocity; if the random number r is less than or equal to the adaptive crossover probability , the intermediate update velocity is obtained by randomly using two-point crossover or uniform crossover. This makes it possible to maintain a high crossover probability in the early stage to increase the exploratory nature, and to reduce the crossover probability in the later stage to enhance the convergence stability. The update methods of two-point crossover and uniform crossover on velocity are as follows:
[0081] (1) Two-point crossover
[0082] Two crossover positions are randomly selected , the interval of the initial update velocity of the current particle is exchanged with the corresponding interval of the initial update velocity of another random particle, which is expressed as:
[0083]
[0084] The particle velocity after interval exchange is taken as the intermediate update velocity . For example, if the initial update velocity of a particle is , the initial update velocity of another particle is , and the two randomly selected crossover positions are , the exchange segment and , and the crossover result is:
[0085]
[0086] (2) Uniform crossover
[0087] Each dimension of the initial update velocity with 50% probability to another random particle's corresponding dimension intermediate update velocity is obtained by exchanging intermediate update velocity is obtained by exchanging
[0088]
[0089] wherein, is a random number.
[0090] This way can mix the information of different particles at a finer granularity, significantly improve the diversity of the population. For example, suppose the initial update velocity of a particle is , the initial update velocity of another particle is , the random mask is , which means exchanging the first and third dimensions, and keeping the second and fourth dimensions. Then the intermediate update velocity is , and the intermediate update velocity is .
[0091] 5-3. Obtain the final update velocity of the particle
[0092] Set the mutation probability P m update the intermediate update velocity to obtain the final update velocity use the final update velocity as the particle velocity in the next iteration process . If the random variable p is greater than or equal to the mutation probability, use the intermediate update velocity of the particle as the final update velocity; if the random variable p is less than the mutation probability, then for the velocity component of the intermediate update velocity of the particle j in the d-th dimension perform the following update:
[0093]
[0094] wherein, N(0, 1) represents a random number subject to a standard Gaussian distribution with a mean of 0 and a variance of 1; σ is a mutation strength parameter, used to control the disturbance amplitude.
[0095] By updating the intermediate update velocity, a slight disturbance can be introduced to the particle in the local convergence stage to avoid stagnation; at the same time, the search radius of the population is enhanced through randomness, increasing the possibility of jumping out of the local optimal solution; in addition, the mutation amplitude is controlled by the mutation strength parameter, without destroying the stability of the original solution. For example, when , , the second dimension velocity component of the particle is , and the current Gaussian sampling obtains , then the velocity update is:
[0096]
[0097] Step six, position update
[0098] The position of the particle is updated according to the updated speed, and the updated particle position The expression is:
[0099]
[0100] Wherein, is the d-th dimension component of the particle position of the particle j in the current iteration process; is the d-th dimension component of the particle velocity of the particle j in the next iteration process.
[0101] If the particle position exceeds the preset search space , boundary constraint is performed; wherein, and are the maximum position boundary and the minimum position boundary, respectively. The position boundary is set according to the physical constraint of the robot arm and the trajectory requirement, so as to ensure that the time distribution of each segment is within a reasonable range. The speed boundary is set as a proper proportion of the position boundary range, so as to control the particle update.
[0102] Step seven, the fitness of all particles is obtained based on the updated particle position, and the current optimal particle is obtained based on the fitness. The global optimal particle is updated based on the current optimal particle, and if the current optimal particle is better than the global optimal particle, the current optimal particle is taken as the global optimal particle.
[0103] Step eight, steps five to seven are repeated until the number of iterations reaches the maximum number of iterations, and then the iteration is terminated, and the particle position of the global optimal particle is taken as the optimal time distribution scheme.
[0104] Step nine, trajectory generation and verification
[0105] The optimal time distribution scheme obtained by optimization is substituted into the 3-5-3 polynomial trajectory planning to generate the final joint motion trajectory, and verification is performed to ensure that it meets all kinematic constraints. Through the comparative experiment of the present application and the standard particle swarm algorithm, the results are shown in Figure 2 , Figure 3 and Table 1.
[0106] Table 1 Comparison results of completed trajectory time of the present application and the standard particle swarm algorithm
[0107] Method first duration Δt1 second duration Δt2 third duration Δt3 Total time Standard particle swarm algorithm 1.1221 2.4168 1.4295 4.9684 The invention 0.79017 2.1062 1.0286 3.9250
[0108] From Figure 2 and Figure 3It can be seen that the present application shows significant advantages in optimizing the trajectory running time of the mechanical arm. The cosine time-varying learning factor achieves a balance between global exploration and local development, enhancing the convergence stability of the population; the mixed crossover search and Gaussian variation mechanism significantly improves the population diversity, enabling the algorithm to jump out of the local optimal trap; the method of preserving local optimal particles is not destroyed in the iteration process, thereby improving the overall convergence efficiency. Through the above improvement measures, the cumulative running time of the mechanical arm from the initial point to the target point is reduced from 4.96 seconds of the standard particle swarm algorithm to 3.93 seconds, about 20.7% shorter, significantly improving the running efficiency and optimization performance of the system.
Claims
1. A trajectory planning method for a robot arm based on a hybrid particle swarm optimization algorithm, characterized in that: The method comprises: interpolating the multi-degree-of-freedom robot arm using a 3-5-3 polynomial, setting four key nodes, and obtaining interpolation angles of each joint of the robot arm at the key nodes through inverse kinematics analysis; constructing a general formula of 3-5-3 polynomial interpolation, using the duration of each trajectory as a particle, and obtaining an optimal time distribution scheme of three trajectories between the four key nodes by using a particle swarm algorithm; and substituting the optimal time distribution scheme into the 3-5-3 polynomial interpolation to generate the motion trajectory of each joint of the robot arm; in the particle velocity updating process of the particle swarm algorithm, the particle velocity of the next iteration process of the local optimal particle in the current iteration process is equal to the particle velocity in the current iteration process; and the particle velocity of the next iteration process of the remaining particles is obtained in the following manner: the particle velocity in the next iteration process is obtained by updating the particle velocity in the current iteration process in three stages; the first-stage velocity updating method is to obtain an initial updating velocity according to the velocity and position of the particle; the second-stage velocity updating method is to update the initial updating velocity based on an adaptive crossover probability updated with the iteration number to obtain an intermediate updating velocity; and the third-stage velocity updating method is to mutate the intermediate updating velocity based on a mutation probability to obtain a final updating velocity, and the final updating velocity is taken as the particle velocity in the next iteration process.
2. The trajectory planning method for a robot arm based on a hybrid particle swarm optimization algorithm according to claim 1, characterized in that: the intermediate updating velocity is obtained in the following manner: an adaptive crossover probability is set; the adaptive crossover probability decreases with the increase of the iteration number; if a random number is greater than the adaptive crossover probability, the initial updating velocity of the particle is taken as the intermediate updating velocity; and if the random number is less than or equal to the adaptive crossover probability, a crossover strategy is used to obtain the intermediate updating velocity.
3. The trajectory planning method for a robot arm based on a hybrid particle swarm optimization algorithm according to claim 2, characterized in that: the crossover strategy is to randomly use two-point crossover or uniform crossover to update the initial updating velocity to obtain the intermediate updating velocity.
4. The trajectory planning method for a robot arm based on a hybrid particle swarm optimization algorithm according to claim 3, characterized in that: the two-point crossover updates the velocity in the following manner: two crossover positions are randomly selected, and a crossover interval is constructed based on the crossover positions; the crossover interval of the initial updating velocity of the current particle is exchanged with the corresponding interval of the initial updating velocity of another random particle; and the particle velocity after the interval exchange is taken as the intermediate updating velocity.
5. The trajectory planning method for a robot arm based on a hybrid particle swarm optimization algorithm according to claim 3, characterized in that: the uniform crossover updates the velocity in the following manner: each dimension in the initial updating velocity of the current particle is exchanged with the corresponding dimension of another random particle at a fixed probability to obtain the intermediate updating velocity.
6. The method of claim 1, wherein: The method for obtaining the final update speed is as follows: if the random variable is greater than or equal to the mutation probability, the intermediate update speed of the particle is taken as the final update speed; if the random variable is less than the mutation probability, the velocity component of the intermediate update speed of the particle j in the dth dimension is multiplied by the random variable, and the product is added to the velocity component of the initial update speed of the particle j in the dth dimension The following update is performed: ; wherein, is the velocity component of the final update velocity in the dth dimension; N(0, 1) denotes a random number from a standard Gaussian distribution with mean 0 and variance 1 ; and σ is a variance intensity parameter.
7. The trajectory planning method for a robot arm based on a hybrid particle swarm optimization algorithm according to claim 1, characterized in that: the initial updating velocity is obtained in the following manner: ; wherein, is the component in the d-th dimension of the initial update velocity of particle j for the next iteration process; is the inertia weight; is the learning factor; is the random number; is the component in the d-th dimension of the particle velocity of particle j in the current iteration process; is the component in the d-th dimension of the individual optimal position of particle j; is the component in the d-th dimension of the particle position of particle j in the current iteration process; is the component in the d-th dimension of the global optimal position.
8. The trajectory planning method for a robot arm based on a hybrid particle swarm optimization algorithm according to claim 7, characterized in that: the inertia weight and the learning factor are both updated with the change of the iteration number; the inertia weight decreases with the increase of the iteration number; the learning factor c1 increases first and then decreases in the entire iteration process; and the learning factor c2 decreases first and then increases in the entire iteration process.
9. The method of claim 1, wherein: the specific process of obtaining the optimal time distribution scheme by the particle swarm algorithm is as follows: Initialize a particle swarm, and calculate the fitness of all initial particles based on a fitness function; obtain a local optimal particle based on the fitness of all initial particles, and take the local optimal particle as a global optimal particle; update the speed and position of the particles in turn, and obtain the fitness of the particles based on the updated particle positions; obtain a local optimal particle in a next iteration process based on the fitness of all particles, and update the global optimal particle; repeat the above process until an iteration termination condition is reached, and take the particle position of the global optimal particle as an optimal time allocation scheme. 10.A trajectory planning system for a robot arm based on a hybrid particle swarm optimization algorithm, characterized in that: The mechanical arm trajectory planning system comprises a multi-degree-of-freedom mechanical arm and a sensor module and a trajectory planning module carried on the mechanical arm; the sensor module is used for collecting environmental information; The trajectory planning module is used for generating the motion trajectory of each joint.