Soft robot control method fusing attention mechanism and physically inspired neural network
By integrating attention mechanism and physics-inspired neural networks, the dynamic relationship of software robots is directly extracted from experimental data, solving the problem that traditional modeling methods are difficult to describe complex environmental behavior, and achieving efficient and accurate dynamic modeling .
Patent Information
- Application Number
- CN202411772144.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2044-12-04
AI Technical Summary
Traditional dynamic modeling methods are difficult to describe the behavior of software robots in complex environments, while existing physically inspired neural networks have too high training time cost and a huge demand for data when facing complex software robot systems. .
Using the method of fusion attention mechanism and physics-inspired neural network, the dynamic relationship is directly extracted from the experimental data by constructing a deep learning network model, avoiding complex physical model construction steps, and optimizing the model prediction process.
Accurate simulation of the dynamic behavior of the software robot is achieved, the training time cost is reduced, the prediction accuracy of the model and the anti-interference ability of the environmental noise are improved.
Smart Images

Figure CN119388440A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to a soft robot dynamics modeling method integrating an attention mechanism with a physics-inspired neural network. The present invention belongs to the field of soft robot dynamics modeling. Background Art
[0002] With the widespread application of robotics in industry and daily life, soft robots have shown wide application potential in many fields due to their unique flexibility and adaptability. They can be used for complex environment operations, precision surgical assistance, disaster rescue and personalized care to achieve efficient control and other tasks. Dynamic modeling is one of the core of soft robotics technology and the basis of precise operation. Due to the high nonlinearity and complex degrees of freedom brought by the structure and material properties of soft robots, traditional dynamic modeling methods are difficult to accurately capture the dynamic characteristics of soft robots. Therefore, developing a method that can accurately simulate its behavior is helpful to improve the operation accuracy and adaptability of soft robots. At the same time, reducing modeling errors and improving prediction accuracy can improve the working efficiency of soft robots in complex environments, which is conducive to their application in a wider range of scenarios. Therefore, it is of great significance to optimize the accuracy and efficiency of dynamic modeling of soft robots. Traditional modeling methods require the establishment of a detailed dynamic model of the soft robot system, and there is a complex coupling relationship between the kinematics and dynamics of the soft robot, which makes the dynamic model of the multi-degree-of-freedom soft robot extremely complex. At the same time, the nonlinear characteristics of the material and the influence of environmental factors further increase the difficulty of obtaining an accurate dynamic model, making it difficult for traditional modeling methods to be effectively applied to highly flexible soft robots. As an advanced deep learning framework, physics-inspired neural networks obtain information through the interaction between models and data, and optimize the prediction model under the guidance of physical laws. Using this method for soft robot dynamics modeling can directly introduce physical constraints in network training without completely relying on the traditional dynamics modeling process, making the optimization target more intuitive and the model framework has a wide range of applicability and can be used for various types of soft robot systems. However, accurate simulation of the complex dynamic behavior of soft robots requires sufficient training data and fine optimization of the model's back propagation and gradient descent processes. The overall training process is extremely complex. Although the direct use of physics-based deep learning models can improve the accuracy of predictions, this method still requires a large number of training samples and a long training time, which may lead to inefficiency in practical applications, thus limiting its widespread application.
[0003] In summary, traditional dynamic modeling methods rely on precise physical equations and are therefore difficult to describe the behavior of soft robots in complex environments. Existing physics-inspired neural networks have high training costs and extremely high data requirements when faced with complex soft robot systems. Summary of the invention
[0004] The purpose of this invention is to solve the problem that traditional dynamic modeling methods are difficult to describe the behavior of soft robots in complex environments due to their reliance on precise physical equations, and the existing physics-inspired neural networks have too high training time costs and extremely high data requirements when facing complex soft robot systems. A soft robot dynamic modeling method that integrates attention mechanism and physics-inspired neural networks (PINNs) is proposed.
[0005] A soft robot control method that combines attention mechanism and physics-inspired neural network. The specific process is as follows:
[0006] Step 1: Create a soft robot training data set; the specific process is:
[0007] The soft robot training dataset includes the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot;
[0008] The inherent properties of the soft robot are: the number of soft robot arm segments n, the length of the soft robot, the width of the soft robot, the height of the soft robot, the weight of the soft robot, and the density of the soft robot;
[0009] The energy of the soft robot is: the speed of the soft robot and the acceleration of the soft robot;
[0010] Step 2: Build a deep learning network model;
[0011] The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as the input of the deep learning network model, and the mass matrix function M(q; θ M ) as the output of the deep learning network model;
[0012] The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as inputs to the deep learning network model, and the dissipation matrix function As the output of deep learning network model;
[0013] The inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as the input of the deep learning network model. The energy matrix function U(q,u;θ U ) as the output of the deep learning network model;
[0014] The mass matrix function M(q;θ) output by the Lagrangian function and deep learning network model M ), dissipative matrix function Energy matrix function U(q,u;θ U), obtain the predicted position, velocity and acceleration of the soft robot at the next moment;
[0015] The difference between the predicted acceleration of the soft robot at the next moment and the true value of the acceleration is used as the error term of the cross entropy loss function, and the cross entropy loss function is calculated until the loss function converges to obtain a trained deep learning network model;
[0016] Among them, θ M represents the learning parameters of the mass matrix function, θ D represents the learning parameters of the dissipation matrix function, θ U represents the learning parameters of the energy matrix function; q represents the robot position vector, represents the robot velocity vector, represents the robot acceleration vector; u represents control;
[0017] Step 3: Input the inherent properties, position and energy of the soft robot to be tested that are the same as those in step 1 into the trained deep learning network model, and the trained deep learning network model outputs the mass matrix function M(q; θ M ), dissipative matrix function and energy matrix function U(q,u;θ U );
[0018] The mass matrix function M(q;θ) output by the Lagrangian function and deep learning network model M ), dissipative matrix function Energy matrix function U(q,u;θ U ) to obtain the position, velocity and acceleration of the soft robot at the next moment.
[0019] The beneficial effects of the present invention are:
[0020] The present invention proposes a new modeling method for soft robots that combines attention mechanism and Lagrangian neural network. This method is applicable to soft robots of various configurations and motion conditions and is a universal dynamic modeling solution. It avoids the complex physical model construction steps by directly extracting dynamic relationships from experimental data, making the prediction process more efficient and concise; it solves the problem that traditional dynamic modeling methods are difficult to describe the behavior of soft robots in complex environments due to their reliance on precise physical equations.
[0021] The present invention introduces an attention layer into a multi-layer neural network, allowing the deep neural network to automatically identify and weight the most informative features by learning the internal structural relationship of the input data. Each state input is converted into a query, and the network generates the corresponding key and value. The degree of match between the query and the key determines the weighted importance of the corresponding value. This mechanism enables the network to prioritize the information that is most critical to the current prediction target among a large number of input information.
[0022] The present invention combines the strategies of pre-training and main task training. In the pre-training stage, the model learns Lagrangian dynamics and related physics matrices, and further incorporates the advantages of the encoder-decoder architecture in the main task training process, so that the model can establish direct dependencies between different time steps, which not only allows the model to learn the impact of the current state on the future of the system, but also considers the impact of historical states on the future, thereby optimizing the model from a global perspective and improving the long-term prediction accuracy of the model to a certain extent.
[0023] In the present invention, we use a position encoding mechanism to enable the model to break away from the limitations of traditional models when processing time series data and achieve simultaneous parallel processing of all training data. Position encoding adds additional position information to each element of the model training set, allowing the neural network to identify and process the relative or absolute position of each element, and the model can independently process multiple data points in a batch. Therefore, the entire data set can be fed into the model for training at the same time without waiting for the previous training iteration to complete, saving a lot of training time; it solves the problem that the existing physics-inspired neural network has too high a training time cost and a huge demand for data when facing complex soft robotic systems.
[0024] The present invention aims to improve the prediction accuracy of the soft robot model and its resistance to environmental noise by optimizing the Lagrangian neural network and the attention weights of the model state. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 is a flow chart of the method of the present invention;
[0026] Figure 2 are the true values and model predictions of the first two segments of the soft arm in the three dimensions of X, Y, and L when the number of pre-training steps is 500. a is the displacement of the first segment of the robot arm, b is the displacement of the second segment of the robot arm, and Δx real is the true value of the robot arm in the X dimension, Δy real is the true value of the robot arm in the Y dimension, ΔL real is the true value of the robot arm in the L dimension, Δx predis the model prediction value of the robot arm in the X dimension, Δy pred is the model prediction value of the robot arm in the Y dimension, ΔL pred is the model prediction value of the robot arm in the L dimension; the three dimensions of X, Y, and L are the three-dimensional space coordinate system in the simulation software;
[0027] Figure 3 is the model's prediction of the velocity of the first segment of the soft robotic arm under Gaussian white noise with a mean of 0.05, Time is the time, and First segment velocity is the velocity of the first segment of the soft robotic arm;
[0028] Figure 4 is the predicted value of the velocity of the first segment of the soft robotic arm under noise-free conditions, Time is the time, and Firstsegment velocity is the velocity of the first segment of the soft robotic arm;
[0029] Figure 5 is the predicted value of the velocity of the second segment soft robotic arm under noise-free conditions, Time is the time, and Secondsegment velocity is the velocity of the second segment soft robotic arm;
[0030] Figure 6 It is a heat map of the attention scores of the force on the second segment of the soft arm in the X dimension to the input transformation matrix when the pre-training step number is 10; State TransitionMatrix Columns is the rows of the input transition matrix, and StateTransition MatrixRows is the columns of the input transition matrix. DETAILED DESCRIPTION
[0031] Specific implementation method 1: This implementation method is a soft robot control method that integrates attention mechanism and physics-inspired neural network. The specific process is as follows:
[0032] Step 1: Create a soft robot training data set; the specific process is:
[0033] The soft robot training dataset includes the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot;
[0034] The inherent properties of the soft robot are: the number of soft robot arm segments n, the length of the soft robot, the width of the soft robot, the height of the soft robot, the weight of the soft robot, and the density of the soft robot;
[0035] The energy of the soft robot is: the speed of the soft robot and the acceleration of the soft robot;
[0036] The position of the soft robot is prepared in advance and is necessary for training the network;
[0037] Step 2: Build a deep learning network model;
[0038] The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as the input of the deep learning network model, and the mass matrix function M(q; θ M ) as the output of the deep learning network model;
[0039] The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as inputs to the deep learning network model, and the dissipation matrix function As the output of deep learning network model;
[0040] The inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as the input of the deep learning network model. The energy matrix function U(q,u;θ U ) as the output of the deep learning network model;
[0041] The mass matrix function M(q;θ) output by the Lagrangian function and deep learning network model M ), dissipative matrix function Energy matrix function U(q,u;θ U ), obtain the predicted position, velocity and acceleration of the soft robot at the next moment; this section represents the position, velocity and acceleration of the soft robot at the next moment predicted based on the physical method;
[0042] The difference between the predicted acceleration of the soft robot at the next moment and the true value of the acceleration is used as the error term of the cross entropy loss function, and the cross entropy loss function is calculated until the loss function converges to obtain a trained deep learning network model;
[0043] Among them, θ M represents the learning parameters of the mass matrix function, θ D represents the learning parameters of the dissipation matrix function, θ U represents the learning parameters of the energy matrix function; q represents the robot position vector, represents the robot velocity vector, represents the robot acceleration vector; u represents control;
[0044] Step 3: Input the inherent properties, position and energy of the soft robot to be tested that are the same as those in step 1 into the trained deep learning network model, and the trained deep learning network model outputs the mass matrix function M(q; θ M ), dissipative matrix function and energy matrix function U(q,u;θ U );
[0045] The mass matrix function M(q;θ) output by the Lagrangian function and deep learning network model M ), dissipative matrix function Energy matrix function U(q,u;θ U ) to obtain the position, velocity and acceleration of the soft robot at the next moment.
[0046] Specific implementation method 2: This implementation method is different from the specific implementation method 1 in that: in step 2, a deep learning network model is constructed; the specific process is:
[0047] The deep learning network model includes self-attention mechanism and multi-layer perceptron MLP;
[0048] The self-attention mechanism includes an encoder and a decoder.
[0049] The other steps and parameters are the same as those in the first embodiment.
[0050] Specific implementation method three: This implementation method is different from specific implementation method one or two in that: in step two, the inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as inputs of the deep learning network model, and the mass matrix function M(q; θ M ) as the output of the deep learning network model; the specific process is:
[0051] The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as inputs of the encoder, and the encoder outputs the query Q;
[0052] The mass matrix function M(q;θ) output by the deep learning network model corresponding to the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot in the previous iteration M ), dissipative matrix function and energy matrix function U(q,u;θ U ) is used as the input of the decoder, and the decoder outputs the key K;
[0053] The query Q and key K are normalized by softmax to obtain the value V;
[0054] The value V is used as the input of the multilayer perceptron MLP, and the multilayer perceptron MLP outputs the quality matrix function M(q; θ M ).
[0055] The other steps and parameters are the same as those in the first or second embodiment.
[0056] Specific implementation method 4: This implementation method is different from any one of the specific implementation methods 1 to 3 in that: in step 2, the inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as inputs of the deep learning network model, and the dissipation matrix function As the output of deep learning network model;
[0057] The specific process is:
[0058] The inherent properties of the soft robot, the position of the soft robot, and the force of the soft robot are used as inputs of the encoder, and the encoder outputs the query Q;
[0059] The mass matrix function M(q;θ) output by the deep learning network model corresponding to the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot in the previous iteration M ), dissipative matrix function and energy matrix function U(q,u;θ U ) is used as the input of the decoder, and the decoder outputs the key K;
[0060] The query Q and key K are normalized by softmax to obtain the value V;
[0061] The value V is used as the input of the multilayer perceptron MLP, and the multilayer perceptron MLP outputs the dissipation matrix function
[0062] The other steps and parameters are the same as those in Specific Embodiments 1 to 3.
[0063] Specific implementation method 5: This implementation method is different from any one of the specific implementation methods 1 to 4 in that: in step 2, the inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as inputs of the deep learning network model, and the energy matrix function U(q,u; θ U ) as the output of the deep learning network model;
[0064] The specific process is:
[0065] The inherent properties of the soft robot, the position of the soft robot, and the force of the soft robot are used as inputs of the encoder, and the encoder outputs the query Q;
[0066] The mass matrix function M(q;θ) output by the deep learning network model corresponding to the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot in the previous iteration M ), dissipative matrix function and energy matrix function U(q,u;θ U ) is used as the input of the decoder, and the decoder outputs the key K;
[0067] The query Q and key K are normalized by softmax to obtain the value V;
[0068] The value V is used as the input of the multilayer perceptron MLP, and the multilayer perceptron MLP outputs the energy matrix function U(q,u; θ U ).
[0069] The other steps and parameters are the same as those in Specific Embodiments 1 to 4.
[0070] Specific implementation method 6: This implementation method is different from any one of the specific implementation methods 1 to 5 in that the Lagrangian function in step 2 is:
[0071]
[0072] in, represents kinetic energy and V(q) represents potential energy.
[0073] The other steps and parameters are the same as those in Specific Implementation Methods 1 to 5-1.
[0074] Specific implementation method 7: This implementation method is different from any one of specific implementation methods 1 to 6 in that: in step 2, the difference between the predicted acceleration of the soft robot at the next moment and the true value of the acceleration is used as the error term of the cross entropy loss function, and the cross entropy loss function is calculated until the loss function converges to obtain a trained deep learning network model; the specific process is:
[0075] The cross entropy loss function is
[0076]
[0077] Among them, B is the set of training data samples; represents the predicted acceleration of the soft robot at the next moment corresponding to the pth sample, represents the acceleration of the real soft robot corresponding to the p-th sample at the next moment; ||·||2 represents the Euclidean norm.
[0078] The other steps and parameters are the same as those in Specific Embodiments 1 to 6.
[0079] 1. Based on Lagrangian function The dynamic model of the soft robot is obtained; the expression is:
[0080]
[0081] in, represents kinetic energy, V(q) represents potential energy;
[0082] M(q) represents the mass matrix; represents the Coriolis force and centrifugal force matrix; G(q) represents the gravity vector;
[0083] q represents the robot position vector, represents the robot velocity vector, represents the robot acceleration vector;
[0084] Robot position vector q, robot velocity vector and the robot acceleration vector Construct the state vector Q,
[0085] u represents the control input,
[0086] Where n and m represent the dimensions of the robot position vector q and the control input u respectively;
[0087] 2. Define the mass matrix function M(q; θ M ), dissipation matrix function Input transformation matrix function U(q,u;θ U );
[0088] θ M ,θ D ,θ U The network parameters of the multi-layer perceptron (MLP) are Θ = {θ M ,θ D ,θ U};
[0089] Among them, θ M represents the learning parameters of the quality matrix function; where θ D represents the learning parameters of the dissipation matrix function; where θ U represents the learning parameters of the input transformation matrix function;
[0090] 3. Define the forward model function
[0091] Control u as the input of the forward model, the predicted robot position vector q next and the robot velocity vector As the output of the forward model;
[0092] θ F represents the learning parameters of the forward model;
[0093] 4. Define the inverse model function
[0094] The predicted robot position vector q next and the predicted robot velocity vector As the input of the inverse model, the predicted control u is the output of the inverse model;
[0095] θ Grepresents the learning parameters of the inverse model;
[0096] The forward model represents the prediction of the next state of the soft robot;
[0097] The inverse model represents the derivation of the control inputs that need to be applied;
[0098] The next state predicted by the forward model function will be used as the input of the reverse model function;
[0099] 5. Establish the update function U(θ F ,θ G ; η), used to update the parameters θ of the forward model and the reverse model according to the gradient of the loss function during training F and θ G ;
[0100] The learning rate η is a tuning parameter in the update process;
[0101] 6. Set the number of degrees of freedom n dof (Soft robot segment number);
[0102] Set the width w of the Lagrangian function l and depth d l , dissipation matrix (white noise, etc.) function width w d and depth d d , the width w of the input transformation matrix function i and depth d i ,
[0103] Set the batch size n, diagonal perturbation ∈ diagonal , activation function RELU, learning rate α, weight decay λ decay , and the maximum number of training cycles N;
[0104] 7. Initialize the Lagrangian function parameters θ L , the learning parameter θ of the dissipation matrix function D , the learning parameters θ of the input transformation matrix function U ;
[0105] Initialize Lagrangian objective function parameters Learning parameters of the dissipative matrix objective function Input transformation matrix objective function learning parameters
[0106] 8. Define the attention mechanism encoder Encoder attn ;
[0107] The current state s t Input attention mechanism encoder Encoder attn, attention mechanism encoder Encoder attn Output Encoder attn (s t θ enc );
[0108] θ enc Represents encoder parameters;
[0109] θ enc Learn during training to capture key features and dependencies in the state space;
[0110] 9. Define the attention mechanism decoder Decoder attn ;
[0111] The output of the encoder is attn (s t θ enc ) Input attention mechanism decoder Decoder attn , attention mechanism decoderDecoder attn (Encoder attn (s t );θ dec ) Output the predicted next state s t+1 and control behaviora t ;
[0112] θ dec Represents decoder parameters;
[0113] The decoder structure utilizes the context information provided by the encoder and uses its parameters θ dec To generate corresponding actions and state transitions;
[0114] 10. Repeat steps 8 to 9 until the attention mechanism encoder Encoder attn and attention mechanism decoderDecoder attn Converge and obtain an optimized attention mechanism encoder Encoder attn and attention mechanism decoderDecoder attn ;
[0115] 11. Initialize the weight matrix θ of query Q, key K and value V Q ,θ K and θ V ;
[0116] 12. The predicted robot position vector q next , robot velocity vector Convert the predicted control input u into the embedding vector E u ;
[0117] The embedding vector E q Convert to K=E q θ K , Q=E q θ Q ;
[0118] The embedding vector E u Convert to V=E u θ V ;
[0119] 13. Calculate the compatibility score between the query Q and the key K, and then determine the attention weight matrix A for each value V:
[0120]
[0121] Among them, d k represents the dimension of the key vector, T represents the matrix transpose operation; softmax() represents the activation function;
[0122] 14. Based on the attention weight matrix A and the value V, the state vector is updated by multiplication to obtain a new value V'=AV;
[0123] 15. Apply the gradient descent algorithm (SGD) to update the policy network f π , the policy network loss function L loss The parameter is θ π ,θ V ,θ loss ; Perform the following substeps after each iteration;
[0124] The network is evaluated to determine whether it meets predetermined performance criteria or whether more iterations are required.
[0125] If the performance does not meet the predetermined standard, return to step 7 and consider adjusting the learning rate or other hyperparameters.
[0126] If the performance of the model on the validation dataset no longer improves or the predetermined number of iterations N is reached, the iteration is stopped.
[0127] 17. Apply residual connection to the output of the multi-head attention layer to obtain feature R = A multi +E' q , and then perform layer normalization on feature R to obtain feature E norm =LayerNorm(R);
[0128] 18. Use the feed-forward network FFN to feature E norm After processing, feature E is obtained FFN ; The process is:
[0129] For feature Enorm Processing to obtain feature F FFN , the expression is:
[0130] F FFN =RELU(FFN(E norm ))
[0131] Among them, RELU is a nonlinear activation function;
[0132] Based on feature F FFN and feature E norm Get feature E FFN , the expression is:
[0133] E FFN =LayerNorm(F FFN +E norm )
[0134] 19. Through the Softmax layer, the feedforward neural network FFN output feature E FFN Convert to state transition probability P next =Softmax(Linear(E FFN ));
[0135] The state transition probability P next Convert to a specific action or state value q next ;
[0136] 20. If the state transition probability P next If the maximum state transition probability value in exceeds the preset threshold, the corresponding action a is selected t And update the state s t+1 ;
[0137] Otherwise, based on the state transition probability P next Adopting the exploration strategy q(a t |P next ) to select an action and update the status;
[0138] Step 21: Use the Error Analysis function (q next ,P next ) Evaluate the error between model output and actual observations;
[0139] According to the error results, adjust the deep learning parameters Θ of the multi-layer perceptron (MLP) network layer to optimize the prediction accuracy; confirm the physical model output q of the soft robot next After the predetermined performance index is met, the deep learning parameter Φ of the optimized multi-layer perceptron (MLP) network layer is obtained, that is, the optimized multi-layer perceptron (MLP) network layer is obtained;
[0140] This error analysis function is used to adjust the entire training process, which includes the attention mechanism and the ordinary neural network, to guide the training towards the point where the error is minimized.
[0141] 22. Input the control vector of the robot to be tested into the optimized multi-layer perceptron (MLP) network layer, and the optimized multi-layer perceptron (MLP) network layer outputs the predicted robot position vector and velocity vector.
[0142] Prepare to enter the practical application stage.
[0143] The soft robotic arm consists of n segments, each with three degrees of freedom: x, y and l. The form of the target to be optimized is:
[0144] Φ(τ,ε)=k τ ×τ+k ε ×ε
[0145] Among them, τ is the time consumption, ε is the energy loss, k τ is the weight coefficient of time consumption, k ε is the weight coefficient of energy time consumption;
[0146] The target to be optimized is the dynamic model of the soft robot
[0147] The energy loss ε is defined as the integral sum of each degree of freedom of the robot arm:
[0148]
[0149] Among them, τ ij represents the control torque of the i-th segment on the j-degree of freedom, represents the angular velocity or linear velocity of the i-th segment in the j degree of freedom; t represents time;
[0150] Each τ ij and The product of represents the power consumption in the j degree of freedom, thus capturing the overall situation of energy loss;
[0151] The state vector involves only the intrinsic dynamics of the soft robotic arm and is expressed as:
[0152]
[0153] Among them, q x ,q y ,q l Respectively represent the positions of each segment of the soft robot arm in the x, y and l directions, and Indicates the speed of each segment of the soft robot arm in the x, y and l directions;
[0154] For each segment of the soft robotic arm, the Lagrangian function is defined And the Lagrangian function Decompose into kinetic energy and potential energy V(q), represents kinetic energy and V(q) represents potential energy; it is approximated by a neural network of the following form:
[0155]
[0156] N θ is a multi-layer perceptron (MLP) network layer with parameter θ, which is used to approximate the true Lagrangian function;
[0157] The encoder in step eight is specifically:
[0158] Initialize the encoder parameters, which include weight matrix and bias vector;
[0159] Each layer of the multi-layer perceptron MLP structure gradually extracts the features of the input state through a linear transformation followed by a nonlinear activation function.
[0160] The encoder is constructed as follows:
[0161] e enc =MLP Encoder (s t θ enc )
[0162] Among them, θ enc Represents the parameters of the encoder, s t Represents the state of the current time step; MLP Encoder represents the multi-layer perceptron corresponding to the encoder; e enc Indicates the status of the encoder output;
[0163] The decoder in step nine is specifically:
[0164] The encoder output state e enc Pass to decoder;
[0165] The purpose of the decoder is to parse the output of the encoder and θ The three physics-inspired matrices in calculate the attention scores and generate corresponding control actions or predictions. The decoder also adopts the MLP structure;
[0166] The decoder construction process is as follows:
[0167] a t =MLP Decoder (e enc θ dec )
[0168] Among them, θ dec Represents the parameters of the decoder, a t Represents the action or torque mapped from the encoded state; MLP Decoder Represents the multi-layer perceptron corresponding to the decoder; there is an MLP network in the decoder;
[0169] The process of obtaining the soft robot dynamics model is as follows:
[0170] The self-attention score Attention in the decoder is used to predict the torque τ:
[0171] τ att =Attention(Q,K,V)
[0172] Using the learned Lagrangian function and the predicted moment τ att To construct the Lagrangian function Through the Lagrangian function Get the dynamic model of the soft robot The differential form of
[0173] Dynamics Model of Soft Robot The differential form of the expression is:
[0174]
[0175] According to minimizing the predicted state q next and the target state q target The difference between them defines a loss function L(θ) to evaluate the accuracy of the model prediction:
[0176]
[0177] Among them, B is the set of training data samples;
[0178] q next,i represents the next state predicted by the pth sample, q target,i represents the target state of the p-th sample;
[0179] ||·||2 represents the Euclidean norm, which is used to calculate the squared difference between the predicted state and the target state;
[0180] The model will enter the strategy optimization phase:
[0181] At this stage, the policy network π φ The introduction is to directly learn the attention mechanism, the policy network π φ Take state s as input and the probability distribution of action a as output;
[0182] Policy Network π φ The loss of L policy (φ) reflects the superiority of the selected action relative to the average level and is calculated as follows:
[0183]
[0184] The parameter update of the policy network follows the gradient ascent method to maximize the cumulative reward. The update rule is given by:
[0185]
[0186] Among them, α is the learning rate, Denotes the loss function L policy The gradient of the policy network parameter φ;
[0187] Finally, the performance of the policy network is verified by the test set; the performance indicators mainly include prediction accuracy and action curve fit; specifically, by calculating the average loss on the test set To measure generalization ability:
[0188]
[0189] Among them, y att (s', r; θ') represents the target value function, B test Represents a collection of test data samples;
[0190] In addition, the action sequences generated by the policy network on the test set are compared with the optimal action sequences obtained in the real world or in high-precision simulation.
[0191] The present invention may also have many other embodiments. Without departing from the spirit and essence of the present invention, those skilled in the art may make various corresponding changes and modifications based on the present invention, but these corresponding changes and modifications should all fall within the scope of protection of the claims attached to the present invention.
Claims
1. A soft robot control method integrating attention mechanism and physics-inspired neural network, characterized by: The specific process of the method is: Step 1: Create a soft robot training data set; the specific process is: The soft robot training dataset includes the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot; The inherent properties of the soft robot are: the number of soft robot arm segments n, the length of the soft robot, the width of the soft robot, the height of the soft robot, the weight of the soft robot, and the density of the soft robot; The energy of the soft robot is: the speed of the soft robot and the acceleration of the soft robot; Step 2: Build a deep learning network model; The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as the input of the deep learning network model, and the mass matrix function M(q; θ M ) as the output of the deep learning network model; The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as inputs to the deep learning network model, and the dissipation matrix function As the output of deep learning network model; The inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as the input of the deep learning network model. The energy matrix function U(q,u;θ U ) as the output of the deep learning network model; The mass matrix function M(q;θ) output by the Lagrangian function and deep learning network model M ), dissipative matrix function Energy matrix function U(q,u;θ U ), obtain the predicted position, velocity and acceleration of the soft robot at the next moment; The difference between the predicted acceleration of the soft robot at the next moment and the true value of the acceleration is used as the error term of the cross entropy loss function, and the cross entropy loss function is calculated until the loss function converges to obtain a trained deep learning network model; Among them, θ M represents the learning parameters of the mass matrix function, θ D represents the learning parameters of the dissipation matrix function, θ U represents the learning parameters of the energy matrix function; q represents the robot position vector, represents the robot velocity vector, represents the robot acceleration vector; u represents control; Step 3: Input the inherent properties, position and energy of the soft robot to be tested that are the same as those in step 1 into the trained deep learning network model, and the trained deep learning network model outputs the mass matrix function M(q; θ M ), dissipative matrix function and energy matrix function U(q,u;θ U ); The mass matrix function M(q;θ) output by the Lagrangian function and deep learning network model M ), dissipative matrix function Energy matrix function U(q,u;θ U ) to obtain the position, velocity and acceleration of the soft robot at the next moment.
2. The method for controlling a soft robot integrating an attention mechanism and a physics-inspired neural network according to claim 1, characterized in that: In step 2, a deep learning network model is constructed; the specific process is as follows: The deep learning network model includes self-attention mechanism and multi-layer perceptron MLP; The self-attention mechanism includes an encoder and a decoder.
3. The method for controlling a soft robot integrating an attention mechanism and a physics-inspired neural network according to claim 2, characterized in that: In the step 2, the inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as the input of the deep learning network model, and the mass matrix function M(q; θ M ) as the output of the deep learning network model; the specific process is: The inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as inputs of the encoder, and the encoder outputs the query Q; The mass matrix function M(q;θ) output by the deep learning network model corresponding to the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot in the previous iteration M ), dissipative matrix function and energy matrix function U(q,u;θ U ) is used as the input of the decoder, and the decoder outputs the key K; The query Q and key K are normalized by softmax to obtain the value V; The value V is used as the input of the multilayer perceptron MLP, and the multilayer perceptron MLP outputs the quality matrix function M(q; θ M ).
4. The method for controlling a soft robot integrating an attention mechanism and a physics-inspired neural network according to claim 3, characterized in that: In step 2, the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot are used as inputs of the deep learning network model, and the dissipation matrix function As the output of the deep learning network model; the specific process is: The inherent properties of the soft robot, the position of the soft robot, and the force of the soft robot are used as inputs of the encoder, and the encoder outputs the query Q; The mass matrix function M(q;θ) output by the deep learning network model corresponding to the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot in the previous iteration M ), dissipative matrix function and energy matrix function U(q,u;θ U ) is used as the input of the decoder, and the decoder outputs the key K; The query Q and key K are normalized by softmax to obtain the value V; The value V is used as the input of the multilayer perceptron MLP, and the multilayer perceptron MLP outputs the dissipation matrix function 5. The method for controlling a soft robot integrating an attention mechanism and a physics-inspired neural network according to claim 4, characterized in that: In step 2, the inherent properties of the soft robot, the position of the soft robot and the energy of the soft robot are used as the input of the deep learning network model, and the energy matrix function U(q,u; θ U ) as the output of the deep learning network model; the specific process is: The inherent properties of the soft robot, the position of the soft robot, and the force of the soft robot are used as inputs of the encoder, and the encoder outputs the query Q; The mass matrix function M(q;θ) output by the deep learning network model corresponding to the inherent properties of the soft robot, the position of the soft robot, and the energy of the soft robot in the previous iteration M ), dissipative matrix function and energy matrix function U(q,u;θ U ) is used as the input of the decoder, and the decoder outputs the key K; The query Q and key K are normalized by softmax to obtain the value V; The value V is used as the input of the multilayer perceptron MLP, and the multilayer perceptron MLP outputs the energy matrix function U(q,u; θ U ).
6. The method for controlling a soft robot integrating an attention mechanism and a physics-inspired neural network according to claim 5, characterized in that: The Lagrangian function in step 2 is: in, represents kinetic energy and V(q) represents potential energy.
7. The method for controlling a soft robot integrating an attention mechanism and a physics-inspired neural network according to claim 6, characterized in that: In the step 2, the difference between the predicted acceleration of the soft robot at the next moment and the true value of the acceleration is used as the error term of the cross entropy loss function, and the cross entropy loss function is calculated until the loss function converges to obtain a trained deep learning network model; the specific process is: The cross entropy loss function is Among them, B is the set of training data samples; represents the predicted acceleration of the soft robot at the next moment corresponding to the pth sample, represents the acceleration of the real soft robot corresponding to the p-th sample at the next moment; ||·||2 represents the Euclidean norm.
Citation Information
Patent Citations
Model order reduction method for rapid simulation of pneumatic soft robot
CN114347029A
Rope-driven flexible double-joint bionic crab and control method
CN114701583A
Soft manipulator control method and device, soft manipulator and electronic equipment
CN116494239A
Position control method, system and equipment for pneumatic soft robot
CN117444978A
Enhanced soft robot driving device and use thereof
WO2024139904A1
Cited By
Motion feature prediction method, robot, electronic equipment and medium
CN121544914A