Robot gait planning algorithm based on neural network and reinforcement learning
Through the robot gait planning algorithm based on neural network and reinforcement learning, combined with the action network and evaluation network, the problem of small action space and sample space in the existing technology is solved, the precise planning and trajectory tracking of the robot gait are realized, and the efficiency is improved. The ability to identify and track dynamic trajectory changes.
Patent Information
- Application Number
- CN202311392721.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-10-25
- Publication Date
- 2024-09-24
- Estimated Expiration
- 2043-10-25
AI Technical Summary
When the existing technology uses reinforcement learning for robot gait planning, the action space and sample space are small, and it is difficult to handle complex dynamic trajectory changes and high-dimensional input data, making it difficult to achieve efficient trajectory tracking.
Using a robot gait planning algorithm based on neural network and reinforcement learning, by establishing an action network and an evaluation network, combining the camera module and direction sensor to obtain environmental information, establish an objective function model, and update gait parameters through instant reward values until trajectory tracking is achieved The error is within the preset range.
It achieves precise planning and trajectory tracking of the robot's gait. Through the combination of neural network and reward mechanism, optimal gait parameters are obtained, and the ability to identify and track dynamic trajectory changes is improved.
Smart Images

Figure CN117270398B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robot gait planning, and in particular to a robot gait planning algorithm based on neural network and reinforcement learning. Background Art
[0002] Gait planning is a crucial part of robot design, and existing gait planning methods are often divided into three categories: gait planning methods based on bionics, gait planning methods based on intelligent learning algorithms, and gait planning methods based on models. These methods provide a general direction for gait planning, but cannot achieve dynamic trajectory changes and accurate trajectory tracking.
[0003] In order to strengthen the recognition and tracking of dynamic trajectory changes, reinforcement learning is used in the existing technology to solve the problem. However, this reinforcement learning has limitations, that is, the action space and sample space used for reinforcement learning are very small. More complex tasks that are close to actual conditions often require a large state space and a continuous action space. When the input data is images and sounds, it often has a high dimension, and traditional reinforcement learning is difficult to process efficiently. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention provides a robot gait planning algorithm based on neural network and reinforcement learning. The specific technical solution is as follows:
[0005] The robot gait planning algorithm based on neural network and reinforcement learning includes the following steps:
[0006] S1: Establish an action network and an evaluation network, and establish the objective function model of reinforcement learning based on the current state of the robot and the parameters of the robot controller.
[0007] S2: Get the immediate reward value during the change of the environment state after executing the action under the current strategy.
[0008] S3: The reward value is updated through the action network and the evaluation network to obtain the optimal gait parameters, and the parameters are input into the robot controller.
[0009] As an improvement of the above technical solution, step S1 includes the following steps:
[0010] S11: Establish an action network and an evaluation network, and obtain the environmental information around the robot and the initial position and posture of the robot's lower limbs through the camera module.
[0011] S12: Obtain the parameters of the robot controller through the action network.
[0012] S13: The current state of the robot is obtained through the information acquisition module, and combined with the parameter vector of the robot to establish an objective function model of reinforcement learning.
[0013] As an improvement of the above technical solution, the objective function model includes the following formula:
[0014]
[0015] Among them, β is the behavior strategy, γ∈(0,1) is the discount factor, and x t is the current state vector of the robot, λ t is the parameter vector of the controller.
[0016] As an improvement of the above technical solution, step S2 includes the following steps:
[0017] S21: Scan and establish a spatial environment model near the robot through the camera module.
[0018] S22: Return the distance information of the nearest obstacle to the robot through the direction sensor, and establish the robot's environmental state space model based on the distance information.
[0019] S23: When the robot performs actions according to the behavioral strategy, the robot's environmental state changes and returns the reward value obtained during the change.
[0020] As an improvement of the above technical solution, the robot's environmental state space model includes the following formula:
[0021] s j =(d1,……,d i ,β)
[0022] Among them, d i It represents the distance of the obstacle closest to the robot returned by the i-th sensor, and β is the distance from the robot to the obstacle.
[0023] As an improvement of the above technical solution, step S3 includes the following steps:
[0024] S31: Input the robot's state vector into the action network, and output the controller parameter vector through the action network.
[0025] S32: Input the state vector and the controller parameter vector into the evaluation network to obtain the maximum reward value.
[0026] S33: cyclically executing step S31 and step S32 until the trajectory tracking error is within a preset range.
[0027] S34: Integrate the data obtained in step S33 to obtain a gait training data set for robot lower limb reinforcement learning, and input the optimal gait parameters in the gait training data set into the robot controller.
[0028] The reward value is represented by an action value function.
[0029] As an improvement of the above technical solution, the design method of the controller includes the following steps:
[0030] S201: According to the uncertainty of the robot system parameters, a dynamic model root of the robot lower limb is established.
[0031] S202: Based on the UK equation and according to Lagrange's theorem, a motion model of a general constraint system without uncertainty is established.
[0032] S203: Without considering the friction force, an explicit motion model of the constrained robot system is established according to the servo constraints in the robot system.
[0033] S204: In the absence of constraint forces in the absence of uncertainty, a constraint force model is established based on the Gaussian principle and the Lagrangian form of the D'Alembert principle.
[0034] S205: Design a robust controller based on the constraint model.
[0035] As an improvement of the above technical solution, the dynamic model of the robot lower limb in step S201 is as follows:
[0036]
[0037] Where t represents time, p represents the angular displacement of the joint, and p∈R n , is the angular velocity of the robot system, is the angular acceleration of the robot system, ε is a bounded quantity of uncertainty, τ(t) represents the input torque of the joint, and H(·)∈R n represents the inertia matrix, C(·) represents the Coriolis force and centrifugal force matrix, F(·) is the friction and external disturbance matrix, and G(·) is the gravity term matrix.
[0038] The motion model of the general constraint system without uncertainty in step S202 is as follows:
[0039]
[0040] Where p=[p1,p2,…,p n ] T , represents the generalized coordinates, H(p,t)∈R n, represents the symmetric positive definite inertia matrix of the system, represents the generalized active force matrix used to free the system from constraints.
[0041] The explicit motion model of the constrained system in step S203 is:
[0042]
[0043] in, is the constraint force matrix and drives the system to satisfy the given constraints, represents the generalized active force matrix used to free the system from constraints.
[0044] The constraint force model in step S204 is as follows:
[0045]
[0046] in, is the constraint matrix, t represents time, “+” represents the generalized inverse matrix, A is the constraint equation, p represents the angular displacement of the joint, and p∈R n , is the angular velocity of the robot system, H(·)∈R n represents the inertia matrix, C(·) represents the Coriolis force and centrifugal force matrix, F(·) is the friction force and external disturbance matrix, and G(·) is the gravity term matrix;
[0047] The robust controller designed in step S205 is as follows:
[0048]
[0049] Where A is the constraint equation, H(·)∈R n represents the inertia matrix, t represents time, p represents the angular displacement of the joint, is the angular velocity of the robot system, is the constraint matrix, P is the given parameter matrix of the proposed controller, and P>0, k is the gain coefficient, and ε is the size of the bounded radius of uncertainty.
[0050] Beneficial effects of the present invention:
[0051] By combining the reward mechanism with the neural network, the changes in the robot's action strategy are continuously learned until the optimal gait parameters are obtained. The gait parameters generated by machine learning are combined with the controller to achieve accurate planning of the robot's gait, thereby achieving precise tracking of the robot's gait. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] Figure 1It is a flowchart of the Q-learning of the robot based on neural network in the present invention;
[0053] Figure 2 It is the simulation diagram of the robust controller in the present invention and the simulation diagram when PID acts;
[0054] Figure 3 This is a modeling diagram of the lower limbs of a humanoid robot. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention.
[0056] In order to strengthen the recognition and tracking of dynamic trajectory changes, reinforcement learning is used in the existing technology to solve the problem. However, this reinforcement learning has limitations, that is, the action space and sample space used for reinforcement learning are very small. More complex tasks that are close to actual conditions often require a large state space and a continuous action space. When the input data is images and sounds, it often has a high dimension, and traditional reinforcement learning is difficult to process efficiently.
[0057] In order to solve the above problems, this embodiment can provide a robot gait planning algorithm based on neural network and reinforcement learning, including the following steps:
[0058] In the robot control algorithm, the controller needs to process multiple input signals and output torque signals to the humanoid robot once the processing is completed. That is, these torque control signals depend on the input signals and the parameters of the robust controller. Therefore, the control problem of the robot's lower limbs can be expressed as:
[0059]
[0060] Among them, the vector p d is the desired joint angle, vector p is the actual joint angle, vector q i is the physical parameter of the robot joint, λ is the parameter of the controller, and λ=(P,k,ε), P is the given parameter matrix of the proposed controller, which is positively correlated with the response speed of the system, but too large will affect the control cost, and P>0, k is the gain coefficient, which is used to deal with different initial incompatible conditions, too large will affect the tracking accuracy, ε is the size of the bounded radius of uncertainty, too small will cause system oscillation, e i is the trajectory tracking error.
[0061] Based on the above reasons, the gait planning of the robot controller can be simplified to the determination of the optimal gait parameters of the controller, that is, the determination of the adjustable parameter λ in the formula for the above control problem. Based on this reason, step S1 is executed.
[0062] S1: Establish an action network and an evaluation network, and establish the objective function model of reinforcement learning based on the current state of the robot and the parameters of the robot controller.
[0063] Specifically, step S1 includes the following steps:
[0064] S11: Establish an action network and an evaluation network, and obtain the environmental information around the robot and the initial position and posture of the robot's lower limbs through the camera module.
[0065] In order to determine the environmental information of the robot and the initial information of the robot's lower limbs, the camera module usually uses an RGB camera to scan the robot, that is, the robot's surrounding environment.
[0066] S12: Obtain the parameters of the robot controller through the action network.
[0067] Here we need to input the robot's behavior into the action network, so that the action network will output the parameters of the robot controller, which can be expressed as λ, that is, λ = (P, k, ε).
[0068] S13: The current state of the robot is obtained through the information acquisition module, and combined with the parameter vector of the robot to establish an objective function model of reinforcement learning.
[0069] When the robot is performing motion, the system can obtain the current state of the robot through the information acquisition module. This state includes information such as the joint angle of the lower limb movement and the trajectory tracking error, which can be expressed as: t =(p i ,e i ,∫e i dt).
[0070] The information acquisition module may be a method of identifying the robot's motion data through the controller itself or obtaining data through various sensor detection methods or other methods that can obtain robot information.
[0071] In reinforcement learning, the motion state of the robot can be decided in the form of a function, so an objective function can be established to represent the motion state of the robot for decision making. Specifically, the objective function model includes the following formula:
[0072]
[0073] Among them, β is the behavior strategy, γ∈(0,1) is the discount factor, and x t is the current state vector of the robot, λ t is the parameter vector of the controller.
[0074] After determining the objective function by combining the current state of the humanoid robot and the parameter vector of the robust controller, it is necessary to optimize the objective function to obtain the optimal objective function, specifically executing step S2.
[0075] S2: Get the immediate reward value during the change of the environment state after executing the action under the current strategy.
[0076] The behavior strategy of the robot is determined by the objective function. Specifically, step S2 includes the following steps:
[0077] S21: Scan and establish a spatial environment model near the robot through the camera module.
[0078] This is to determine the environmental conditions around the robot's location and to establish a spatial environment model with the robot as the center. This spatial environment model includes a global coordinate system with the robot as the origin.
[0079] S22: Return the distance information of the nearest obstacle to the robot through the direction sensor, and establish the robot's environmental state space model based on the distance information.
[0080] When the direction sensor detects an obstacle nearby, it only needs to avoid the nearest obstacle to avoid collision. Therefore, it only needs to return the distance information of the obstacle closest to the robot. Since the robot itself is the origin, the distance information and coordinate information of the obstacle relative to the robot can be determined in the global coordinate system. The robot's environmental state space model is established based on this information. Specifically, the robot's environmental state space model includes the following formula:
[0081] s j =(d1,……,d i ,β)
[0082] Among them, d i It represents the distance of the obstacle closest to the robot returned by the i-th sensor, and β is the distance from the robot to the obstacle.
[0083] S23: When the robot performs actions according to the behavioral strategy, the robot's environmental state changes and returns the reward value obtained during the change.
[0084] Each time the robot performs an action according to the behavioral strategy, the state of the robot's environment changes. During this change, a reward value will be obtained and returned.
[0085] S3: The reward value is updated through the action network and the evaluation network to obtain the optimal gait parameters, and the parameters are input into the robot controller.
[0086] The action network and the evaluation network are important components of the neural network. Based on these two networks, the reward value needs to be further updated and iterated. Specifically, step S3 includes the following steps:
[0087] S31: Input the robot's state vector into the action network, and output the controller parameter vector through the action network.
[0088] S32: Input the state vector and the controller parameter vector into the evaluation network to obtain the maximum reward value.
[0089] The reward value is expressed as an action value function, specifically: Q(s,a).
[0090] S33: cyclically executing step S31 and step S32 until the trajectory tracking error is within a preset range.
[0091] In the loop process, the humanoid robot not only accepts the changes in the environment, but also obtains the instantaneous reward and punishment feedback of the environment to the system. Therefore, the action value function can be expressed as the following state:
[0092] Q(s t ,a t )←r t +γV(s t+1 )
[0093] The purpose of updating the action value is to maximize the reward, so the above formula can be rewritten as:
[0094]
[0095] use Instead of V(s t+1 ), when executing step S31 and step S32 in a loop, the humanoid robot will select an action a according to the current state in each loop, and then update the Q value according to the following expression:
[0096]
[0097] Among them, s is the state of the robot in the environment space model, r is the immediate reward and punishment feedback of the environment to the system, and a t is the action selected at time t from the action set of a series of actions.
[0098] By continuously updating the iterative Q value until the training requirements are met, that is, to ensure that the trajectory tracking error e is obtained in each training iWithin a certain range.
[0099] S34: Integrate the data obtained in step S33 to obtain a gait training data set for robot lower limb reinforcement learning, and input the optimal gait parameters in the gait training data set into the robot controller.
[0100] The data obtained from each training session are integrated and compared, and the optimal parameters are selected as the optimal gait parameters and input into the robot controller, making the robot gait planning more accurate, thus enabling accurate tracking of the robot gait.
[0101] In one embodiment, the controller design method comprises the following steps:
[0102] S201: Considering the uncertainty of the mechanical system, a dynamic model of the lower limbs of the humanoid robot is established, including the following formula:
[0103]
[0104] Where t represents time, p represents the angular displacement of the joint, and p∈R n , is the angular velocity of the robot system, is the angular acceleration of the robot system, ε(t)∈Σ is the uncertainty of the mechanical system, which is time-varying and bounded τ(t) represents the input torque of the joint, H(·)∈R n represents the inertia matrix, C(·) represents the Coriolis force and centrifugal force matrix, F(·) is the friction and external disturbance matrix, and G(·) is the gravity term matrix.
[0105] S202: Based on the UK equation and according to Lagrange's theorem, a motion model of a general constraint system without uncertainty is established, which specifically includes the following formula:
[0106]
[0107] Where p=[p1,p2,…,p n ] T , represents the generalized coordinates, H(p,t)∈R n , represents the symmetric positive definite inertia matrix of the system, represents the generalized active force matrix used to free the system from constraints.
[0108] S203: Without considering friction, establishing an explicit motion model of the constrained robot system according to the servo constraints in the robot system.
[0109] First, write the constraint equation into matrix form, specifically:
[0110] E(p,t)=a(p,t)
[0111] Where E=[E ji ] m×n ,a=[a1,a2,…,a m ] m×n , the first-order form of this matrix can be used to calculate the second-order performance of the servo constraint. The whole process is as follows.
[0112] When considering the servo constraint, the formula transforms to the following state:
[0113]
[0114] Among them, j=1,…,m, m≤n.
[0115] Deriving equation 1 with respect to time t and taking into account the incomplete constraints, we get the following equation:
[0116]
[0117] By continuing to differentiate Equation 2 with respect to time t, we can obtain:
[0118]
[0119] Rewrite equation 3 as:
[0120]
[0121] This gives us the second-order form of the constraint equation.
[0122] We summarize and organize the above formula and finally get the following constraint equation:
[0123]
[0124] Therefore, the explicit motion model of the constrained system is:
[0125]
[0126] in, is the constraint force matrix and drives the system to satisfy the given constraints, represents the generalized active force matrix used to free the system from constraints.
[0127] S204: In the absence of constraint forces in the absence of uncertainty, a constraint force model is established based on the Gaussian principle and the Lagrangian form of the D'Alembert principle.
[0128] First, assume that for any (p,t)∈R n×R, ε(t)∈Σ and H(p,ε,t)>0 hold. According to the Udwadia-Kalaba method, the humanoid robot dynamics model must satisfy constraint equation 4. Therefore, additional constraints are required:
[0129]
[0130] Where A is the constraint equation, is the constraint force matrix, t represents time, “+” is the generalized inverse matrix, p represents the angular displacement of the joint, and p∈R n , is the angular velocity of the robot system, H(·)∈R n represents the inertia matrix, C(·) represents the Coriolis force and centrifugal force matrix, F(·) is the friction and external disturbance matrix, and G(·) is the gravity term matrix.
[0131] S205: Design a robust controller based on the constraint model.
[0132] Decompose H, C, and G in the dynamic model of the humanoid robot's lower limbs into nominal parts and the uncertain part They are all continuous, so:
[0133]
[0134] Transform and substitute the above formula to get:
[0135] H -1 (p,ε,t)=D(p,t)+ΔD(p,ε,t)
[0136] ΔD(p,ε,t)=D(p,t)K(p,ε,t)
[0137] Assume that the matrix D(p,t) is full rank. According to this condition, for any P∈R n×n , P>0, so
[0138]
[0139] Here exists For any (p,t)∈R n ×R, yes
[0140]
[0141] Among them, A is the constraint equation, min(·) represents the minimum number, λ m (·) represents the minimum eigenvalue. Since the uncertainty bound is unknown, the constant is also unknown. When there is no uncertainty in the system, K=0,W=0, so You can choose.
[0142] Based on the above analysis, the robust controller designed in step S205 is as follows:
[0143]
[0144] Specifically, y1, y2, and y3 are the control items of the robust controller, and their calculation methods are shown in the following formulas:
[0145]
[0146] Where H(·)∈R n represents the inertia matrix, t represents time, p represents the angular displacement of the joint, is the angular velocity of the robot system, is the constraint matrix, P is the given parameter matrix of the proposed controller, and P>0, k is the gain coefficient, and ε is the size of the bounded radius of uncertainty.
[0147] also,
[0148]
[0149] Select the formula ρ(·):R n ×R n ×R→R + , we get the following formula:
[0150]
[0151] Figure 2 The simulation results of tracking accuracy and stability under different algorithm controllers are given. and The effect of (CFIC) when acting together, and The effect of the combined effect (NRC) and the error diagram when PID is applied.
[0152] from Figure 2 It can be known that the gait planning method described in this embodiment is used to establish a controller, which can greatly control the angular displacement error of the robot system and ensure the accuracy of the robot's gait following during movement.
[0153] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A robot gait planning algorithm based on neural network and reinforcement learning, characterized in that: The following steps are involved: S1: Establish an action network and an evaluation network, and establish a reinforcement learning objective function model based on the current state of the robot and the parameters of the robot controller; S2: Get the instant reward value during the change of environment state after executing the action under the current strategy; S3: Update the reward value through the action network and the evaluation network to obtain the optimal gait parameters, and input the parameters into the robot controller; S201: Establish the dynamic model root of the robot lower limb according to the uncertainty of the robot system parameters; S202: Based on the UK equation and according to Lagrange's theorem, a motion model of a general constraint system without uncertainty is established; S203: establishing an explicit motion model of the constrained robot system according to the servo constraints in the robot system without considering the friction force; S204: In the absence of constraints in the absence of uncertainty, the constraint model is established based on the Gaussian principle and the Lagrangian form of the D'Alembert principle; S205: Design a robust controller based on the constraint model; The dynamic model of the robot's lower limbs in step S201 is as follows: Where t represents time, p represents the angular displacement of the joint, and p∈R n , is the angular velocity of the robot system, is the angular acceleration of the robot system, ε is a bounded quantity of uncertainty, τ(t) represents the input torque of the joint, H(·)∈R n represents the inertia matrix, C(·) represents the Coriolis force and centrifugal force matrix, F(·) is the friction force and external disturbance matrix, and G(·) is the gravity term matrix; The motion model of the general constraint system without uncertainty in step S202 is as follows: Where p=[p1,p2,…,p n ] T , represents the generalized coordinates, H(p,t)∈R n , represents the symmetric positive definite inertia matrix of the system, represents the generalized active force matrix used to free the system from constraints; The explicit motion model of the constrained system in step S203 is: in, is the constraint force matrix and drives the system to satisfy the given constraints, represents the generalized active force matrix used to free the system from constraints; The constraint force model in step S204 is as follows: in, is the constraint matrix, t represents time, "+" represents the generalized inverse matrix, A represents the constraint equation, p represents the angular displacement of the joint, and p∈R n , is the angular velocity of the robot system, H(·)∈R n represents the inertia matrix, C(·) represents the Coriolis force and centrifugal force matrix, F(·) is the friction force and external disturbance matrix, and G(·) is the gravity term matrix; The robust controller designed in step S205 is as follows: Where A is the constraint equation, H(·)∈R n represents the inertia matrix, t represents time, p represents the angular displacement of the joint, is the angular velocity of the robot system, is the constraint matrix, P is the given parameter matrix of the proposed controller, and P>0, k is the gain coefficient, and ε is the size of the bounded radius of uncertainty.
2. The robot gait planning algorithm based on neural network and reinforcement learning according to claim 1, characterized in that: The step S1 comprises the following steps: S11: Establishing an action network and an evaluation network, and obtaining the environmental information around the robot, the initial position and posture of the robot's lower limbs through the camera module; S12: Obtain the parameters of the robot controller through the action network; S13: The current state of the robot is obtained through the information acquisition module, and combined with the parameter vector of the robot to establish an objective function model of reinforcement learning.
3. The robot gait planning algorithm based on neural network and reinforcement learning according to claim 2, characterized in that: The objective function model includes the following formula: Among them, β is the behavior strategy, γ∈(0,1) is the discount factor, and x t is the current state vector of the robot, λ t is the parameter vector of the controller.
4. The robot gait planning algorithm based on neural network and reinforcement learning according to claim 3, characterized in that: The step S2 comprises the following steps: S21: Scan and establish a spatial environment model near the robot through a camera module; S22: Return the distance information of the nearest obstacle to the robot through the direction sensor, and establish the robot's environmental state space model according to the distance information; S23: When the robot performs actions according to the behavioral strategy, the robot's environmental state changes and returns the reward value obtained during the change.
5. The robot gait planning algorithm based on neural network and reinforcement learning according to claim 4, characterized in that: The robot's environmental state space model includes the following formula: s j =(d1,……,d i ,β) Among them, d i It represents the distance of the obstacle closest to the robot returned by the i-th sensor, and β is the distance from the robot to the obstacle.
6. The robot gait planning algorithm based on neural network and reinforcement learning according to claim 4, characterized in that: The step S3 comprises the following steps: S31: Input the robot's state vector into the action network, and output the controller parameter vector through the action network; S32: Input the state vector and the controller parameter vector into the evaluation network to obtain the maximum reward value; S33: cyclically executing step S31 and step S32 until the trajectory tracking error is within a preset range; S34: Integrate the data obtained in step S33 to obtain a gait training data set for robot lower limb reinforcement learning, and input the optimal gait parameters in the gait training data set into the robot controller; The reward value is represented by an action value function.
