Mechanical arm error compensation method based on quantum particle swarm optimization BP neural network
By introducing quantum particle swarm optimization algorithm to optimize the BP neural network in robotic arm error compensation, the problems of error coupling and local optimal solutions in robotic arm positioning error compensation are solved, and higher positioning accuracy and system stability are achieved.
Patent Information
- Application Number
- CN202510047070.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-05-13
AI Technical Summary
When performing tasks, the positioning errors are caused by factors such as inherent errors, environmental changes and sensor uncertainty. Traditional geometric error and non-geometric error compensation methods cannot completely eliminate the errors, which has limitations.
A BP neural network based on quantum particle swarm optimization is adopted to optimize the weight and bias of the neural network through the QPSO algorithm to build a comprehensive error compensation model to achieve coupling compensation for geometric and non-geometric errors.
It significantly improves the absolute positioning accuracy and system stability at the end of the robot arm, avoids the local optimal solution problems that may arise in traditional BP neural network training, and improves the search efficiency and convergence speed.
Smart Images

Figure CN119973982A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of robot arm error compensation, and in particular to a robot arm error compensation method based on quantum particle swarm optimization BP neural network. Background Art
[0002] Robotic arms are increasingly used in manufacturing, logistics, education and medical treatment. These application scenarios usually require the robotic arm to have high-precision positioning and motion control capabilities to ensure that complex tasks can be performed safely and efficiently. However, due to factors such as the inherent errors of the robotic arm system (manufacturing errors, assembly errors), changes in complex environments (temperature, humidity, vibration, etc.), and sensor uncertainties, the robotic arm often cannot accurately reach the desired position when performing work tasks, resulting in positioning errors. In precision manufacturing and high-precision operations, compensation for robotic arm positioning errors is crucial. Although traditional geometric error and non-geometric error compensation methods can improve positioning accuracy to a certain extent, due to the large number of POE model parameters and the existence of error coupling, decoupling is difficult, which makes it impossible for traditional compensation methods to completely eliminate all errors and has significant limitations. Therefore, the use of neural networks for comprehensive error compensation can not only compensate for geometric and non-geometric errors at the same time, but also effectively solve the error coupling problem, thereby significantly improving the absolute positioning accuracy and system stability of the end of the robotic arm.
[0003] Neural networks, such as BP neural networks, have been widely used in the field of robot arm error compensation due to their powerful nonlinear mapping capabilities. By learning the relationship between input and output, BP neural networks can effectively compensate for errors. However, in the traditional training process, BP neural networks are prone to fall into local optimal solutions, resulting in failure to reach the global optimal solution, thus affecting the accuracy of compensation.
[0004] The quantum particle swarm algorithm (QPSO) significantly enhances the global search capability of the particle swarm algorithm (PSO) by introducing the concept of quantum mechanics, and effectively overcomes the local optimality problem of the classical PSO during the optimization process. The quantum bit update mechanism of QPSO has higher search efficiency and faster convergence speed, which can optimize the parameters of the neural network more quickly and accurately, thereby improving the accuracy of error compensation and the stability of the system. Summary of the invention
[0005] The purpose of the present invention is to provide a robotic arm error compensation method based on quantum particle swarm optimization BP neural network to solve the identification difficulty problem caused by complex parameters and error coupling in the POE model. At the same time, the QPSO optimization algorithm is introduced to significantly improve the global optimization ability and convergence speed of the neural network, thereby further improving the accuracy of error compensation and the stability of the system.
[0006] To achieve the above object, the present invention provides the following technical solutions:
[0007] A method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network comprises the following steps:
[0008] Step S1: Plan sampling points and collect data. Use Latin hypercube sampling (LHS) to plan sampling points to ensure that the sample points are evenly distributed in the parameter space, and use a laser tracker to measure the actual position of the end.
[0009] Step S2: Construct a robot arm error compensation model. The theoretical posture of the end of the robot arm is calculated based on the product of exponentials (POE) forward kinematics model, and combined with the actual posture collected, a comprehensive error compensation model is constructed based on the joint angle;
[0010] Step S3: Training of BP neural network model based on QPSO optimization. The neural network model is trained, and the weight and bias of the BP neural network are optimized using the QPSO algorithm. The position and speed of the particles are adjusted through quantum superposition and interference effects to increase the diversity of the search and avoid falling into the local optimal solution.
[0011] Step S4: Perform real-time error compensation and control based on the optimized QPSO-BPNN. The trained neural network model predicts the error, reduces the impact of the error on the positioning accuracy of the robot arm, improves the absolute positioning accuracy, and ensures the stability and reliability of the system.
[0012] Furthermore, in step S1, LHS is used to randomly sample the joints of the robot arm:
[0013]
[0014] Among them, [a i , b i ] represents the sampling interval of the i-th dimension, represents the width of the subinterval, n represents the number of sampling points, m represents the sampling dimension, x ij represents the random sampling value of the jth sample in the i-th dimension, u ij ∈(0, 1) represents a uniformly distributed random number, ensuring the randomness of the sampling points in each subinterval.
[0015] Furthermore, in step S1, the theoretical angle value is input into the teaching pendant, and the actual position of the end of the robotic arm measured by the laser tracker is:
[0016] P r =[x r ,y r , z r ] T (3)
[0017] Furthermore, in step S2, the posture transformation relationship of a single joint is as follows:
[0018]
[0019] Among them, i∈[0,m], m represents the number of joints of the robot arm, θ i represents the rotation angle of joint i, represents the rotation of joint i, Represents the transformation matrix of joint i relative to joint i-1 when joint i is at zero position.
[0020] Therefore, the POE forward kinematics formula of the multi-joint serial robot is as follows:
[0021]
[0022] Wherein, M represents the transformation matrix from the base coordinate to the end coordinate when each joint of the robot arm is at zero position.
[0023] Furthermore, in step S2, the error-joint angle mapping relationship is constructed as follows:
[0024]
[0025] in, Indicates the actual joint angle value of the measured posture, through q r =inv(p r ) is obtained; where p r It represents the point coordinates measured by the laser tracker with the robot base coordinate system as the origin. The function inv() is the inverse kinematics of the robot; represents the theoretical joint angle value input into the teaching pendant, q r -q s Indicates the deviation between the actual joint angle and the theoretical joint angle.
[0026] Furthermore, in step S3, the BP neural network is trained, and the activation function is as follows:
[0027] f(x)=max(0,ωq+b) (7)
[0028] Among them, q represents the input of the neuron, ω represents the weight, b represents the bias, and the input of the input layer is q s , represents the theoretical joint angle value of the sampling point.
[0029] The loss function of the BP neural network is as follows:
[0030]
[0031] Where Δq=[e1,e,...,e m ] T Indicates the actual error value of the robot arm joint angle, Represents the prediction error value of the joint angle.
[0032] Furthermore, in step S3, in order to minimize the loss function, the QPSO algorithm is used to optimize the weights and biases of the network, and the particle position iteration formula is as follows:
[0033]
[0034] Among them, X ld (t+1) represents the position of the particle of generation t+1, X ld (t) represents the position of the t-generation particle, N represents the number of particles: l = 1, 2, ..., N, D represents the dimension of the particle: d = 1, 2, ..., D, β represents the compression-expansion coefficient, which controls the convergence speed of the algorithm, u∈(0, 1) represents a uniformly distributed random number, and mBest(t+1) represents the average value of the optimal position of all particles. The formula is as follows:
[0035]
[0036] Among them, pBest l (t) represents the individual optimal position of the lth particle in the tth iteration.
[0037] P lj (t+1) represents the local attraction factor, that is:
[0038]
[0039] in, Represents a uniformly distributed random number, gBest d (t) represents the global optimal position of all particles in the dth dimension in the tth iteration.
[0040] Furthermore, in step S3, the theoretical joint angle q s is the input, the predicted joint angle deviation value The output neural network model is as follows:
[0041]
[0042] Among them, f NN Represents the neural network model obtained through training.
[0043] Furthermore, in step S4, the angle value after compensation is as follows:
[0044]
[0045] Among them, q t represents the theoretical joint angle of the randomly sampled target point, Indicated by q t The error in the predicted output when used as input to a neural network.
[0046] Furthermore, the corrected joint angle value q m Input into the teaching pendant to get the actual posture P m With the theoretical pose P t Compare.
[0047] The advantages and beneficial effects of the present invention are:
[0048] The present invention predicts joint angle errors through a BP neural network, realizes coupled compensation of geometric and non-geometric errors, thereby improving the overall performance of the robotic arm and significantly improving the absolute positioning accuracy of the end; at the same time, the present invention optimizes the BP neural network by introducing a QPSO algorithm, combines the concept of quantum mechanics, enhances the global search capability of the particle swarm, effectively avoids the local optimal solution problem that may occur in the training process of the traditional BP neural network, improves the search efficiency and accelerates the convergence speed of the network, thereby further improving the accuracy of error compensation and the stability of the system. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] Figure 1 is a schematic diagram of an error compensation process in an embodiment of the present invention;
[0050] Figure 2 Schematic diagram of the POE model of the robotic arm in the embodiment of the present invention
[0051] Figure 3a 1 is a schematic diagram of the QPSO optimization BPNN process in an embodiment of the present invention;
[0052] Figure 3b It is a schematic diagram of the BPNN error prediction compensation process in an embodiment of the present invention. DETAILED DESCRIPTION
[0053] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.
[0054] like Figure 1 As shown, the robot arm error compensation method based on quantum particle swarm optimization BP neural network of the present invention comprises the following steps:
[0055] Step S1: Use LHS to randomly sample the robot arm joints in the workspace:
[0056]
[0057] Among them, [a i , b i ] represents the sampling interval of the i-th dimension, represents the width of the subinterval, n=1000 represents the number of sampling points, m=6 represents the sampling dimension, x ij represents the random sampling value of the jth sample in the i-th dimension, u ij ∈(0,1) represents a uniformly distributed random number, ensuring the randomness of the sampling points in each subinterval.
[0058] Input the theoretical angle value into the teach pendant, and the actual position of the end of the robotic arm measured by the laser tracker is:
[0059] P r =[x r ,y r , z r ] T (3)
[0060] where x r ,y r , z r It is the actual coordinate of the end of the robot arm in the base coordinate system.
[0061] Step S2: In the POE model, the posture transformation relationship of a single joint is as follows:
[0062]
[0063] Among them, i∈[0,m], m represents the number of joints of the robot arm, θ i represents the rotation angle of joint i, represents the rotation of joint i, Represents the transformation matrix of joint i relative to joint i-1 when joint i is at zero position.
[0064] Therefore, the POE forward kinematics formula for the 6-DOF serial robot is as follows:
[0065]
[0066] Among them, M represents the transformation matrix from the base coordinate to the end coordinate when each joint of the robot is at zero position. Its POE model is as follows Figure 2 shown.
[0067] Furthermore, the error-joint angle mapping relationship is constructed as follows:
[0068]
[0069] in, Indicates the actual joint angle value of the measured posture, through q r =inv(p r ) is obtained; where p r It represents the point coordinates measured by the laser tracker with the robot base coordinate system as the origin. The function inv() is the inverse kinematics of the robot; represents the theoretical joint angle value input into the teaching pendant, q r -q s Indicates the deviation between the actual joint angle and the theoretical joint angle.
[0070] Step S3: Train the BP neural network, and the activation function is as follows:
[0071] f(x)=max(0,ωq+b) (7)
[0072] Among them, q represents the input of the neuron, ω represents the weight, b represents the bias, and the input of the input layer is q s , represents the theoretical joint angle value of the sampling point.
[0073] The loss function of the BP neural network is as follows:
[0074]
[0075] Where n = 1000, Δq = [e1, e2, e3, e4, e5, e6] T Indicates the actual error value of the robot arm joint angle, Represents the prediction error value of the joint angle.
[0076] In order to minimize the loss function, the QPSO algorithm is used to optimize the weights and biases of the network, such as Figure 3a As shown, the particle position iteration formula is as follows:
[0077]
[0078] Among them, X ld (t+1) represents the position of the particle of generation t+1, X ld (t) represents the position of the particle of generation t, N represents the number of particles: l = 1, 2, ..., N, D represents the dimension of the particle: d = 1, 2, ..., D, β represents the compression-expansion coefficient, which controls the convergence speed of the algorithm, u∈(0, 1) represents a uniformly distributed random number, and mBest(t+1) represents the average value of the optimal position of all particles. The formula is as follows:
[0079]
[0080] Among them, pBest l(t) represents the individual optimal position of the lth particle in the tth iteration.
[0081] P lj (t+1) represents the local attraction factor, that is:
[0082]
[0083] in, Represents a uniformly distributed random number, gBest d (t) represents the global optimal position of all particles in the dth dimension in the tth iteration.
[0084] Furthermore, with the theoretical joint angle q s is the input, the predicted joint angle deviation value The output neural network model is as follows:
[0085]
[0086] Among them, f NN Represents the neural network model obtained through training.
[0087] Step S4: Figure 3b As shown in the figure, the theoretical joint angles of the randomly sampled target points are input into the trained QPSO-BPNN to obtain the compensated angle values:
[0088]
[0089] Among them, q t represents the theoretical joint angle of the randomly sampled target point, Indicated by q t The error in the predicted output when used as input to a neural network.
[0090] The corrected angle value q m Input into the robot arm teaching device, so that the actual point P reached by the end of the robot arm m With the theoretical pose P t Closer, significantly reducing positioning errors.
[0091] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some or all of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for compensating a robotic arm error based on quantum particle swarm optimization BP neural network, characterized in that Includes steps: Step S1: Plan sampling points and collect data: Use Latin hypercube sampling LHS to plan sampling points to ensure that the sample points are evenly distributed in the parameter space, and use a laser tracker to measure the actual position and posture of the end; Step S2: constructing a robot arm error compensation model: calculating the theoretical posture of the end of the robot arm based on the exponential product POE forward kinematics model, and combining the collected actual posture to construct a robot arm error compensation model with joint angles; Step S3: Training of BP neural network model based on QPSO optimization: training the BP neural network model, and using QPSO to optimize the weights and biases of the BP neural network, and adjusting the position and velocity of the particles through quantum superposition and interference effects; Step S4: Real-time error compensation and control based on the optimized QPSO-BPNN: predict the error through the trained neural network model.
2. According to claim 1, a method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network is characterized in that: In step S1, LHS is used to randomly sample the joints of the robot arm: Among them, [a i , b i ] represents the sampling interval of the i-th dimension, represents the width of the subinterval, n represents the number of sampling points, m represents the sampling dimension, x ij represents the random sampling value of the jth sample in the i-th dimension, u ij ∈(0, 1) represents a uniformly distributed random number, ensuring the randomness of the sampling points in each subinterval.
3. The method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network according to claim 2, characterized in that: In step S1, the theoretical angle value is input into the teaching pendant, and the actual position of the end of the robotic arm measured by the laser tracker is: P r =[x r ,y r , z r ] T (3) where x r ,y r , z r It is the actual coordinate of the end of the robot arm in the base coordinate system.
4. The method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network according to claim 3, characterized in that: In step S2, the posture transformation relationship of a single joint is as follows: Among them, i∈[0,m], m represents the number of joints of the robot arm, θ i represents the rotation angle of joint i, represents the rotation of joint i, Represents the transformation matrix of joint i relative to joint i-1 when joint i is at zero position; The POE forward kinematics formula of the joint series robot arm is as follows: Wherein, M represents the transformation matrix from the base coordinate to the end coordinate when each joint of the robot arm is at zero position.
5. The method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network according to claim 4, characterized in that: In step S2, the error-joint angle mapping relationship is constructed as follows: in, Indicates the actual joint angle value of the measured posture, through q r =inv(p r ) is obtained; where p r It represents the point coordinates measured by the laser tracker with the robot base coordinate system as the origin. The function inv() is the inverse kinematics of the robot; represents the theoretical joint angle value input into the teaching pendant, q r -q s Indicates the deviation between the actual joint angle and the theoretical joint angle.
6. The method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network according to claim 5, characterized in that: In step S3, the BP neural network is trained, and the activation function is as follows: f(x)=max(0,ωq+b) (7) Among them, q represents the input of the neuron, ω represents the weight, b represents the bias, and the input of the input layer is q s , represents the theoretical joint angle value of the sampling point; The loss function of the BP neural network is as follows: Where Δq=[e1,e,...,e m ] T Indicates the actual error value of the robot arm joint angle, Represents the prediction error value of the joint angle.
7. The method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network according to claim 6, characterized in that: In step S3, the QPSO algorithm is used to optimize the weights and biases of the neural network, and the particle position iteration formula is as follows: Among them, X ld (t+1) represents the position of the particle of generation t+1, X ld (t) represents the position of the particle of generation t, N represents the number of particles: l = 1, 2, ..., N, D represents the dimension of the particle: d = 1, 2, ..., D, β represents the compression-expansion coefficient, which controls the convergence speed of the algorithm, u∈(0, 1) represents a uniformly distributed random number, and mBest(t+1) represents the average value of the optimal position of all particles. The formula is as follows: Among them, pBest l (t) represents the individual optimal position of the lth particle in the tth iteration; P lj (t+1) represents the local attraction factor, that is: in, Represents a uniformly distributed random number, gBest d (t) represents the global optimal position of all particles in the dth dimension in the tth iteration.
8. The method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network according to claim 7, characterized in that: In step S3, the theoretical joint angle q s is the input, the predicted joint angle deviation value The output neural network model is as follows: Among them, f NN Represents the neural network model obtained through training.
9. The method for compensating a mechanical arm error based on quantum particle swarm optimization BP neural network according to claim 8, characterized in that: In step S4, the angle value after compensation is as follows: Among them, q t represents the theoretical joint angle of the randomly sampled target point, Indicated by q t The prediction output error when used as input to the BP neural network; The corrected joint angle value q m Input into the teaching pendant to get the actual posture P m Compare with the theoretical pose P.
Citation Information
Patent Citations
Robot error compensation method based on adaptive Kalman filtering and neural network
CN117359613A
Mechanical arm error compensation method based on improved RBF neural network
CN118003332A
Mechanical arm parameter error identification and compensation method based on parameter sensitivity analysis and prediction
CN118163108A
Mechanical arm positioning error compensation method based on improved WOA-GA-BP neural network
CN118990515A
Cited By
Multi-source coupling error follow-up compensation method for robot dynamic grabbing
CN122231906A
Multi-source coupled error follow-up compensation method for robot dynamic grasping
CN122231906B