Position error prediction method of robot machining end point based on artificial immune algorithm
The robot's end pose error is optimized through a recursive neural network model based on artificial immune algorithm, which solves the problems of low accuracy and poor robustness of end pose error prediction, and achieves higher accuracy error prediction and more efficient production efficiency.
Patent Information
- Application Number
- CN202410924965.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-11
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-11
AI Technical Summary
In the high-precision processing of robots, the absolute positioning error is high, especially the prediction accuracy of the end position error and poor robustness, making it difficult to meet the high-precision requirements.
Using a method based on artificial immune algorithm, the robot's terminal pose error and joint angle data are trained through a recursive neural network model, the immune population is initialized and iteratively optimized, cloning, mutating and selecting operations are updated to ensure the generalization ability of the model. and performance, and finally deployed to the actual system for error prediction.
The accuracy of robot end position error prediction is improved, the error fluctuation amplitude is reduced, the system robustness is enhanced, and the production efficiency of the robot processing system is improved.
Smart Images

Figure CN118456501B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of robot error prediction, and in particular to a robot machining end position and posture error prediction method based on an artificial immune algorithm. Background Art
[0002] In view of the deviation between the designed trajectory and the actual motion trajectory of the robot during high-precision machining, it is necessary to further reduce the absolute positioning error of the robot. The absolute positioning error of the robot mainly comes from the geometric error and non-geometric error of the robot. Most of the current technologies are based on correcting the robot parameter model to compensate for the geometric error, and combining the neural network model to predict the non-geometric error. However, this method has the problem of error accumulation. When non-geometric error compensation is performed on the basis of geometric error compensation, it may cause error overlap, thereby affecting the prediction accuracy.
[0003] When combining neural network models to predict non-geometric errors, lightweight network structures are difficult to cope with complex nonlinear relationships in large-scale data sets, and are prone to falling into local optimal solutions. They also lack robustness to noise and uncertainty, resulting in low prediction accuracy. It is difficult to meet the high-precision and system robustness requirements of the robot's terminal posture error prediction. In summary, the existing technical methods or positioning error have low accuracy and poor robustness, and are weak in capturing high-order features and complex associations in the data, making it difficult to meet the high-precision requirements of the robot's positioning error prediction. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a method for predicting the end-position error of robot processing based on an artificial immune algorithm, which solves the problems of low accuracy and poor system robustness of the traditional method for predicting the end-position error of the robot. The method uses the end-position error of the robot processing and its corresponding robot joint angle data to train the recursive neural network RNN model; initialize the parameters of the artificial immune algorithm and generate the initial immune population: according to the parameter space of the RNN model, randomly generate a group of initial antibodies as the initial immune population; iterate the optimization process, in each generation, evaluate each antibody in the current immune population and calculate its fitness value; then perform cloning operations, mutation operations and selection operations to update the immune population to gradually optimize the parameters of the RNN model. Subsequently, immune selection is performed on the test individuals to ensure the balance between diversity and convergence. Subsequently, it is checked whether the termination condition is met, and if so, the iteration is terminated. The optimized RNN model is evaluated and verified using a test data set to ensure the generalization ability and performance of the model. The final RNN model obtained after optimization is deployed in the actual robot processing system to predict the end-position error of the robot.
[0005] Therefore, the present invention can simply and effectively predict the terminal posture error of the robot, and the predicted error distribution result has a smaller error fluctuation amplitude, which can more effectively improve the prediction accuracy of the terminal posture of the robot and improve the production efficiency of the robot processing system.
[0006] To solve the above technical problems, the present invention provides the following technical solution: a method for predicting the position and posture error of a robot machining end based on an artificial immune algorithm, comprising the following steps:
[0007] S1. Using robot to process the end pose error And its corresponding robot joint angle data Train the recursive neural network (RNN) model, then perform feature vectorization on the trained RNN model through the encoding and decoding process, and reconstruct the RNN model;
[0008] S2, using the vectorized features of the reconstructed RNN model as the input of the artificial immune algorithm, and randomly generating a group of initial antibodies as the initial immune population;
[0009] S3, iterative optimization process, in each generation, evaluate each antibody in the current immune population, calculate its fitness value, and calculate the concentration and excitation of the antibody, then perform cloning operations, cross-mutation parallel operations to update the immune population, and obtain a new antibody population to gradually optimize the reconstructed RNN model parameters;
[0010] S4. Perform immune selection on the trial individuals, including vaccination and immune testing;
[0011] S5. Check whether the termination condition is met. If so, terminate. Otherwise, return to the fitness calculation operation step to continue iteration, and use the test data set to evaluate and verify the optimized RNN model to ensure the generalization ability and performance of the model.
[0012] S6. Deploy the optimized final RNN model into the actual robot processing system to predict the end position error of the robot.
[0013] Furthermore, in step S1, the robot processing end position error is used And its corresponding robot joint angle data The recurrent neural network RNN model is trained. The specific process includes the following steps:
[0014] S101, using external acquisition equipment to measure the actual posture of the robot end, and at the same time collect the robot's joint data and the corresponding actual posture data, and obtain the robot processing end posture error by comparing the theoretical posture and the actual posture of the robot end , establish the corresponding robot joint angle data The relationship data set with the error;
[0015] S102, constructing a recursive neural network (RNN) model, and using the robot processing end posture error and its corresponding robot joint angle data to train the RNN model, wherein the data of the RNN model is serialized into a time series format, the input of each time step is the robot joint angle data, and the output is the corresponding robot end posture error data;
[0016] S103, first is the encoder stage Encoder, the hidden layer state of the encoder stage It can be calculated recursively using the following formula:
[0017] ;
[0018] in is the weight matrix input to the hidden layer, is the weight matrix from hidden layer to hidden layer, is the bias vector of the hidden layer, is the current time step, The first The input of the time step is the input joint angle, is the hidden state at the previous time step, is the activation function;
[0019] Take out the hidden state of the last time step output by the encoder, transform the last hidden state, and encode it into an intermediate semantic code of fixed length , which represents the entire input sequence:
[0020] ;
[0021] in, is the weight matrix from the hidden layer state to the semantic encoding at the last time step, is the semantic encoding layer bias vector;
[0022] S104, through intermediate semantic encoding , the information state vector of the entire input sequence is processed by the decoder stage, and the hidden layer state of the decoder stage It can be calculated recursively using the following formula:
[0023] ;
[0024] in, is the weight matrix from the intermediate semantic encoding to the decoder hidden layer, is the weight matrix from hidden layer to hidden layer in the decoder, is the bias vector of the hidden layer, is the time step, is the hidden state of the previous time step;
[0025] The data given by the RNN model decoder is then mapped to the terminal pose coordinates through a fully connected layer as the result output.
[0026] Further, in step S1, the trained RNN model is feature vectorized through the encoding and decoding process, and the RNN model is reconstructed, which specifically includes: the trained RNN model is feature vectorized through the encoding and decoding process, wherein the encoding process includes two steps: parameter extraction and parameter concatenation; the parameter extraction step is to extract all weights and bias parameters from the trained RNN model, and the parameter concatenation step is to connect all the extracted parameters into a real vector in a certain order, and the encoded real vector is called an individual of the RNN model, which represents a specific RNN model, wherein each dimension represents the value of a parameter;
[0027] The decoding process includes parameter separation and network reconstruction. Parameter separation is to decode the real number vector into the original weight and bias parameters. According to the order of encoding, each part of the real number vector is separated and reassembled into the weight and bias parameters of the RNN network. Network reconstruction is to use the decoded parameters to reconstruct the RNN model. According to the order of parameters, the weight and bias parameters are set to the corresponding positions to construct an RNN model with the same structure as that during encoding.
[0028] Furthermore, step S2 specifically includes: using centroidal Voronoitessellation, CVT multi-stage algorithm to initialize the immune population, first using a pseudo-random number generator PRNG to generate a temporary population for each dimension of the parameter space of the reconstructed RNN model, and constructing an initial Voronoi Voronoi diagram; using the CVT algorithm to optimize the initial Voronoi diagram, adjusting the center point of each Voronoi diagram area so that the center point represents the spatial distribution of each area, using the center point obtained by the CVT algorithm as the initial immune population, and combining the center points calculated in each dimension into dimensional vector, which is the candidate set for the immune algorithm input.
[0029] Furthermore, the specific process of step S3 includes the following steps:
[0030] S301, calculating the fitness of each antibody in the current immune population, the fitness function can be expressed as the following formula:
[0031] ;
[0032] ;
[0033] in, is a small value to avoid zero denominator, is the population size of antibodies, and Respectively The antibody component corresponds to the The actual value and predicted value of the parameter, corresponding to the 6 coordinates of the terminal posture, including position coordinates and attitude coordinates , For antibody collection The The antibody corresponds to a set of adjustment parameters for reconstructing the RNN model. When the predicted value of the RNN model is closer to the true value, the root mean square error is smaller, and the RNN model is more in line with our expectations, indicating that the first antibody in the antibody set is Antibodies The more adaptable;
[0034] S302, perform cloning operation, according to the combined association Calculation of the antibody collection Find Individuals make up a collection , the combined correlation is defined as:
[0035] ;
[0036] In the formula is the similarity adjustment factor, is the fitness adjustment factor, is the incentive adjustment factor, Antibodies The degree of motivation, Antibodies The fitness of, N is the total number of antibody populations;
[0037] The clone operator selects the individuals selected by the selection operator to form a collection Antibodies in To copy, it can be described as:
[0038] ;
[0039] in is the symbolic representation of the cloning operator, Indicates antibody Execute the clone operator operation;
[0040] The number of clones was calculated using the following formula:
[0041] ;
[0042] in is the total number of antibodies in the clone collection, is the rounding function, i.e. The fitness value of The ratio to the sum of the fitness values of all antibodies in the population, N is the total number of antibody populations;
[0043] For each selected antibody, the number of clones was determined Perform cloning operations, that is, clone to form new cloned antibodies;
[0044] S303, mutation operation is performed on the generated cloned antibodies to increase the diversity and exploration ability of the population. The mutation operation is achieved by randomly perturbing the parameters of the cloned antibodies, adding random noise to the cloned antibodies or fine-tuning the parameters. The mutation strategy in this example is to add a small perturbation to the mutation source individual:
[0045] ;
[0046] in, is the symbolic representation of the mutation operator, which is expressed as Perform mutation operations, Antibodies No. The clone Dimensions, is the defined neighborhood range, is the mutation probability, Is the generation interval A function of uniformly distributed random numbers within ;
[0047] At the same time, an adaptive crossover probability based on Hamming distance is introduced to randomly generate a number between 0 and 1. and For comparison, if , then single-point crossover is performed, and the crossover point is randomly selected, otherwise the individual is kept unchanged;
[0048] ;
[0049] In the formula, is the higher fitness value of the two individuals; 、 They are the maximum fitness and average fitness of the antibody individuals in the current population, is the Hamming distance between two antibody individuals, which reflects the similarity between the two individuals; Expressed as the adjustment factor constant;
[0050] The new antibodies obtained by crossover and mutation are then added to the original population to form a new antibody population.
[0051] Furthermore, the specific process of step S4 includes the following steps:
[0052] S401, vaccination, according to the combination of correlation Calculated Individuals, the fitness is calculated Individuals, the incentive degree is calculated Individuals were analyzed using cluster analysis The parameter distribution of each antibody individual is analyzed, and the cluster and cluster center of each parameter are determined. The cluster analysis results of these parameters are used as prior knowledge to guide the fine-tuning of antibody parameters so that they are adjusted in the direction of the nearest cluster center. The antibody parameters are optimized through this fine-tuning process, thereby achieving vaccination injection;
[0053] S402, perform an immune test and calculate the fitness of the new individual. If the fitness of the new individual is not as good as that of the old individual, the old individual is used for the subsequent calculations, otherwise the new individual is used;
[0054] ;
[0055] in Reflect antibody performance index, i.e., the fitness of the antibody; It is based on prior knowledge of antibodies The penalty item, is the weight of the penalty term;
[0056] For individual vectors, the distances between them and the centers of all clusters are summarized and a penalty coefficient is assigned , select the sum of squares of total distances as the penalty term;
[0057] ;
[0058] ;
[0059] in, is the antibody individual vector No. parameters, is the cluster center No. parameters, is the number of clusters, It is Cluster centers;
[0060] S403, using annealing method to limit the diffusion rate of vaccine, probability It can be defined as:
[0061] ;
[0062] In the current offspring population, with probability Select Antibody Entering a new parent group, Antibodies The fitness of is a temperature control sequence approaching 0.
[0063] Further, in step S5, it is checked whether the termination condition is met. If it is met, the process ends; otherwise, the process returns to the fitness calculation operation step to continue iteration. The specific process includes the following steps:
[0064] S501, calculating the correlation coefficient between antibodies, and using the correlation coefficient to measure the correlation between antibodies:
[0065] ;
[0066] in, and Antibodies and The mean of the eigenvectors of is the dimension of the feature vector, and Antibodies and No. eigenvalues;
[0067] S502, population refresh, using the generated new antibodies to replace antibodies with lower correlation coefficients in the population to form a new generation of antibodies;
[0068] S503, stop condition: the stop condition can be an optimal solution condition, a maximum number of iterations limit, or a combination of the two;
[0069] S504, decoding and applying the optimal solution: After the immune algorithm optimization is completed, the optimal feature group model parameters are decoded back into the reconstructed RNN model to obtain an optimized RNN model.
[0070] Furthermore, step S6 specifically includes: predicting the error of the corresponding robot end posture according to the input of the robot joint angle, and the robot processing system adds the predicted robot end posture error and the theoretical robot end posture output by the input controller to obtain the actual accurate posture expression of the robot end, thereby realizing the accurate positioning of the end of the robot processing system.
[0071] By means of the above technical solution, the present invention provides a method for predicting the position and posture error of a robot machining end based on an artificial immune algorithm, which has at least the following beneficial effects:
[0072] The recursive neural network RNN model is trained using the robot processing terminal posture error and its corresponding robot joint angle data; the artificial immune algorithm parameters are initialized and the initial immune population is generated: according to the parameter space of the RNN model, a group of initial antibodies is randomly generated as the initial immune population; in the iterative optimization process, each antibody in the current immune population is evaluated in each generation and its fitness value is calculated; then the cloning operation, mutation operation and selection operation are performed to update the immune population to gradually optimize the parameters of the RNN model. Subsequently, immune selection is performed on the test individuals to ensure the balance between diversity and convergence. Subsequently, it is checked whether the termination condition is met, and if so, the iteration is terminated. The optimized RNN model is evaluated and verified using the test data set to ensure the generalization ability and performance of the model. The final RNN model obtained after optimization is deployed to the actual robot processing system to predict the robot's terminal posture error.
[0073] Therefore, the present invention can simply and effectively predict the robot's end-point posture error, and the predicted error distribution result has a smaller error fluctuation amplitude, which can more effectively improve the prediction accuracy of the robot's end-point posture, and improve the production efficiency of the robot processing system; it solves the problems of low accuracy and poor system robustness in traditional methods for predicting the robot's end-point posture error. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0075] Figure 1 It is a flow chart of a method for predicting the position and posture error of a robot machining end based on an artificial immune algorithm according to an embodiment of the present invention;
[0076] Figure 2 Schematic diagram of the structure of a six-degree-of-freedom serial robot used in an embodiment of the present invention;
[0077] Figure 3It is an iterative flow chart of a method for predicting the position and posture error of a robot machining end based on an artificial immune algorithm according to an embodiment of the present invention;
[0078] Figure 4 The present invention uses an external acquisition device to measure the real posture of the robot end, and simultaneously collects the robot's joint data and the corresponding real posture data schematic diagram;
[0079] Figure 5 It is a schematic diagram of the basic structure of the recursive neural network (RNN) model adopted in the embodiment of the present invention. DETAILED DESCRIPTION
[0080] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific implementation methods, so that the implementation process of how the present application uses technical means to solve technical problems and achieve technical effects can be fully understood and implemented accordingly.
[0081] Those skilled in the art can understand that all or part of the steps in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a program, so the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0082] Please refer to Figure 1-Figure 5 , showing a specific implementation of this embodiment, this embodiment can simply and effectively predict the end posture error of the robot, the predicted error distribution result has a smaller error fluctuation range, can more effectively improve the prediction accuracy of the robot's end posture, and improve the production efficiency of the robot processing system.
[0083] Please refer to Figure 1 This embodiment proposes a method for predicting the position and posture error of a robot processing end based on an artificial immune algorithm, and the method includes the following steps:
[0084] S1. Using robot to process the end pose error And its corresponding robot joint angle data Train the recurrent neural network (RNN) model, then perform feature vectorization on the trained RNN model through the encoding and decoding process, and reconstruct the RNN model;
[0085] As a preferred implementation of step S1, the specific process of step S1 includes the following steps:
[0086] S101, using external acquisition equipment to measure the actual posture of the robot end, and at the same time collect the robot's joint data and the corresponding actual posture data, and obtain the robot processing end posture error by comparing the theoretical posture and the actual posture of the robot end , establish the corresponding robot joint angle data The relationship data set with the error;
[0087] S102, constructing a recursive neural network (RNN) model, and using the robot processing end posture error and its corresponding robot joint angle data to train the RNN model, wherein the data of the RNN model is serialized into a time series format, the input of each time step is the robot joint angle data, and the output is the corresponding robot end posture error data;
[0088] S103, the number of neurons in the hidden layer of the RNN model in this embodiment is set to 12. First, the encoder stage Encoder, the hidden layer state of the encoder stage It can be calculated recursively using the following formula:
[0089] ;
[0090] in is the weight matrix input to the hidden layer, is the weight matrix from hidden layer to hidden layer, is the bias vector of the hidden layer, is the current time step, The first The input of the time step is the input joint angle, is the hidden state at the previous time step, is the activation function;
[0091] Take out the hidden state of the last time step output by the encoder, transform the last hidden state, and encode it into an intermediate semantic code of fixed length , which represents the entire input sequence:
[0092] ;
[0093] in, is the weight matrix from the hidden layer state to the semantic encoding at the last time step, is the semantic encoding layer bias vector;
[0094] S104, through intermediate semantic encoding , the information state vector of the entire input sequence is processed by the decoder stage, and the hidden layer state of the decoder stage It can be calculated recursively using the following formula:
[0095] ;
[0096] in, is the weight matrix from the intermediate semantic encoding to the decoder hidden layer, is the weight matrix from hidden layer to hidden layer in the decoder, is the bias vector of the hidden layer, is the time step, is the intermediate semantic code, is the hidden state at the previous time step, is an activation function; this embodiment uses a hyperbolic tangent function as the activation function of the decoder stage;
[0097] The data given by the RNN model decoder is then mapped to the terminal pose coordinates through a fully connected layer as the result output.
[0098] S105, feature vectorization is performed on the trained RNN model through the encoding and decoding process. Feature vectorization is to convert the extracted features into vector form for processing in the immune algorithm. The encoding process includes two steps: parameter extraction and parameter concatenation. The parameter extraction step is to extract all weights and bias parameters from the trained RNN model, including the weights from the input to the hidden layer, the weights from the hidden layer to the hidden layer, the weights from the hidden layer to the output layer, and the biases of the hidden layer and the output layer. The parameter concatenation step is to connect all the extracted parameters into a real vector in a certain order. Any appropriate order can also be selected. It is necessary to ensure that the connected vector can uniquely represent the parameters of the RNN network. The encoded real vector is called an individual of the RNN model, which represents a specific RNN model, in which each dimension represents the value of a parameter.
[0099] The decoding process includes parameter separation and network reconstruction. Parameter separation is to decode the real number vector into the original weight and bias parameters. According to the order of encoding, each part of the real number vector is separated and reassembled into the weight and bias parameters of the RNN network. Network reconstruction is to use the decoded parameters to reconstruct the RNN model. According to the order of parameters, the weight and bias parameters are set to the corresponding positions to construct an RNN model with the same structure as that during encoding.
[0100] S2. The features of the reconstructed RNN model are vectorized as the input of the artificial immune algorithm. These feature vectors can be used as initial antibodies to represent candidate solutions, and a group of initial antibodies are randomly generated as the initial immune population;
[0101] As a preferred implementation method of step S2, step S2 specifically includes: using centroidal Voronoi tessellation and CVT multi-stage algorithm to initialize the immune population, first using a pseudo-random number generator PRNG to generate a temporary population for each dimension of the parameter space of the reconstructed RNN model, and constructing an initial Voronoi Voronoi diagram; using the CVT algorithm to optimize the initial Voronoi diagram, adjusting the center point of each Voronoi diagram area so that the center point represents the spatial distribution of each area, using the center point obtained by the CVT algorithm as the initial immune population, and combining the center points calculated in each dimension into a dimension vector as a candidate set for the immune algorithm input.
[0102] S3, iterative optimization process, in each generation, evaluate each antibody in the current immune population, calculate its fitness value, and calculate the concentration and excitation of the antibody, then perform cloning operations, cross-mutation parallel operations to update the immune population, and obtain a new antibody population to gradually optimize the reconstructed RNN model parameters;
[0103] As a preferred implementation of step S3, the specific process of step S3 includes the following steps:
[0104] S301, calculating the fitness of each antibody in the current immune population, the fitness function can be expressed as the following formula:
[0105] ;
[0106] ;
[0107] in, is a small value to avoid zero denominator, is the population size of antibodies, and Respectively The antibody component corresponds to the The actual value and predicted value of the parameter, corresponding to the 6 coordinates of the terminal posture, including position coordinates and attitude coordinates , For antibody collection The The antibody corresponds to a set of adjustment parameters for reconstructing the RNN model. When the predicted value of the RNN model is closer to the true value, the root mean square error is smaller, and the RNN model is more in line with our expectations, indicating that the first antibody in the antibody set is Antibodies The more adaptable;
[0108] The antibody concentration in the current immune population is then calculated and is usually defined as:
[0109] ;
[0110] ;
[0111] Where N is the total number of antibody populations, For the The antibody and The similarity between antibodies For antibody collection The Antibodies, Antibodies With antibodies The affinity of is the similarity threshold;
[0112] For the real-coded algorithm, the affinity between antibodies is calculated by the Euclidean distance between antibody vectors:
[0113] ;
[0114] in, Antibodies No. Dimensions, is the total dimension of the antibody encoding;
[0115] The affinity between the antibody and the antigen is then defined:
[0116] ;
[0117] ;
[0118] in Indicates antibody The binding strength to the antigen, The goal is to minimize the difference between the true value and the predicted value, where is the fitness value of the optimal solution, is the fitness value corresponding to the antibody;
[0119] Define the incentive calculation operator. The antibody incentive is the final evaluation result of the antibody quality. A larger incentive is given to antibodies with high affinity and low concentration. The calculation of the antibody incentive is usually as follows:
[0120] ;
[0121] in, Antibodies The degree of motivation, , is the calculation parameter; Antibodies affinity; Antibodies concentration;
[0122] S302, perform cloning operation. The cloning multiple determines the number of cloned antibodies, thereby determining the algorithm's search capability, mainly local search capability; according to the combined correlation Calculation of the antibody collection Find Individuals make up a collection , the combined correlation is defined as:
[0123] ;
[0124] In the formula is the similarity adjustment factor, is the fitness adjustment factor, is the incentive adjustment factor, Antibodies The degree of motivation, Antibodies The fitness of, N is the total number of antibody populations;
[0125] The clone operator selects the individuals selected by the selection operator to form a collection Antibodies in To copy, it can be described as:
[0126] ;
[0127] in is the symbolic representation of the cloning operator, Indicates antibody Execute the clone operator operation;
[0128] The number of clones was calculated using the following formula:
[0129] ;
[0130] in is the total number of antibodies in the clone collection, is the rounding function, i.e. The fitness value of The ratio to the sum of the fitness values of all antibodies in the population, N is the total number of antibody populations;
[0131] For each selected antibody, the number of clones was determined Perform cloning operations, that is, clone to form new cloned antibodies;
[0132] S303, executing crossover and mutation operations in parallel: performing crossover and mutation respectively on the excellent parent generations retained after the suppression and promotion selection, and forming the obtained new population together with the excellent parent generations into a new offspring, thereby optimizing the evolution speed while maintaining population diversity.
[0133] First, the generated cloned antibodies are mutated to increase the diversity and exploration ability of the population. The mutation operation is achieved by randomly perturbing the parameters of the cloned antibodies, adding random noise to the cloned antibodies or fine-tuning the parameters. The mutation strategy in this example is to add a small perturbation to the mutation source individual:
[0134] ;
[0135] in, is the symbolic representation of the mutation operator, which is expressed as Perform mutation operations, Antibodies No. The clone Dimensions, is the defined neighborhood range, is the mutation probability, Is the generation interval A function of uniformly distributed random numbers within ;
[0136] At the same time, an adaptive crossover probability based on Hamming distance is introduced, which is a strategy for dynamically adjusting the crossover operation. The crossover probability is adjusted according to the similarity between antibodies to avoid individuals with too high similarity from causing premature convergence of the population during the reproduction process. The specific operation is: randomly generate a number between 0 and 1 and For comparison, if , then single-point crossover is performed, and the crossover point is randomly selected, otherwise the individual is kept unchanged;
[0137] ;
[0138] In the formula, is the higher fitness value of the two individuals; 、 They are the maximum fitness and average fitness of the antibody individuals in the current population, is the Hamming distance between two antibody individuals, which reflects the similarity between the two individuals; It is expressed as the adjustment factor constant; the parameter should be less than 1, and in this example, the parameter is selected as 0.6;
[0139] The new antibodies obtained by crossover and mutation are then added to the original population to form a new antibody population.
[0140] S4. Perform immune selection on the trial individuals, including vaccination and immune testing;
[0141] As a preferred implementation of step S4, the specific process of step S4 includes the following steps:
[0142] S401, vaccination, vaccination is based on prior knowledge to estimate and adjust the individual parameters of antibodies, and the process of optimizing the individual parameters of antibodies based on vaccines is called vaccination, which can eliminate the negative effects caused by the production of some new antibodies. Prior knowledge can come from the advice given by experts in the field, the distribution trend of historical data, previous optimization experience, etc.
[0143] In this embodiment, according to the combination of Calculated Individuals, the fitness is calculated Individuals, the incentive degree is calculated Individuals were analyzed by cluster analysis. The parameter distribution of each antibody individual is analyzed to obtain the adjustment trend, and the cluster and cluster center of each parameter are determined. The cluster analysis results of these parameters are used as prior knowledge to guide the fine-tuning of antibody parameters so that they are adjusted in the direction of the nearest cluster center. The antibody parameters are optimized through this fine-tuning process, thereby achieving vaccination injection;
[0144] More specifically: the preferred 3 Each dimension parameter of an antibody individual constitutes a vector , for each vector Objects are clustered into designated clusters based on the similarity between objects, and samples are randomly selected as the initial mean center. ;
[0145] In the above formula, Indicates objects, Indicates Cluster centers are calculated, and the distance between each object and each cluster center is compared in turn. The object is assigned to the cluster closest to the cluster center. Clusters of classes;
[0146] Update cluster center: For each cluster, calculate the mean of all samples in the cluster and use the mean as the new cluster center. The cluster center is the mean of all objects in the cluster in each dimension. The calculation formula is as follows:
[0147] ;
[0148] In the formula, Indicates The center of the cluster, Indicates The number of objects in a cluster, Indicates In the cluster Repeat the above steps until the cluster center no longer changes or the maximum number of iterations is reached, and the cluster and cluster center of each parameter of the antibody are obtained;
[0149] S402, perform an immune test and calculate the fitness of the new individual. If the fitness of the new individual is not as good as that of the old individual, the old individual is used for the subsequent calculations, otherwise the new individual is used;
[0150] ;
[0151] in Reflecting the individual performance index, i.e., the fitness of the antibody; It is based on prior knowledge of individuals The penalty item, is the weight of the penalty term;
[0152] For individual vectors, the distances between them and the centers of all clusters are summarized and a penalty coefficient is assigned , select the sum of squares of total distances as the penalty term;
[0153] ;
[0154] ;
[0155] in, is the antibody individual vector No. parameters, is the cluster center No. parameters, is the number of clusters, It is Cluster centers;
[0156] S403, using annealing method to limit the diffusion rate of vaccine, probability It can be defined as:
[0157] ;
[0158] In the current offspring population, with probability Select individuals Entering a new parent group, For individuals The fitness of is a temperature control sequence approaching 0.
[0159] S5. Check whether the termination condition is met. If so, terminate. Otherwise, return to the fitness calculation operation step to continue iteration, and use the test data set to evaluate and verify the optimized RNN model to ensure the generalization ability and performance of the model.
[0160] As a preferred implementation of step S5, in step S5, it is checked whether the termination condition is met, if it is met, the process ends, otherwise it returns to the fitness calculation operation step to continue iteration, and the specific process includes the following steps:
[0161] S501, calculating the correlation coefficient between antibodies, and using the correlation coefficient to measure the correlation between antibodies:
[0162] ;
[0163] in, and Antibodies and The mean of the eigenvectors of is the dimension of the feature vector, and Antibodies and No. eigenvalues;
[0164] S502, population refresh, using the generated new antibodies to replace antibodies with lower correlation coefficients in the population to form a new generation of antibodies;
[0165] S503, stop condition: the stop condition can be an optimal solution condition, a maximum number of iterations limit, or a combination of the two;
[0166] S504, decoding and applying the optimal solution: After the immune algorithm optimization is completed, the optimal feature group model parameters are decoded back into the reconstructed RNN model to obtain an optimized RNN model.
[0167] S6. Deploy the optimized final RNN model into the actual robot processing system to predict the robot's end position error.
[0168] As a preferred implementation of step S6, step S6 specifically includes: predicting the error of the corresponding robot end posture according to the input of the robot joint angle, the robot processing system adds the predicted robot end posture error and the theoretical robot end posture output by the input controller to obtain the actual accurate posture expression of the robot end, thereby realizing the accurate positioning of the end of the robot processing system.
[0169] In summary, the present invention simply and effectively predicts the terminal posture error of the robot, and the predicted error distribution result has a smaller error fluctuation amplitude, which can more effectively improve the prediction accuracy of the terminal posture of the robot and improve the production efficiency of the robot processing system.
[0170] The present invention also provides an error prediction system, which includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the robot machining end position and posture error prediction method based on the artificial immune algorithm as described above is executed.
[0171] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine different embodiments or examples described in this specification and the features of different embodiments or examples, unless they are contradictory.
[0172] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, which can be embodied in any computer-readable medium for use by an instruction execution system, apparatus or device (such as a computer-based system, a system including a processor or other system that can fetch instructions from an instruction execution system, apparatus or device and execute instructions), or used in combination with these instruction execution systems, apparatuses or devices.
[0173] The above implementation methods have been described in detail. Specific examples are used herein to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A method for predicting the end-point posture error of robot machining based on artificial immune algorithm, characterized in that: The following steps are involved: S1. Using robot to process the end pose error And its corresponding robot joint angle data Train the recursive neural network (RNN) model, then perform feature vectorization on the trained RNN model through the encoding and decoding process, and reconstruct the RNN model; S2, using the vectorized features of the reconstructed RNN model as the input of the artificial immune algorithm, and randomly generating a group of initial antibodies as the initial immune population; S3, iterative optimization process, in each generation, evaluate each antibody in the current immune population, calculate its fitness value, and calculate the concentration and excitation of the antibody, then perform cloning operations, cross-mutation parallel operations to update the immune population, and obtain a new antibody population to gradually optimize the reconstructed RNN model parameters; S4. Perform immune selection on the trial individuals, including vaccination and immune testing; S5. Check whether the termination condition is met. If so, terminate. Otherwise, return to the fitness calculation operation step to continue iteration, and use the test data set to evaluate and verify the optimized RNN model to ensure the generalization ability and performance of the model. S6. Deploy the optimized final RNN model into the actual robot processing system to predict the end position error of the robot.
2. The method for predicting the position and posture error of a robot machining end point based on an artificial immune algorithm according to claim 1, characterized in that: In step S1, the robot processing end pose error is used And its corresponding robot joint angle data The recurrent neural network RNN model is trained. The specific process includes the following steps: S101, using external acquisition equipment to measure the actual posture of the robot end, and at the same time collect the robot's joint data and the corresponding actual posture data, and obtain the robot processing end posture error by comparing the theoretical posture and the actual posture of the robot end , establish the corresponding robot joint angle data The relationship data set with the error; S102, constructing a recursive neural network (RNN) model, and using the robot processing end posture error and its corresponding robot joint angle data to train the RNN model, wherein the data of the RNN model is serialized into a time series format, the input of each time step is the robot joint angle data, and the output is the corresponding robot end posture error data; S103, first is the encoder stage Encoder, the hidden layer state of the encoder stage It can be calculated recursively using the following formula: ; in is the weight matrix input to the hidden layer, is the weight matrix from hidden layer to hidden layer, is the bias vector of the hidden layer, is the current time step, The first The input of the time step is the input joint angle, is the hidden state at the previous time step, is the activation function; Take out the hidden state of the last time step output by the encoder, transform the last hidden state, and encode it into an intermediate semantic code of fixed length , which represents the entire input sequence: ; in, is the weight matrix from the hidden layer state to the semantic encoding at the last time step, is the semantic encoding layer bias vector; S104, through intermediate semantic encoding , the information state vector of the entire input sequence is processed by the decoder stage, and the hidden layer state of the decoder stage It can be calculated recursively using the following formula: ; in, is the weight matrix from the intermediate semantic encoding to the decoder hidden layer, is the weight matrix from hidden layer to hidden layer in the decoder, is the bias vector of the hidden layer, is the time step, is the hidden state of the previous time step; The data given by the RNN model decoder is then mapped to the terminal pose coordinates through a fully connected layer as the result output.
3. The method for predicting the position and posture error of a robot machining end point based on an artificial immune algorithm according to claim 2, characterized in that: In step S1, the trained RNN model is feature vectorized through the encoding and decoding process, and the RNN model is reconstructed, which specifically includes: the trained RNN model is feature vectorized through the encoding and decoding process, wherein the encoding process includes two steps: parameter extraction and parameter concatenation; the parameter extraction step is to extract all weights and bias parameters from the trained RNN model, and the parameter concatenation step is to connect all the extracted parameters into a real vector in a certain order, and the encoded real vector is called an individual of the RNN model, which represents a specific RNN model, wherein each dimension represents the value of a parameter; The decoding process includes parameter separation and network reconstruction. Parameter separation is to decode the real number vector into the original weight and bias parameters. According to the order of encoding, each part of the real number vector is separated and reassembled into the weight and bias parameters of the RNN network. Network reconstruction is to use the decoded parameters to reconstruct the RNN model. According to the order of parameters, the weight and bias parameters are set to the corresponding positions to construct an RNN model with the same structure as that during encoding.
4. The method for predicting the position and posture error of a robot machining end point based on an artificial immune algorithm according to claim 1, characterized in that: Step S2 specifically includes: using centroidal Voronoitessellation and CVT multi-stage algorithm to initialize the immune population, first using a pseudo-random number generator PRNG to generate a temporary population for each dimension of the parameter space of the reconstructed RNN model, and constructing an initial Voronoi Voronoi diagram; using the CVT algorithm to optimize the initial Voronoi diagram, adjusting the center point of each Voronoi diagram area so that the center point represents the spatial distribution of each area, using the center point obtained by the CVT algorithm as the initial immune population, and combining the center points calculated in each dimension into dimensional vector, which is the candidate set for the immune algorithm input.
5. The method for predicting the position and posture error of a robot machining end point based on an artificial immune algorithm according to claim 1, characterized in that: The specific process of step S3 includes the following steps: S301, calculating the fitness of each antibody in the current immune population, the fitness function can be expressed as the following formula: ; ; in, is a small value to avoid zero denominator, is the population size of antibodies, and Respectively The antibody component corresponds to the The actual value and predicted value of the parameter, corresponding to the 6 coordinates of the terminal posture, including position coordinates and attitude coordinates , For antibody collection The The antibody corresponds to a set of adjustment parameters for reconstructing the RNN model. When the predicted value of the RNN model is closer to the true value, the root mean square error is smaller, and the RNN model is more in line with our expectations, indicating that the first Antibodies The more adaptable; S302, perform cloning operation, according to the combined association Calculation of the antibody collection Find Individuals make up a collection , the combined correlation is defined as: ; In the formula is the similarity adjustment factor, is the fitness adjustment factor, is the incentive adjustment factor, Antibodies The degree of motivation, Antibodies The fitness of, N is the total number of antibody populations; The clone operator selects the individuals selected by the selection operator to form a collection Antibodies in To copy, it can be described as: ; in is the symbolic representation of the cloning operator, Indicates antibody Execute the clone operator operation; The number of clones was calculated using the following formula: ; in is the total number of antibodies in the clone collection, is the rounding function, i.e. The fitness value of The ratio to the sum of the fitness values of all antibodies in the population, N is the total number of antibody populations; For each selected antibody, the number of clones was determined Perform cloning operations, that is, clone to form new cloned antibodies; S303, mutation operation is performed on the generated cloned antibodies to increase the diversity and exploration ability of the population. The mutation operation is achieved by randomly perturbing the parameters of the cloned antibodies, adding random noise to the cloned antibodies or fine-tuning the parameters. The mutation strategy in this example is to add a small perturbation to the mutation source individual: ; in, is the symbolic representation of the mutation operator, which is expressed as Perform mutation operations, Antibodies No. The clone Dimensions, is the defined neighborhood range, is the mutation probability, Is the generation interval A function of uniformly distributed random numbers within ; At the same time, an adaptive crossover probability based on Hamming distance is introduced to randomly generate a number between 0 and 1. and For comparison, if , then single-point crossover is performed, and the crossover point is randomly selected, otherwise the individual is kept unchanged; ; In the formula, is the higher fitness value of the two individuals; 、 They are the maximum fitness and average fitness of the antibody individuals in the current population, is the Hamming distance between two antibody individuals, which reflects the similarity between the two individuals; Expressed as the adjustment factor constant; The new antibodies obtained by crossover and mutation are then added to the original population to form a new antibody population.
6. The method for predicting the position and posture error of a robot machining end point based on an artificial immune algorithm according to claim 1, characterized in that: The specific process of step S4 includes the following steps: S401, vaccination, according to the combination of correlation Calculated Individuals, the fitness is calculated Individuals, the incentive degree is calculated Individuals were analyzed using cluster analysis The parameter distribution of each antibody individual is analyzed, and the cluster and cluster center of each parameter are determined. The cluster analysis results of these parameters are used as prior knowledge to guide the fine-tuning of antibody parameters so that they are adjusted in the direction of the nearest cluster center. The antibody parameters are optimized through this fine-tuning process, thereby achieving vaccination injection; S402, perform an immune test and calculate the fitness of the new individual. If the fitness of the new individual is not as good as that of the old individual, the old individual is used for the subsequent calculations, otherwise the new individual is used; ; in Reflect antibody performance index, i.e., the fitness of the antibody; It is based on prior knowledge of antibodies The penalty item, is the weight of the penalty term; For individual vectors, the distances between them and the centers of all clusters are summarized and a penalty coefficient is assigned , select the sum of squares of total distances as the penalty term; ; ; in, is the antibody individual vector No. parameters, is the cluster center No. parameters, is the number of clusters, It is Cluster centers; S403, using annealing method to limit the diffusion rate of vaccine, probability It can be defined as: ; In the current offspring population, with probability Select Antibody Entering a new parent group, Antibodies The fitness of is a temperature control sequence approaching 0.
7. The method for predicting the position and posture error of a robot machining end point based on an artificial immune algorithm according to claim 1, characterized in that: In step S5, it is checked whether the termination condition is met. If so, the process ends. Otherwise, the process returns to the fitness calculation operation step to continue iteration. The specific process includes the following steps: S501, calculating the correlation coefficient between antibodies, and using the correlation coefficient to measure the correlation between antibodies: ; in, and Antibodies and The mean of the eigenvectors of is the dimension of the feature vector, and Antibodies and No. eigenvalues; S502, population refresh, using the generated new antibodies to replace antibodies with lower correlation coefficients in the population to form a new generation of antibodies; S503, stop condition: the stop condition can be an optimal solution condition, a maximum number of iterations limit, or a combination of the two; S504, decoding and applying the optimal solution: After the immune algorithm optimization is completed, the optimal feature group model parameters are decoded back into the reconstructed RNN model to obtain an optimized RNN model.
8. The method for predicting the position and posture error of a robot machining end point based on an artificial immune algorithm according to claim 1, characterized in that: Step S6 specifically includes: predicting the error of the corresponding robot end posture according to the input of the robot joint angle, and the robot processing system adds the predicted robot end posture error to the theoretical robot end posture output by the input controller to obtain the actual accurate posture expression of the robot end, thereby realizing the accurate positioning of the end of the robot processing system.
Citation Information
Patent Citations
Robotic control using deep learning
CN113269299A
Multi-robot collaborative immune network control method
CN116277026A
MGU-A thermal error prediction model creation method and digital twinning-based thermal error control system
CN116415501A
Robot positioning error prediction method and system based on L-SHADE-MLP
CN117798920A
Point registration method in surgical navigation system
KR102442090B1
