Disclosure of Invention
Aiming at the defects of the prior art, the invention discloses a method for identifying the kinetic parameters of a 6-axis robot based on a neural network, which improves the estimation precision of the kinetic parameters and has higher fault tolerance.
A method for identifying dynamic parameters of a 6-axis robot based on a neural network comprises the following steps:
the first step of dynamic modeling is carried out, a D-H connecting rod coordinate system of the 6-axis robot is established, and a dynamic equation of the robot is established. And deducing an explicit linear expression of the robot according to a Lagrange kinetic equation, simplifying the expression into a linear form according to a minimum inertia principle, and providing kinetic parameters and an observation matrix which need to be identified.
And (2) second step of excitation trajectory optimization, namely performing Fourier series expansion of joint angles, wherein in order to obtain a Fourier series with continuous boundaries, joint angular velocities and angular accelerations equal to 0 at the beginning of a period, the Fourier series needs to be optimized (improved), a quintic polynomial is used for replacing a constant term to obtain an improved Fourier series, and the related formula is as follows:
wherein i is the ith joint, w
fFundamental frequency of Fourier series, a
ik,b
ikIs a Fourier series, and is characterized in that,
is a constant term coefficient, and M is the order of a Fourier series.
Optimizing to obtain Fourier series coefficients by an immune clone algorithm to obtain an optimized excitation track;
thirdly, experimental sampling, namely enabling the robot to move along with the excitation track, collecting joint angles of a plurality of groups of robots by using a photoelectric encoder in a plurality of periods at different moments to obtain a plurality of groups of joint moments as experimental samples, obtaining motor feedback current at the same time, and solving motor output moment according to a torque coefficient to obtain the joint moment;
the fourth step of data processing, namely performing data preprocessing on the data acquired by the experiment through a three-standard-deviation and median average filtering method to reduce the influence of data noise on the experiment;
and fifthly, estimating dynamic parameters, namely identifying the dynamic parameters through a neural network according to a plurality of groups of observation matrixes and joint moments obtained through experiments.
And sixthly, verifying parameters, namely giving an executable track different from the excitation track, enabling the robot to move along the track, collecting joint angles of a plurality of groups of robots in a plurality of periods at different moments, feeding back current by a motor, obtaining theoretical joint torque according to the solved kinetic parameters, comparing the theoretical joint torque with joint torque obtained by experiments, and evaluating the reliability of the kinetic parameters by using a torque residual root.
Further, the optimized fourier series of the immune clone algorithm is specifically that each joint of the improved excitation track has 10 degrees of freedom, and the total of 3 joints has 30 degree of freedom coefficients, and meanwhile, the position, speed and acceleration of the joints of the robot are constrained, the optimized result is obtained by adopting the immune clone selection algorithm, the optimized index is the condition number of the observation matrix is minimum, and the optimized steps of the immune clone selection algorithm are as follows:
(1) firstly, antigen is identified, namely, the problem needing optimization is analyzed, and optimization characteristics are selected. And carrying out feasibility analysis on the characteristics to be optimized, and then constructing an affinity function of the characteristics to be optimized to serve as an evaluation index of the problem and construct a constraint condition of the problem. The optimization problem in this context is the 30 degree of freedom coefficients, the minimum condition number as its affinity function, the range of joint motion of the robot, the maximum velocity and the maximum acceleration as its constraints.
(2) The antibody is then initialized. Because the binary coding method has the disadvantages of low efficiency and "hamming cliff", the initial solution adopts a real number coding method. A set of random initial solutions satisfying constraints is generated by encoding feasible solutions to the problem into antibodies in an immune clonal selection algorithm.
(3) The affinity was calculated for each individual antibody in the population. The performance of the antibodies was evaluated by calculating the affinity of the individual.
(4) The antibodies in the population are ranked according to the magnitude of affinity, and the top 50% of good individuals are selected as good individuals.
(5) And carrying out cloning, mutation and clone inhibition operations on the selected excellent individuals, and deleting and selecting to obtain the same number of filial individuals.
(6) And randomly generating new populations with the number equal to that of the original populations, calculating the affinity of the new populations, and deleting the top 50% of good offspring.
(7) Combining the immune population generated in (5) and (6) with the new population to replace the original population.
(8) And judging whether the obtained new population meets the termination condition of the algorithm, wherein the termination condition is that the iteration times exceed 200 times, if so, terminating the optimization searching process, and otherwise, continuing to perform the iteration optimization searching.
Further, the fourth step is specifically to firstly perform a three-standard-deviation criterion on a plurality of groups of observation matrix data obtained by sampling, and remove gross errors; and then, processing the experimental data by using a median average filtering method to reduce the influence caused by data noise.
Further, the fifth step is to use an observation matrix obtained through an experiment as the input of the neural network, set the initial weight to be a random value of 0 to 1, use the joint moment obtained through the experiment as a label of the output of the neural network, and use the theoretical joint moment as the output of the neural network. And estimating the kinetic parameters by adopting a batch gradient descent optimization algorithm, wherein the weights of the trained neural network are the kinetic parameters to be estimated.
Further, in the first step, for the n-joint robot system, the dynamic equation can be expressed by a second-order nonlinear differential equation by considering the influence of joint friction:
wherein M (q) represents an inertial matrix and q is a joint angle vector;
is the joint angular velocity vector;
is a joint angular acceleration vector;
is a matrix of centrifugal and coriolis forces; g (q) is a robot gravity term; τ is the control force vector.
Its kinetic model can be linearized and simplified:
wherein W is an observation matrix formed by variables of each joint of the robot,
is the kinetic parameter to be identified.
Furthermore, in the third step, the joint angle obtained by the experiment is fitted into a Fourier series, the differential is obtained to obtain the joint angular velocity, the differential is obtained to obtain the joint angular acceleration, and a plurality of groups of observation matrixes are formed to be used as experiment samples.
The invention has the advantages and beneficial effects that:
the traditional method for identifying the kinetic parameters comprises a disintegration measurement method, a CAD method and an integral identification method, and the method provided by the invention belongs to the integral identification method.
The invention provides a method for processing data by using a three-standard-difference criterion and a median average filtering method, which removes gross errors caused by misoperation or incorrect operation, integrates the advantages of two filtering algorithms, can inhibit random interference and filter obvious pulse interference. The excitation tracks are mostly optimized by adopting a genetic algorithm, local optimization is easy to fall into, the calculation is complex, the situation of local optimization can be effectively avoided by adopting an artificial immune algorithm, and the convergence speed of the algorithm is high.
The invention provides a method for estimating kinetic parameters by using a neural network, wherein the neural network has higher fault tolerance and the capability of searching an optimal solution at high speed, and the kinetic parameters of a robot can be quickly and accurately estimated by the neural network.
Detailed Description
The technical scheme of the invention is further explained by combining the attached drawings of the specification.
And selecting a proper 6-axis robot to obtain information such as D-H parameters of the robot.
D-H parameter
alpha1=pi/2;a1=160;d1=0;theta1=q1;init_theta1=0
alpha2=0;a2=575;d2=0;theta2=q2;init_theta2=pi/2
alpha3=pi/2;a3=130;d3=644;theta3=q3;init_theta3=0
alpha4=-pi/2;a4=0;d4=0;theta4=q4;init_theta4=0
alpha5=pi/2;a5=0;d5=0;theta5=q5;init_theta5=-pi/2
alpha6=0;a6=0;d6=109.5;theta6=q6;init_theta6=pi/2
The invention adopts the following steps:
a method for identifying dynamic parameters of a 6-axis robot based on a neural network mainly comprises the following steps:
the first step of dynamic modeling is carried out, a D-H connecting rod coordinate system of the 6-axis robot is established, a dynamic equation of the robot is established, the rear three axes mainly influence the tail end posture of the robot and have small influence on joint moment, so that the robot is not considered, and the front three joint dynamic parameters are mainly identified. And deducing an explicit linear expression of the robot according to a Lagrange kinetic equation, simplifying the expression into a linear form according to a minimum inertia parameter principle, and providing kinetic parameters to be identified and an observation matrix.
For an n-joint robot system, the dynamic equation can be expressed by a second-order nonlinear differential equation by considering the influence of joint friction:
wherein M (q) represents an inertial matrix and q is a joint angle vector;
is the joint angular velocity vector;
is a joint angular acceleration vector;
is a matrix of centrifugal and coriolis forces; g (q) is a robot gravity term; τ is the control force vector.
Its kinetic model can be linearized and simplified:
wherein W is an observation matrix formed by variables of each joint of the robot,
is the kinetic parameter to be identified.
And (2) second step of excitation trajectory optimization, namely performing Fourier series expansion on joint angles, and in order to obtain a Fourier series with continuous boundaries, joint angular velocities and angular accelerations equal to 0 at the beginning of a period, optimizing (improving) the Fourier series, and replacing a constant term by a fifth-order polynomial to obtain an improved Fourier series, wherein the related formula is as follows:
wherein i is the ith joint, w
fFundamental frequency of Fourier series, a
ik,b
ikIs a Fourier series, and is characterized in that,
is a constant term coefficient, and M is the order of a Fourier series.
And optimizing to obtain Fourier series coefficients by using an immune clone algorithm, wherein the Fourier series optimized by the immune clone algorithm is specifically that each joint of the improved excitation track has 10 degrees of freedom, and the total of 3 joints is 30 degree of freedom coefficients. Meanwhile, the joint position, the speed and the acceleration of the robot are constrained, so that the excitation track optimization problem is a multi-constraint optimization problem. The optimization index is the minimum condition number of the observation matrix, and the traditional method is complex in solving abnormity, so that a better optimization result is obtained by adopting an immune clone selection algorithm.
The optimization steps of the immune clone selection algorithm are as follows:
(1) firstly, antigen is identified, namely, the problem needing optimization is analyzed, and optimization characteristics are selected. And performing feasibility analysis on the characteristics to be optimized, and then constructing an affinity function of the characteristics, namely, the affinity function is the minimum condition number of the observation matrix and is used as an evaluation index of the problem, and meanwhile, a constraint condition of the problem is constructed. The optimization problem in this context is the 30 degree of freedom coefficients, the minimum condition number as its affinity function, the range of joint motion of the robot, the maximum velocity and the maximum acceleration as its constraints.
(2) The antibody is then initialized. Because the binary coding method has the disadvantages of low efficiency and "hamming cliff", the initial solution adopts a real number coding method. A set of random initial solutions satisfying constraints is generated by encoding feasible solutions to the problem into antibodies in an immune clonal selection algorithm.
(3) The affinity was calculated for each individual antibody in the population. The performance of the antibodies was evaluated by calculating the affinity of the individual.
(4) The antibodies in the population are ranked according to the magnitude of affinity, and the top 50% of good individuals are selected as good individuals.
(5) And carrying out cloning, mutation and clone inhibition operations on the selected excellent individuals, and deleting and selecting to obtain the same number of filial individuals.
(6) And randomly generating new populations with the number equal to that of the original populations, calculating the affinity of the new populations, and deleting the top 50% of good offspring.
(7) Combining the immune population generated in (5) and (6) with the new population to replace the original population.
And the second step is to judge whether the obtained new population meets the termination condition of the algorithm, wherein the termination condition is that the iteration times exceed 200 times. If the termination condition is met, the optimization process is terminated, otherwise, the iterative optimization is continued. And (4) carrying out iterative calculation on the immune clone algorithm to obtain an optimized Fourier series coefficient and generate an optimized excitation track. The algorithm flow chart is shown in figure 2, and the effect chart of the artificial immunity algorithm optimization is shown in figure 3.
Third step experiment sampling, wherein the robot moves along with the excitation track, joint angles of a plurality of groups of robots are acquired by using a photoelectric encoder at different times in a plurality of periods, the joint angles obtained by the experiment are fitted into Fourier series, the differential is solved to obtain the joint angular velocity, the differential is solved to obtain the joint angular acceleration, a plurality of groups of observation matrixes are formed to be used as experiment samples, and the specific steps of deriving the observation matrixes according to the inertia matrix and the Cogowski force matrix are as follows:
w1_1=ddq1;w1_2=ddq1*sin(q2)^2+dq1*dq2*sin(2*q2);w1_3=-ddq1*sin(2*q2)-2*dq1*dq2*cos(2*q2);w1_4=ddq2*sin(q2)+dq2^2*cos(q2);w1_5=ddq2*cos(q2)-dq2^2*sin(q2);w1_6=0;w1_7=2*a2*(ddq1*cos(q2)-dq1*dq2*sin(q2));w1_8=-2*a2*(ddq1*sin(q2)-dq1*dq2*cos(q2));w1_9=-0.5*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*sin(q2+q3)*cos(q2+q3);w3_10=dq1^2*cos(2*q2+2*q3);
w3_11=ddq1*sin(q2+q3);w3_12=ddq1*cos(q2+q3);w3_13=ddq2+ddq3;
w3_14=ddq2*a3*cos(q3)+q1^2*(a2*sin(q2+q3)+a3*sin(q2+q3)*cos(q2)+dq2^2*a3*sin(q3)+g*cos(q2+q3);
w3_15=-ddq2*a3*sin(q3)+dq1^2*(a2*cos(q2+q3)+0.5*a3*(cos(q3)+cos(2*q2+q3)))+dq2^2*a3*cos(q3)-g*sin(q2+q3);
wherein q1, q2, q3 represent the angle of each joint, dq1, dq2, dq3 represent the angular velocity of each joint, ddq1, ddq2, ddq3 represent the angular acceleration of each joint, and g represents the gravitational acceleration.
And simultaneously, the feedback current of the motor is obtained, and the output torque of the motor, which is obtained according to the torque coefficient, is the joint torque.
T=K*Ia
Wherein T is joint torque, K is a current torque coefficient, and Ia is motor feedback current;
and fourthly, data processing, namely removing gross errors in the experimental data through a three-standard-deviation criterion, and processing the data acquired by the experiment through a median average filtering method to reduce the influence of data noise on the experiment.
And fifthly, estimating dynamic parameters, namely identifying the dynamic parameters through a neural network according to a plurality of groups of observation matrixes and joint moments obtained through experiments. Specifically, a plurality of groups of observation matrixes obtained through experiments are used as input of the neural network, initial weight is set to be a random value of 0-1, a plurality of groups of joint moments obtained through experiments are used as labels of output of the neural network, and theoretical joint moments are used as output of the neural network. And (3) training the model by adopting a batch gradient descent method, wherein the weight of the trained neural network is the kinetic parameter to be identified, the structure of the neural network is shown in figure 4, and the schematic diagram of the gradient descent optimization algorithm is shown in figure 5.
And sixthly, verifying parameters, namely giving an executable track different from the excitation track, enabling the robot to move along the track, collecting joint angles of a plurality of groups of robots in a plurality of periods at different moments, feeding back current by a motor, obtaining theoretical joint torque according to the solved kinetic parameters, comparing the theoretical joint torque with joint torque obtained by experiments, and evaluating the reliability of the kinetic parameters by using a torque residual root. The parameter verification flow chart is as shown in figure 6.