A rehabilitation robot control method, device and rehabilitation robot
By updating the training data set in real time and constructing a neural network model based on Euler-Lagrange dynamics, the problems of low versatility and accuracy in the training and control of rehabilitation robots were solved, achieving online training and predictive effects that conform to physical laws.
Patent Information
- Application Number
- CN202111371350.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-18
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2041-11-18
AI Technical Summary
In the training and control of existing rehabilitation robots, the neural network models trained offline have poor generality, low prediction accuracy, and cannot adapt to changes in data distribution and physical laws in actual work.
By acquiring real-time motion data of the joints to be trained during training, updating the training data set, and constructing a neural network model based on the Euler-Lagrange dynamics equations for online training, the general applicability and prediction accuracy of the model are improved.
Online updates of the neural network model were achieved, improving versatility and accuracy of predictions, ensuring that prediction results conform to physical laws, and enhancing the control accuracy and reliability of the rehabilitation robot.
Smart Images

Figure CN114028164B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of robot control, and in particular to a rehabilitation robot control method and device, and a rehabilitation robot. Background Art
[0002] Current rehabilitation robots usually set a target position during rehabilitation training and assist the part to be trained to reach the set target position. With the development of deep learning technology, more and more rehabilitation robots use deep learning to solve the training and control problems of rehabilitation robots. Currently, commonly used rehabilitation robots usually perform offline training on the neural network model based on historical data during training and control, and then perform training and control based on the neural network model obtained through offline training. However, the neural network model obtained through offline training has poor versatility and the accuracy of the predicted value obtained is low. Summary of the invention
[0003] In view of this, an object of the present invention is to provide a rehabilitation robot control method, device and rehabilitation robot, which can improve the versatility of the neural network model and enhance the accuracy of the predicted value of the neural network model.
[0004] In order to achieve the above purpose, the technical solution adopted by the embodiment of the present invention is as follows:
[0005] In a first aspect, an embodiment of the present invention provides a rehabilitation robot control method, comprising: step S102, inputting a training target into a trained neural network model for torque prediction to obtain a torque prediction value of a joint to be trained; step S104, controlling the joint to be trained to move according to the training target based on the torque prediction value; step S106, acquiring and storing actual motion data generated by the joint to be trained, and updating the training data group based on the actual motion data; step S108, updating and training the neural network model based on the updated training data group, and returning the updated trained neural network model as the new trained neural network model to step S102.
[0006] Further, an embodiment of the present invention provides a first possible implementation manner of the first aspect, wherein the step of updating the training data group based on the actual motion data includes: determining whether the stored actual motion data reaches a preset number, and if the actual motion data reaches a preset number, determining that the actual motion data satisfies a preset condition; wherein the actual motion data includes the actual angle, actual angular velocity, actual angular acceleration and actual torque of the joint to be trained; calculating the sample distance between each sample data in each data group in the training data group and the actual motion data, replacing the target data group with the largest sample distance to the actual motion data with the actual motion data, to obtain an updated training data group; wherein the number of sample data included in the target data group is the same as the number of the actual motion data.
[0007] Furthermore, an embodiment of the present invention provides a second possible implementation of the first aspect, wherein the step of updating and training the neural network model based on the updated training data group includes: randomly selecting multiple data groups from the updated training data group as training samples and inputting them into the neural network model, so that the neural network model predicts the torque based on the angle, angular velocity and angular acceleration of the joint to be trained in the training sample, and performs gradient back propagation to update the weights based on the error between the predicted torque and the actual torque in the training sample.
[0008] Furthermore, an embodiment of the present invention provides a third possible implementation of the first aspect, wherein the neural network model is constructed based on the Euler Lagrange dynamics equation, and the neural network model includes a feedforward network, a first network, a second network, a third network and a prediction network, and the output end of the feedforward network is respectively connected to the input end of the first network, the second network and the third network, and the output ends of the first network, the second network and the third network are all connected to the prediction network.
[0009] Furthermore, an embodiment of the present invention provides a fourth possible implementation of the first aspect, wherein the training target includes a target angle, a target angular velocity and a target angular acceleration of the joint to be trained; the step of inputting the training target into the trained neural network model for torque prediction to obtain a torque prediction value of the joint to be trained includes: inputting the target angle into the feedforward network, and inputting the target angular velocity and the target angular acceleration into the prediction network, so that the prediction network calculates and outputs the torque prediction value based on the gravity torque vector output by the first network, the diagonal elements output by the second network, the lower diagonal elements output by the third network, the target angular velocity and the target angular acceleration.
[0010] Further, an embodiment of the present invention provides a fifth possible implementation of the first aspect, wherein the calculation formula of the torque prediction value is:
[0011]
[0012] Among them, τ p is the torque prediction value, g(q) is the gravity torque vector, q is the angle of the joint to be trained, is the angular velocity of the joint to be trained, is the angular acceleration of the joint to be trained, M(q)=L(q) T L(q), L(q) is a lower triangular matrix, and the lower triangular matrix is obtained by combining the diagonal elements and the lower diagonal elements, is the Cossette moment,
[0013] Furthermore, an embodiment of the present invention provides a sixth possible implementation of the first aspect, wherein the rehabilitation robot control method also includes: if the actual motion data does not reach the preset number, returning to repeatedly execute steps S102 to S104 until the actual motion data meets the preset conditions.
[0014] In a second aspect, an embodiment of the present invention further provides a rehabilitation robot control device, comprising: a use module, used to input the training target into the trained neural network model for torque prediction, and obtain the torque prediction value of the joint to be trained; a control module, used to control the joint to be trained to move according to the training target based on the torque prediction value; a data processing module, used to acquire and store the actual motion data generated by the joint to be trained, and update the training data group based on the actual motion data; a training module, used to update the neural network model based on the updated training data group, and transmit the updated trained neural network model as the new trained neural network model to the use module.
[0015] In a third aspect, an embodiment of the present invention provides a rehabilitation robot, comprising: a processor and a storage device; a computer program is stored on the storage device, and when the computer program is run by the processor, it executes the method as described in any one of the first aspects.
[0016] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in any one of the above-mentioned first aspects are executed.
[0017] The embodiment of the present invention provides a rehabilitation robot control method, device and rehabilitation robot, and the rehabilitation robot control method includes: step S102, inputting the training target into the trained neural network model to perform torque prediction, and obtaining the torque prediction value of the joint to be trained; step S104, controlling the joint to be trained to move according to the training target based on the torque prediction value; step S106, acquiring and storing the actual motion data generated by the joint to be trained, and updating the training data group based on the actual motion data; step S108, updating and training the neural network model based on the updated training data group, and returning the updated trained neural network model as a new trained neural network model to step S102. The rehabilitation robot control method provided in this embodiment improves the versatility of the neural network model and the accuracy of the predicted value of the neural network model by updating the training data group based on the actual motion data of the joint to be trained during the training control of the joint to be trained based on the neural network model, and performing online training on the neural network model based on the updated training data group.
[0018] Other features and advantages of the embodiments of the present invention will be described in the following description, or some features and advantages can be inferred or determined without doubt from the description, or can be learned by implementing the above-mentioned techniques of the embodiments of the present invention.
[0019] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 A flow chart of a rehabilitation robot control method provided by an embodiment of the present invention is shown;
[0022] Figure 2 A schematic diagram of updating a training data set provided by an embodiment of the present invention is shown;
[0023] Figure 3 A flowchart of using a neural network model provided by an embodiment of the present invention is shown;
[0024] Figure 4 A neural network model torque prediction principle diagram provided by an embodiment of the present invention is shown;
[0025] Figure 5 A neural network model training flow chart provided by an embodiment of the present invention is shown;
[0026] Figure 6 A control flow chart of a rehabilitation robot provided by an embodiment of the present invention is shown;
[0027] Figure 7 A schematic structural diagram of a rehabilitation robot control device provided by an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0028] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be described below in conjunction with the drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments.
[0029] There are two famous problems in robot dynamics control, the direct problem and the inverse problem. The direct problem is to predict the final position, momentum and acceleration of the robot arm given the driving force of the motors at each joint of the robot; the inverse problem is how to distribute the driving force of the motors at each joint of the robot in order to move the robot arm to a specified position with a specified momentum or acceleration. At present, the commonly used treatment plan for upper limb rehabilitation robots is to set a target position and require the patient's limbs to reach the target position with the assistance of the robot, which is the inverse problem of the robot. With the development of deep learning technology, more and more rehabilitation robots choose to use deep learning (neural networks) to solve control problems. The current common practice is to first use historical data to train a neural network model offline, and then use this pre-trained fixed neural network for training and control. This control method has the following problems:
[0030] (1) The offline learned neural network model cannot fully characterize the characteristics of the robot system, resulting in insufficient versatility. The offline data set is limited, while the robot will continuously generate new data during actual work, and the offline trained model cannot predict these new data; the offline model assumes that the data distribution is fixed or stable, and the training samples are independent and identically distributed, but when the robot is actually working, the data distribution may change continuously due to changes in working conditions, and the distribution of training data is interrelated and non-stationary.
[0031] (2) Due to the randomness of neural networks, the use of traditional neural network models is prone to obtaining results that do not satisfy physical laws (momentum conservation, energy conservation, etc.). Even if the training data satisfies all physical laws, the trained neural network model may still make non-physical predictions, reducing the control accuracy of the rehabilitation robot.
[0032] To improve the above problems, the embodiments of the present invention provide a rehabilitation robot control method, device and rehabilitation robot, which can be applied to improve the versatility of the neural network model and the accuracy of the predicted value of the neural network model. The embodiments of the present invention are described in detail below.
[0033] This embodiment provides a control method for a rehabilitation robot, which can be applied to a controller of a rehabilitation robot. Figure 1 The control method flow chart of the rehabilitation robot shown in the figure mainly includes the following steps S102 to S106:
[0034] Step S102, inputting the training target into the trained neural network model to perform torque prediction, and obtaining the torque prediction value of the joint to be trained.
[0035] The training targets include the target angle, target angular velocity and target angular acceleration of each joint to be trained. The trained neural network model is stored in the use module, and the trained neural network model includes the neural network model obtained by the first training based on the historical training data set and the neural network model obtained by the updated training.
[0036] The above rehabilitation robot may be an upper limb rehabilitation robot, and the above training target may be input by a user, or may be obtained through inverse kinematics calculation based on the target position of the upper limb end input by the user and the current position. When the training target is received, the target values of the angle, angular velocity and angular acceleration vector of the n joints to be trained of the rehabilitation robot (recorded as target angle, target angular velocity and target angular acceleration) are calculated. As the training target, the neural network model is input into the trained neural network model, and the neural network model outputs the torque prediction value τ of n joints to be trained. p .because and Can be obtained by d Therefore, in practical applications, only the target angle q of the joint to be trained needs to be given. d .
[0037] Step S104, controlling the joint to be trained to move according to the training target based on the torque prediction value.
[0038] When the neural network model obtains the torque prediction value based on the training target, it sends a torque instruction to each joint to be trained based on the torque prediction value, applies torque to the joint to be trained, so that the joint to be trained can perform rehabilitation training according to the training target and generate actual motion data.
[0039] Step S106, acquiring and storing actual motion data generated by the joint to be trained, and updating the training data set based on the actual motion data.
[0040] The actual motion data generated by the joint to be trained each time is stored, and the training data set is updated based on the new actual motion data generated. In a feasible implementation, the training data set is updated in real time based on the actual motion data generated by the joint to be trained, so as to retrain the neural network model. That is, each time a It is replaced by the historical motion data in the training data set that was generated earliest or is farthest away from its sample.
[0041] In another feasible implementation, it is possible to determine whether the stored actual motion data meets a preset condition, and when the stored actual motion data meets the preset condition, the training data set is updated based on the stored actual motion data. The preset condition may be that the actual motion data meets a certain data volume requirement or is data generated within a preset time period.
[0042] In practical applications, the above training data set can be stored in a data processing module, such as a training data set including P groups of joints to be trained (each group has A data, each data is ) historical motion data. When the actual motion data generated by the joint to be trained reaches a set A, the data processing module replaces any one of the P sets of historical motion data in the training data set with the actual motion data.
[0043] Step S108, updating and training the neural network model based on the updated training data set, and returning the updated trained neural network model as a new trained neural network model to step S102.
[0044] The data processing module sends the updated training data group to the training module to retrain the neural network model, and the training module sends the retrained neural network model to the use module (that is, the retrained neural network model is sent to the use module as the new trained neural network model in step S102). When the rehabilitation robot receives a new training task, it returns to execute the above step S102 and performs torque prediction based on the retrained neural network model until the training is completed.
[0045] In practical applications, the torque prediction based on the neural network model in the above step S102 and the retraining of the neural network model in the above step S108 can be executed in parallel based on different processors to achieve online updating of the neural network model.
[0046] The above-mentioned rehabilitation robot control method provided in this embodiment improves the versatility of the neural network model and the accuracy of the predicted value of the neural network model by updating the training data group based on the actual motion data of the joint to be trained during the training control of the joint to be trained based on the neural network model, and online training the neural network model based on the updated training data group.
[0047] In a feasible implementation manner, this embodiment provides an implementation manner of determining whether the stored actual motion data meets a preset condition, and if so, updating the training data set based on the actual motion data, which can be specifically performed with reference to the following steps (1) to (2):
[0048] Step (1): Determine whether the stored actual motion data reaches a preset amount. If the actual motion data reaches the preset amount, determine that the actual motion data meets a preset condition.
[0049] The actual motion data include the actual angle, actual angular velocity, actual angular acceleration and actual torque of the joint to be trained. When the number of stored actual motion data is the same as the number of data in each data group in the training data group (the number of stored actual motion data reaches A), it is determined that the actual motion data meets the preset condition.
[0050] Step (2): Calculate the sample distance between each sample data in each data group in the training data group and the actual motion data, replace the target data group with the largest sample distance to the actual motion data with the actual motion data, and obtain an updated training data group.
[0051] The number of sample data included in the target data set is the same as the number of actual motion data. The data processing module stores a training data set, which includes P groups of historical motion data, and reads and stores the actual motion data generated by the actual motion of the rehabilitation robot in real time. When the actual motion data reaches A ( The newly generated actual motion data replaces the data set with the largest sample distance from the actual motion data in the training data set.
[0052] The above sample distance can be expressed using the norm, and the algorithm pseudo code is as follows:
[0053] max=0;
[0054] index=0;
[0055] for i=1:P
[0056]
[0057] ifd(i)>max
[0058] max=d(i);
[0059] index = i;
[0060] end
[0061] end
[0062] return index
[0063] Each sample data in the above training data set is a pair of n-dimensional vectors measured at the same sampling time q is usually measured by the encoders of each joint of the robot. It is obtained by differentiating q, and τ is measured by the torque sensors of each joint or converted by the current values of each joint. α1, α2, α3, and α4 are the weights of the angle, angular velocity, angular acceleration, and torque of the joint to be trained. The data processing module uses a linked list to store the training data set. When data replacement occurs, the replacement can be completed quickly by simply modifying the linked list pointer.
[0064] In a feasible implementation, if the actual motion data does not meet the above preset conditions, return to repeatedly execute steps S102 to S104 so that the trained neural network model continues to perform torque prediction and controls the training joint to move according to the training target to generate new actual motion data until the actual motion data meets the above preset conditions, that is, the actual motion data reaches the preset number, and the training data group is updated to retrain the neural network model.
[0065] See Figure 2 The training data set update diagram shown in Figure 1 is Figure 2 The sample K in is the data group to be replaced in the training data group. When replacing, you only need to disconnect the link between sample K and the previous node K-1 and the next node K+1, and then the previous node K-1 points to the new sample (that is, the actual motion data), and the new sample points to the K+1 sample to complete the replacement and obtain the updated training data group. The updated training data group is sent to the training module. Each time a replacement is completed, the training module is retrained. Therefore, the frequency of neural network model training can be adjusted by setting the number of samples A in each data in the training data group.
[0066] In a feasible implementation, the above-mentioned neural network model is constructed based on the Euler Lagrangian dynamics equation, and the neural network model includes a feedforward network, a first network, a second network, a third network and a prediction network. The output end of the feedforward network is respectively connected to the input end of the first network, the second network and the third network, and the output ends of the first network, the second network and the third network are all connected to the prediction network.
[0067] See Figure 3The neural network model shown in the flowchart uses the feedforward network 30, which includes an input layer (dimension n×m), a LeakyReLu layer 1, a fully connected layer 1 (dimension m×m), a LeakyReLu layer 2, a fully connected layer 2 (dimension m×m) and a LeakyReLu layer 3; the first network 31 (also referred to as the g network) includes a fully connected layer 3 (dimension m×n), the second network 32 (also referred to as the Ld network) includes a fully connected layer 4 (dimension m×n) and a SoftPlus layer, and the third network 33 (also referred to as the Lo network) includes a fully connected layer 5 (dimension ); The above prediction network includes a torque prediction model constructed based on the Euler-Lagrangian dynamics equation.
[0068] like Figure 3 As shown, the angles of the n joints to be trained of the rehabilitation robot (dimension n×1) are input into the feedforward network 30, and sequentially pass through the input layer (dimension n×m), LeakyReLu layer 1, fully connected layer 1 (dimension m×m), LeakyReLu layer 2, fully connected layer 2 (dimension m×m), LeakyReLu layer 3, and the output m×1-dimensional intermediate vectors enter the first network, the second network, and the third network (i.e., the g network, the Ld network, and the Lo network) respectively. The first network only includes the fully connected layer 3 (dimension m×n), and outputs the gravity moment term g(q); the second network includes the fully connected layer 4 (dimension m×n) and the SoftPlus layer, and outputs the diagonal element L d (q), select SoftPlus as the activation function to ensure the output L d Each term of (q) is greater than zero; the third network contains only fully connected layer 5 (dimension ), output the lower diagonal element L o (q).
[0069] In a feasible implementation, this embodiment provides a specific implementation method of inputting the training target into the trained neural network model for torque prediction to obtain the torque prediction value of the joint to be trained: the target angle of the training target is input into the feedforward network, and the target angular velocity and target angular acceleration are input into the prediction network, so that the prediction network calculates and outputs the torque prediction value based on the gravity torque vector output by the first network, the diagonal elements output by the second network, the lower diagonal elements output by the third network, the target angular velocity and the target angular acceleration.
[0070] When predicting the torque of the training target based on the trained neural network model, see Figure 4 The neural network model torque prediction principle diagram shown in the figure is used to calculate the target angle q of the joint to be trained in the training target. d Input into the feedforward network, so that the first network outputs the gravity moment vector g(q d) to the prediction network, the second network outputs the diagonal element L d (q) to the prediction network, where the diagonal elements L d (q) has n; the third network outputs the lower diagonal element L o (q) to the prediction network, the lower diagonal element L o (q) Yes The prediction network will diagonal elements L d (q) and the lower diagonal element L o (q) is merged to obtain the lower triangular matrix L(q)(L(q)∈R n×n is a lower triangular matrix), the inertia matrix M(q) is a positive definite symmetric matrix, so the Cholesky decomposition can be used to construct the inertia matrix M(q) = L(q) T L(q), this construction method can ensure that the obtained inertia matrix satisfies the positive definite symmetry property (that is, the mass can only be greater than zero, but cannot be less than or equal to zero), but the current traditional neural network structure cannot guarantee this property.
[0071] M(q) and the angular acceleration of the joint to be trained Multiply them together to get the inertia moment, and use Calculate the Koch moment and convert the inertia moment Cosmetic moment The predicted value τ of the joint output torque vector can be obtained by adding the three terms of g(q) and gravitational torque term p .
[0072] The calculation formula for the above torque prediction value is:
[0073]
[0074] Among them, τ p is the torque prediction value, g(q) is the gravity torque vector, q is the angle of the joint to be trained, is the angular velocity of the joint to be trained, is the angular acceleration of the joint to be trained, M(q)=L(q) T L(q), L(q) is a lower triangular matrix, and the lower triangular matrix is obtained by combining the diagonal elements and the lower diagonal elements. is the Cossette moment, * T Represents the transpose of a matrix or vector*.
[0075] The target angle q of the training target d , target angular velocity and the target angular acceleration Enter the above torque prediction value into the calculation formula to get the torque prediction value The above target angle q d , target angular velocity and the target angular acceleration All are vectors.
[0076] In a feasible implementation, this embodiment provides a specific implementation method for updating and training the neural network model based on the updated training data group: multiple data groups are randomly selected from the updated training data group as training samples and input into the neural network model, so that the neural network model predicts the torque based on the angle, angular velocity and angular acceleration of the joint to be trained in the training sample, and performs gradient back propagation to update the weight based on the error between the predicted torque and the actual torque in the training sample.
[0077] The training module randomly samples Q data from the P*A data in the updated training data group as training samples and inputs them into the neural network model to retrain the neural network model. In a feasible implementation, the above Q data may include a certain proportion of new actual motion data.
[0078] See Figure 5 The neural network model training flowchart shown in the figure is to train the samples Input into the neural network model, where Respectively represent the angle, angular velocity and angular acceleration vector of the n joints to be trained of the rehabilitation robot, τ∈R n Represents n joints to be trained The actual value of the corresponding historical output torque vector, such as Figure 5 As shown, the joint angle q to be trained is input into the feedforward neural network, and the gravity moment g(q), the diagonal element L are output respectively through the first network, the second network and the third network. d (q) and the lower diagonal element L o (q), L d (q) and L o (q) is merged to obtain the lower triangular matrix L(q), and then M(q) = L(q) T L(q) calculates M(q), and M(q) is combined with the joint angular acceleration Multiply them together to get the inertia moment, and use Calculate the Koch moment and convert the inertia moment Cosmetic moment The addition of the three terms, g(q), can give the predicted value τ of the joint output torque vector: p , Finally, the torque prediction value τ p The mean square error of the actual value τ of the historical output torque vector of the joint to be trained in the training sample Perform gradient backpropagation to update the weights of the neural network model.
[0079] The above-mentioned rehabilitation robot control method provided in this embodiment obtains and processes the actual motion data generated by the joints to be trained, so that the training and use of the neural network are executed in parallel, thereby improving the control speed of the rehabilitation robot, realizing the online update of the neural network model, and improving the versatility of the neural network model. The structure of the neural network is constructed based on the Euler Lagrangian dynamics equation to ensure that the prediction results conform to the laws of physics, thereby improving the control accuracy and reliability of the rehabilitation robot.
[0080] Based on the above embodiment, this embodiment provides an example of applying the above rehabilitation robot control method to train and control a rehabilitation robot (such as an upper limb rehabilitation exoskeleton robot Wisebot X5), which can be specifically performed with reference to the following steps 1 to 6:
[0081] Step 1: Load P groups (A in each group) of historical data Go to the data processing module, load the pre-trained neural network model to the use module, and give the rehabilitation training goal
[0082] See Figure 6 The control flow chart of the rehabilitation robot shown in the figure combines the pre-trained neural network model and the rehabilitation training target Load it into the usage model so that the usage model can predict the torque based on the neural network model. The training module is a group of graphics processors (GPU A), and the usage module is another group of graphics processors (GPU B). The neural network is trained on GPU A and used on GPU B. GPU A and GPU B can be executed in parallel to realize the online update of the neural network.
[0083] Step 2: Use the module to read the rehabilitation training goals Input into the neural network model, and output the torque prediction value τ of each joint to be trained through the neural network model P , and sent to each joint to be trained.
[0084] Step 3: Each joint to be trained receives the torque command τ P , apply torque to the joint to be trained, so that the joint to be trained can perform rehabilitation training according to the target and generate actual motion data
[0085] Step 4: Actual motion data sample When one group A is full, the data processing module replaces one of the P groups of historical motion data in the training data group and sends the new P groups of historical operation data to the training module.
[0086] The data processing module processes the continuously input data stream (actual motion data generated by the joints to be trained) based on experience replay. Experience replay refers to the mixed use of new data and old data when training the neural network model. A part of the new data representing the latest state of the robot will be used for model training, while a part of the representative old data will be retained and used for model training. The training data group is divided into groups. The data processing module stores P groups of data, each of which contains A (a historical motion data consists of the angle, angular velocity, angular acceleration and joint torque of the joint to be trained), and saves the training data group in a linked list.
[0087] Step 5: The training module randomly samples Q pieces from the new P*A historical motion data as training samples to retrain the neural network model. After the update training is completed, the new neural network model is sent to the use module for use.
[0088] During training, the neural network model randomly samples Q data from the P*A data stored in the data processing module as training samples, and divides the training samples into training set, validation set and test set. The neural network model inputs the actual values of the angle, angular velocity, angular acceleration and torque vector of the n joints to be trained of the rehabilitation robot. Output the torque vector prediction value τ of the n joints to be trained of the rehabilitation robot p , and through the predicted value τ p The mean square error with the actual value τ is back-propagated to update the weights of the neural network.
[0089] Step 6: Use the module to update the neural network model and read the next rehabilitation training target The above steps 2 to 6 are repeated until the rehabilitation training is completed.
[0090] Corresponding to the rehabilitation robot control method provided in the above embodiment, the embodiment of the present invention provides a rehabilitation robot control device, which is applied to the controller of the rehabilitation robot, see Figure 7 The schematic diagram of the structure of a rehabilitation robot control device is shown in FIG. 1 , and the device includes the following modules:
[0091] Using module 71, for inputting the training target into the trained neural network model to perform torque prediction, and obtaining the torque prediction value of the joint to be trained;
[0092] A control module 72, for controlling the joint to be trained to move according to the training target based on the torque prediction value;
[0093] A data processing module 73 is used to obtain and store actual motion data generated by the joint to be trained, and update the training data set based on the actual motion data;
[0094] The training module 74 is used to update the training of the neural network model based on the updated training data set, and transmit the updated trained neural network model as a new trained neural network model to the use module.
[0095] The above-mentioned rehabilitation robot control device provided in this embodiment improves the versatility of the neural network model and the accuracy of the predicted value of the neural network model by updating the training data group based on the actual motion data of the joint to be trained during the training control of the joint to be trained based on the neural network model, and online training the neural network model based on the updated training data group.
[0096] In one embodiment, the above-mentioned data processing module 73 is further used to determine whether the stored actual motion data reaches a preset number. If the actual motion data reaches the preset number, it is determined that the actual motion data meets the preset conditions; wherein the actual motion data includes the actual angle, actual angular velocity, actual angular acceleration and actual torque of the joint to be trained; the sample distance between each sample data in each data group in the training data group and the actual motion data is calculated, and the target data group with the largest sample distance to the actual motion data is replaced with the actual motion data to obtain an updated training data group; wherein the number of sample data included in the target data group is the same as the number of actual motion data.
[0097] In one embodiment, the training module 74 is further used to randomly select multiple data groups from the updated training data group as training samples and input them into the neural network model, so that the neural network model predicts the torque based on the angle, angular velocity and angular acceleration of the joint to be trained in the training sample, and performs gradient back propagation to update the weight based on the error between the predicted torque and the actual torque in the training sample.
[0098] In one embodiment, the above-mentioned neural network model is constructed based on the Euler Lagrangian dynamics equation, and the neural network model includes a feedforward network, a first network, a second network, a third network and a prediction network. The output end of the feedforward network is respectively connected to the input end of the first network, the second network and the third network, and the output ends of the first network, the second network and the third network are all connected to the prediction network.
[0099] In one embodiment, the above-mentioned training target includes the target angle, target angular velocity and target angular acceleration of the joint to be trained; the above-mentioned usage module 71 is further used to input the target angle into the feedforward network, and input the target angular velocity and target angular acceleration into the prediction network, so that the prediction network calculates and outputs the torque prediction value based on the gravity torque vector output by the first network, the diagonal elements output by the second network, the lower diagonal elements output by the third network, the target angular velocity and the target angular acceleration.
[0100] In one embodiment, the calculation formula of the torque prediction value is:
[0101]
[0102] Among them, τ p is the torque prediction value, g(q) is the gravity torque vector, q is the angle of the joint to be trained, is the angular velocity of the joint to be trained, is the angular acceleration of the joint to be trained, M(q)=L(q) T L(q), L(q) is a lower triangular matrix, which is obtained by combining the diagonal elements and the subdiagonal elements. is the Cossette moment,
[0103] In one embodiment, the data processing module 73 is further used to return to the use module and the data processing module when the actual motion data does not reach a preset amount until the actual motion data meets a preset condition.
[0104] The above-mentioned rehabilitation robot control device provided in this embodiment obtains and processes the actual motion data generated by the joints to be trained, so that the training and use of the neural network are executed in parallel, thereby improving the control speed of the rehabilitation robot, realizing the online update of the neural network model, and improving the versatility of the neural network model. The structure of the neural network is constructed based on the Euler Lagrangian dynamics equation to ensure that the prediction results conform to the laws of physics, thereby improving the control accuracy and reliability of the rehabilitation robot.
[0105] The implementation principle and technical effects of the device provided in this embodiment are the same as those of the aforementioned embodiments. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0106] Corresponding to the methods and devices provided in the aforementioned embodiments, an embodiment of the present invention further provides a rehabilitation robot, which includes: an upper limb exoskeleton mechanical arm and a controller, the controller including a processor and a storage device; a computer program is stored on the storage device, and when the computer program is run by the processor, it executes the rehabilitation robot control method provided in the aforementioned embodiment.
[0107] An embodiment of the present invention provides a computer-readable medium, wherein the computer-readable medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method described in the above embodiment.
[0108] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system described above can refer to the corresponding process in the aforementioned embodiment, and will not be repeated here.
[0109] The rehabilitation robot control method, device and computer program product of the rehabilitation robot provided in the embodiments of the present invention include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments and will not be repeated here.
[0110] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.
[0111] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.
[0112] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0113] Finally, it should be noted that the above-described embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A rehabilitation robot control method, characterized in that: include: Step S102, inputting the training target into the trained neural network model to perform torque prediction, and obtaining the torque prediction value of the joint to be trained; wherein the training target includes the target angle, target angular velocity and target angular acceleration of the joint to be trained; Step S104, controlling the joint to be trained to move according to the training target based on the torque prediction value; Step S106, acquiring and storing the actual motion data generated by the joint to be trained, and updating the training data group based on the actual motion data; wherein, the step of updating the training data group based on the actual motion data includes: judging whether the stored actual motion data reaches a preset number, and if the actual motion data reaches the preset number, determining that the actual motion data meets a preset condition; wherein, the actual motion data includes the actual angle, actual angular velocity, actual angular acceleration and actual torque of the joint to be trained; calculating the sample distance between each sample data in each data group in the training data group and the actual motion data, replacing the target data group with the largest sample distance from the actual motion data with the actual motion data, and obtaining an updated training data group; wherein, the number of sample data included in the target data group is the same as the number of the actual motion data; if the actual motion data does not reach the preset number, returning to repeatedly execute steps S102 to S104 until the actual motion data meets the preset condition; Step S108, updating and training the neural network model based on the updated training data set, and returning the updated trained neural network model as the new trained neural network model to step S102.
2. The method according to claim 1, characterized in that The step of updating and training the neural network model based on the updated training data set includes: Multiple data groups are randomly selected from the updated training data group as training samples and input into the neural network model, so that the neural network model predicts the torque based on the angle, angular velocity and angular acceleration of the joint to be trained in the training sample, and performs gradient back propagation to update the weight based on the error between the predicted torque and the actual torque in the training sample.
3. The method according to claim 1, characterized in that: The neural network model is constructed based on the Euler-Lagrangian dynamics equations. The neural network model includes a feedforward network, a first network, a second network, a third network and a prediction network. The output end of the feedforward network is respectively connected to the input ends of the first network, the second network and the third network, and the output ends of the first network, the second network and the third network are all connected to the prediction network.
4. The method according to claim 3, characterized in that The step of inputting the training target into the trained neural network model to perform torque prediction to obtain the torque prediction value of the joint to be trained includes: The target angle is input into the feedforward network, and the target angular velocity and the target angular acceleration are input into the prediction network, so that the prediction network calculates and outputs the torque prediction value based on the gravity torque vector output by the first network, the diagonal elements output by the second network, the lower diagonal elements output by the third network, the target angular velocity and the target angular acceleration.
5. The method according to claim 4, characterized in that The calculation formula of the torque prediction value is: Among them, τ p is the torque prediction value, g(q) is the gravity torque vector, q is the angle of the joint to be trained, is the angular velocity of the joint to be trained, is the angular acceleration of the joint to be trained, M(q)=L(q) T L(q), L(q) is a lower triangular matrix, and the lower triangular matrix is obtained by combining the diagonal elements and the lower diagonal elements, is the Cossette moment, 6. A rehabilitation robot control device, characterized in that: include: A use module is used to input the training target into the trained neural network model to perform torque prediction, and obtain the torque prediction value of the joint to be trained; wherein the training target includes the target angle, target angular velocity and target angular acceleration of the joint to be trained; A control module, used for controlling the joint to be trained to move according to the training target based on the torque prediction value; A data processing module, used for acquiring and storing the actual motion data generated by the joint to be trained, and updating the training data group based on the actual motion data; wherein, the updating of the training data group based on the actual motion data includes: judging whether the stored actual motion data reaches a preset number, and if the actual motion data reaches the preset number, determining that the actual motion data meets a preset condition; wherein, the actual motion data includes the actual angle, actual angular velocity, actual angular acceleration and actual torque of the joint to be trained; calculating the sample distance between each sample data in each data group in the training data group and the actual motion data, replacing the target data group with the largest sample distance from the actual motion data with the actual motion data, and obtaining an updated training data group; wherein the number of sample data included in the target data group is the same as the number of the actual motion data; if the actual motion data does not reach the preset number, returning to repeatedly execute the use module to the control module until the actual motion data meets the preset condition; The training module is used to update the neural network model based on the updated training data set, and transmit the updated trained neural network model as the new trained neural network model to the use module.
7. A rehabilitation robot, characterized in that: include: processor and storage device; The storage device stores a computer program, which, when executed by the processor, executes the method according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are executed.
