Disclosure of Invention
The invention aims to provide a method and a system for compensating a friction torque of a robot joint, which can realize the aim of tracking the robot joint quickly and accurately.
In order to achieve the purpose, the invention provides the following scheme:
a method of compensating for robot joint friction torque, the method comprising:
acquiring first joint angular velocity data and first friction torque data corresponding to the first joint angular velocity data in a robot starting process, wherein the starting process is a process that the robot is started to run to a rated rotating speed at a set speed increment;
performing friction model identification by using the first joint angular velocity data and the first friction torque data to obtain a friction model, wherein the input of the friction model is joint angular velocity, and the output of the friction model is joint friction torque;
establishing a neural network, wherein the input of the neural network is joint angular velocity, and the output of the neural network is joint friction torque;
acquiring second joint angular velocity data of the robot in a starting process;
inputting the second joint angular velocity data into the friction model to obtain first moment prediction data corresponding to the second joint angular velocity data;
taking the second joint angular velocity data and the first moment prediction data as training data of the neural network, and updating the weight and the bias of the neural network by using a gradient descent method to obtain a neural network prediction model;
acquiring random angular velocity data of the robot, wherein the random angular velocity data is angular velocity data when the robot runs at a random speed, and the random speed is less than or equal to twice of a rated rotating speed;
inputting the random angular velocity data into the neural network prediction model to obtain second moment prediction data;
carrying out Gaussian sampling by taking the second moment prediction data as a mean value and 1 as a variance to obtain a friction moment compensation value;
and performing friction torque compensation on the robot joint according to the friction torque compensation value.
Optionally, after performing friction torque compensation on the robot joint according to the friction torque compensation value, the method further includes:
acquiring joint tracking deviation;
judging whether the joint tracking deviation is greater than a deviation threshold value;
and if so, updating the weight and the bias of the neural network according to the joint tracking deviation to obtain an updated neural network prediction model.
Optionally, the updating the weight and the bias of the neural network according to the joint tracking deviation specifically includes:
according to the formula:
updating weights and biases of the neural network, wherein θ
newFor the updated neural network parameter set, the neural network parameter set comprises weight and bias of the neural network, theta
oldFor the neural network parameter set before updating, α is the learning rate of the neural network, Net
θIn order to be a neural network, the network is,
is the neural network parameter gradient, and e is the joint tracking deviation.
Optionally, the identifying a friction model by using the first joint angular velocity data and the first friction torque data to obtain a friction model specifically includes:
performing friction model identification by using the first joint angular velocity data and the first friction torque data to obtain a Sterbek model;
determining each parameter to be identified in the Sterbek model by adopting a nonlinear least square method to obtain each friction parameter;
and determining a friction model of the robot joint according to each friction parameter and the Sterbek model.
Optionally, the neural network includes 1 hidden layer and 10 neurons, the connection mode of the neural network is full connection, and the activation function of the neural network is a linear rectification function.
Optionally, the expression of the neural network is:
where x denotes the input of the neural network, w
ijWeight representing the neural network, b
jRepresenting the bias of the neural network, S
jInput representing a hidden layer, y
jRepresents the output of the hidden layer, net (x) represents the output of the neural network.
Optionally, the updating the weight and the bias of the neural network by using a gradient descent method specifically includes:
according to the formula:
updating weights and biases of the neural network, wherein θ
newFor the updated neural network parameter set, the neural network parameter set comprises weight and bias of the neural network, theta
oldFor the neural network parameter set before updating, α is the learning rate of the neural network, Net
θIn order to be a neural network, the network is,
is the neural network parameter gradient.
A compensation system for robot joint friction torque, the compensation system comprising:
the robot starting device comprises a first data acquisition module, a second data acquisition module and a control module, wherein the first data acquisition module is used for acquiring first joint angular velocity data and first friction torque data corresponding to the first joint angular velocity data in a robot starting process, and the starting process is a process that the robot is started at a set speed increment and runs to a rated rotating speed;
the model identification module is used for identifying a friction model by utilizing the first joint angular velocity data and the first friction torque data to obtain a friction model, wherein the input of the friction model is the joint angular velocity, and the output of the friction model is the joint friction torque;
the neural network establishing module is used for establishing a neural network, the input of the neural network is joint angular velocity, and the output of the neural network is joint friction torque;
the second data acquisition module is used for acquiring second joint angular velocity data in the starting process of the robot;
the first moment prediction module is used for inputting the second joint angular velocity data into the friction model to obtain first moment prediction data corresponding to the second joint angular velocity data;
the neural network determining module is used for taking the second joint angular velocity data and the first moment prediction data as training data of the neural network, and updating the weight and the bias of the neural network by using a gradient descent method to obtain a neural network prediction model;
the speed acquisition module is used for acquiring random angular speed data of the robot, wherein the random angular speed data is angular speed data when the robot runs at a random speed, and the random speed is less than or equal to twice of a rated rotating speed;
the second moment prediction module is used for inputting the random angular velocity data into the neural network prediction model to obtain second moment prediction data;
the Gaussian sampling module is used for carrying out Gaussian sampling by taking the second moment prediction data as a mean value and 1 as a variance to obtain a friction moment compensation value;
and the torque compensation module is used for performing friction torque compensation on the robot joint according to the friction torque compensation value.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects:
the invention provides a compensation method and a compensation system for robot joint friction torque. Inputting the second joint angular velocity data into the friction model to obtain first moment prediction data corresponding to the second joint angular velocity data; and training a neural network by using the second joint angular velocity data and the first moment prediction data, and updating the weight and the bias of the neural network by combining a gradient descent method to obtain a neural network prediction model. And inputting the random angular velocity data into a neural network prediction model to obtain second moment prediction data. And performing Gaussian sampling by taking the second moment prediction data as a mean value and 1 as a variance to obtain a friction moment compensation value. And performing friction torque compensation on the robot joint according to the friction torque compensation value. Therefore, the friction model is firstly identified to obtain the friction model. In the operation process of the industrial robot, when parameters such as joint temperature, load, lubrication, abrasion and the like are changed, the friction model is also correspondingly changed, and the problem that a feedforward compensation method based on a fixed friction model is invalid can be solved. On the basis, the friction moment generated by the identified friction model prediction is used for training the neural network, so that the training and learning process efficiency of the neural network is higher, the ideal effect can be approached more quickly, and the tracking speed and the tracking precision of the robot joint are improved. Furthermore, the friction torque feedforward compensation is carried out through Gaussian sampling, the defect that the output of the neural network does not have searchability is overcome, the neural network can be converged better, the situation that the neural network is trapped into local optimization is avoided, the tracking precision is further ensured, and the purpose of high-precision tracking can be rapidly realized even if parameters such as joint temperature, load, lubrication, abrasion and the like are changed.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a method and a system for compensating a friction torque of a robot joint, which can realize the aim of tracking the robot joint quickly and accurately.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Fig. 1 is a flowchart of a method for compensating a friction torque of a robot joint according to an embodiment of the present invention. As shown in fig. 1, a method for compensating a friction torque of a robot joint includes:
step 101: acquiring first joint angular velocity data and first friction torque data corresponding to the first joint angular velocity data in a robot starting process, wherein the starting process is a process that the robot is started to run to a rated rotating speed at a set speed increment;
step 102: and identifying a friction model by using the first joint angular velocity data and the first friction torque data to obtain a friction model, wherein the input of the friction model is the joint angular velocity, and the output of the friction model is the joint friction torque.
Wherein, step 102: carrying out friction model identification by utilizing the first joint angular velocity data and the first friction torque data to obtain a friction model, which specifically comprises the following steps:
performing friction model identification by using the first joint angular velocity data and the first friction torque data to obtain a Sterbek model;
determining each parameter to be identified in the Sterbek model by adopting a nonlinear least square method to obtain each friction parameter;
and determining a friction model of the robot joint according to each friction parameter and the Sterbek model.
Step 103: establishing a neural network, wherein the input of the neural network is joint angular velocity, and the output of the neural network is joint friction torque. The neural network comprises 1 hidden layer and 10 neurons, the connection mode of the neural network is full connection, and the activation function of the neural network is a linear rectification function. The expression of the neural network is as follows:
where x denotes the input of the neural network, w
ijWeight representing the neural network, b
jRepresenting the bias of the neural network, S
jInput representing a hidden layer, y
jRepresents the output of the hidden layer, net (x) represents the output of the neural network.
Step 104: acquiring second joint angular velocity data of the robot in a starting process;
step 105: inputting the second joint angular velocity data into the friction model to obtain first moment prediction data corresponding to the second joint angular velocity data;
step 106: and taking the second joint angular velocity data and the first moment prediction data as training data of the neural network, and updating the weight and the bias of the neural network by using a gradient descent method to obtain a neural network prediction model.
The updating of the weight and the bias of the neural network by using the gradient descent method specifically comprises the following steps:
according to the formula:
updating weights and biases of the neural network, wherein θ
newFor the updated neural network parameter set, the neural network parameter set comprises weight and bias of the neural network, theta
oldFor the neural network parameter set before updating, α is the learning rate of the neural network, Net
θIn order to be a neural network, the network is,
is the neural network parameter gradient.
Step 107: acquiring random angular velocity data of the robot, wherein the random angular velocity data is angular velocity data when the robot runs at a random speed, and the random speed is less than or equal to twice of a rated rotating speed;
step 108: inputting the random angular velocity data into the neural network prediction model to obtain second moment prediction data;
step 109: carrying out Gaussian sampling by taking the second moment prediction data as a mean value and 1 as a variance to obtain a friction moment compensation value;
step 110: and performing friction torque compensation on the robot joint according to the friction torque compensation value.
Preferably, step 110 is performed: after carrying out friction torque compensation on the robot joint according to the friction torque compensation value, the method further comprises the following steps:
step 111: acquiring joint tracking deviation;
step 112: judging whether the joint tracking deviation is greater than a deviation threshold value;
if yes, go to step 113;
step 113: and updating the weight and the bias of the neural network according to the joint tracking deviation to obtain an updated neural network prediction model.
In this embodiment, step 113: updating the weight and the bias of the neural network according to the joint tracking deviation, which specifically comprises the following steps:
according to the formula:
updating weights and biases of the neural network, wherein θ
newFor the updated neural network parameter set, the neural network parameter set comprises weight and bias of the neural network, theta
oldFor the neural network parameter set before updating, α is the learning rate of the neural network, Net
θIn order to be a neural network, the network is,
is the neural network parameter gradient, and e is the joint tracking deviation.
Fig. 2 is a block diagram of a compensation system for a robot joint friction torque according to an embodiment of the present invention. As shown in fig. 2, a compensation system for a robot joint friction torque includes:
the first data acquisition module 201 is configured to acquire first joint angular velocity data of a robot in a starting process and first friction torque data corresponding to the first joint angular velocity data, where the starting process is a process in which the robot is started at a set speed increment and runs to a rated rotation speed;
the model identification module 202 is configured to perform friction model identification by using the first joint angular velocity data and the first friction torque data to obtain a friction model, where an input of the friction model is a joint angular velocity, and an output of the friction model is a joint friction torque;
the neural network establishing module 203 is used for establishing a neural network, the input of the neural network is joint angular velocity, and the output of the neural network is joint friction torque;
the second data acquisition module 204 is used for acquiring second joint angular velocity data of the robot in the starting process;
the first moment prediction module 205 is configured to input the second joint angular velocity data into the friction model, and obtain first moment prediction data corresponding to the second joint angular velocity data;
the neural network determining module 206 is configured to use the second joint angular velocity data and the first moment prediction data as training data of the neural network, and update a weight and a bias of the neural network by using a gradient descent method to obtain a neural network prediction model;
a speed obtaining module 207, configured to obtain random angular velocity data of the robot, where the random angular velocity data is angular velocity data of the robot when the robot runs at a random speed, and the random speed is less than or equal to twice a rated rotation speed;
a second moment prediction module 208, configured to input the random angular velocity data into the neural network prediction model to obtain second moment prediction data;
a gaussian sampling module 209, configured to perform gaussian sampling with the second moment prediction data as a mean and 1 as a variance to obtain a friction moment compensation value;
and the torque compensation module 210 is configured to perform friction torque compensation on the robot joint according to the friction torque compensation value.
The implementation process of the robot joint friction torque compensation system provided by the invention is as follows:
(1) the joint motion trajectory is designed to start from zero speed and start the joint motion at a speed increment of 30 revolutions per minute until the rated speed is reached.
(2) In the joint operation process, joint angular velocity data and joint torque data are collected every 2ms to obtain first joint angular velocity data and first friction torque data corresponding to the first joint angular velocity data.
(3) Performing model identification by using the first joint angular velocity data and the first friction torque data to obtain a friction model formula of a Stribeck curve (Stribeck) as follows:
wherein f (v) is friction torque, v is joint angular velocity, fcIs the Coulomb friction torque, fsIs maximum static friction moment, vsIs the Stribeck friction velocity, delta is the empirical coefficient, fvIs the coefficient of viscous friction.
Wherein the parameter to be identified is (f)c,fs,vs,δ,fv) In this embodiment, the identification model is established by a nonlinear least square method, and the formula is as follows:
in the formula (f)i(v) Calculated friction torque, y, for the Stribeck friction modeliThe method is characterized in that the method is used for acquiring the actual friction torque of the joint, namely first friction torque data, and n is the number of data samples, namely the number of the first friction torque data.
And then solving the parameter to be identified by adopting a gradient descent method. First, arbitrarily given a set of initial solutions (f)c,fs,vs,δ,fv) When the least square error is reduced to be within the threshold range of the least square error, the Stribeck friction model parameter (f) can be obtainedc、fs、vs、δ、fv) To obtain the Sribeck friction model. In this embodiment, the least square error threshold is less than or equal to 0.0001, and the step range of the update solution is: 0.001 to 0.1.
(4) A neural network is established, the network input is joint angular velocity, the network output is joint friction torque, the neural network has a hidden layer and comprises 10 neurons, the connection mode is full connection, and the activation function is a linear rectification function (ReLU). The neural network formula is as follows:
where x denotes the input of the neural network, w
ijWeight representing the neural network, b
jRepresenting the bias of the neural network, S
jInput representing a hidden layer, y
jRepresents the output of the hidden layer, net (x) represents the output of the neural network.
(5) 3000 data points are uniformly sampled between zero speed and rated rotating speed, and friction torque corresponding to each rotating speed is calculated through a Stribeck model obtained through identification. And then, taking the rotating speed and the friction torque as training data of the neural network, training the neural network by using a gradient descent method, and updating parameters. If the neural network parameter set is θ, the parameter update formula is:
wherein, theta
newFor the updated neural network parameter set, the neural network parameter set comprises weight and bias of the neural network, theta
oldFor the neural network parameter set before updating, α is the learning rate of the neural network, Net
θIn order to be a neural network, the network is,
is the neural network parameter gradient.
(6) The joint running track is designed, the control period is 2 milliseconds, and the reciprocating motion is carried out at random speed within the range from zero speed to twice of rated rotating speed.
(7) And in the operation process, collecting the angular velocity in real time as the input of the neural network, and calculating to obtain the network output, namely the joint friction torque through the neural network established in the step 5. Then, taking the joint friction torque as a mean value and 1 as a variance, and performing Gaussian sampling, wherein the Gaussian sampling formula is as follows:
U1,U2=r and(0,1)
wherein U1 and U2 are (0, 1)]Two consistent random numbers in the interval, Z is a normal value, m is a mean value, and delta2Is variance, x is Gaussian sampling result, friction torque compensation value.
After the joint friction torque feedforward compensation value is obtained through calculation of the formula, the compensation value is output to a joint feedforward channel, and joint tracking deviation is collected in the next control period.
(8) In the operation process of the step 7, the joint angular velocity, the joint friction torque feedforward compensation value and the joint tracking error are collected once every 2 milliseconds and are stored in a database as a group of training data.
(9) Sampling in a database, training a neural network, and updating the weight and the bias of the neural network according to the joint tracking deviation by adopting the following formula:
wherein, theta
newFor the updated neural network parameter set, the neural network parameter set comprises weight and bias of the neural network, theta
oldFor the neural network parameter set before updating, α is the learning rate of the neural network, Net
θIn order to be a neural network, the network is,
is the neural network parameter gradient, and e is the joint tracking deviation.
(10) And 7, repeating the step 7 to the step 9 to enable the friction compensation of the joints of the robot to reach an ideal state, namely the joint tracking deviation is less than or equal to the deviation threshold set by the user.
Therefore, the invention firstly identifies the Stribeck friction model, and utilizes the identified Stribeck friction model to generate the training data of the neural network to train the neural network, which is equivalent to adding expert knowledge, so that the training and learning process of the neural network is more efficient and approaches to the ideal effect more quickly.
The output of the neural network is a fixed value, and the friction torque feedforward compensation is carried out through Gaussian sampling, so that the defect that the output of the neural network does not have searchability is overcome, the neural network can better converge, and the phenomenon of falling into local optimum is avoided.
Meanwhile, the updating direction of the neural network parameters is corrected by the absolute value of the joint tracking deviation, so that the training can always be carried out towards the favorable direction.
Therefore, the friction torque compensation method based on the neural network and the Gaussian sampling can correct and adjust network parameters in real time in the operation process of the industrial robot, and can quickly adjust the network parameters to a new ideal compensation state even if parameters such as joint temperature, load, lubrication, abrasion and the like change, so that the robot joint is ensured to have higher tracking accuracy.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.