A method for generating a multi-gait controller for a legged robot and a computer-readable storage medium
By using reinforcement learning and long short-term memory networks to generate multi-gait controllers in the simulation environment, the problem of insufficient gait adjustment capabilities of quadruped robots in different environments is solved, and the robot can flexibly switch between multiple gaits. and adapt quickly.
Patent Information
- Application Number
- CN202111534719.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-15
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-12-15
AI Technical Summary
It is difficult to design a controller with the existing technology to enable a quadruped robot to automatically adjust its gait in different environments, resulting in insufficient adaptability of the robot to different environments.
By using the physics engine to establish a simulation environment, generate reference motion, and use reinforcement learning training, combined with long short-term memory neural network and policy gradient algorithm, optimize the reward function and generate a multi-gait controller, so that the robot can switch between different gaits. .
It realizes multi-gait control for the robot to quickly adapt in different environments, overcomes the problem that the controller in the existing technology is difficult to realize multiple gait movements, and improves the success rate of migration from simulation to the real thing.
Smart Images

Figure CN114460841B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field related to robot control, and in particular to a method for generating a multi-gait controller for a legged robot and a computer-readable storage medium. Background Art
[0002] The rhythm of the lifting and landing of different legs of legged creatures or robots during movement is called gait. Animals in nature will adopt different optimal gaits in different environments and movement speeds. As for quadrupedal movement, due to the large number of legs and the large and complex number of gaits, it is difficult to design a controller to control a quadrupedal robot to perform multiple different gaits. The controllers used in most robots at home and abroad can only control the movement of one gait, and it is difficult to achieve the effect of the robot automatically adjusting the gait according to the environment, resulting in insufficient adaptability of the robot to different environments. In view of the above problems, this application is proposed. Summary of the invention
[0003] The object of the present invention is to provide a method for generating a multi-gait controller for a legged robot and a computer-readable storage medium to solve the above-mentioned problems.
[0004] The present invention is achieved through the following technical solutions.
[0005] A method for generating a multi-gait controller for a legged robot according to the present invention comprises the following steps:
[0006] S1: Use any physics engine to build a simulation environment;
[0007] S2: Input initial parameters and use the function to generate reference motion;
[0008] S3: Perform reinforcement learning training in a simulation environment using an optimization algorithm, add a reward function, imitate the motion generated in step S2, take the difference between the actual motion of the robot and the reference motion in step S2 as one of the goals, and then output a controller.
[0009] Furthermore, several phases are used in the S2 step, each phase corresponds to the periodic motion of a leg, and each phase is generated in the same or different manner.
[0010] Furthermore, the function for generating the reference motion in step S2 is:
[0011]
[0012]
[0013]
[0014]
[0015]
[0016] where p i For the position of the feet, is the three-dimensional coordinate of the foot, is the phase, represents the step length, T is the period, β is the proportion of the ground time, v x , v y are all movement speeds, and h is the height of leg lifting.
[0017] Furthermore, the strategy of reinforcement learning training in step S3 is a long short-term memory neural network.
[0018] Furthermore, the optimization algorithm in step S3 is one of a policy gradient algorithm, Q-Learning or DQN.
[0019] Furthermore, the policy gradient algorithm includes a PPO or a TRPO algorithm.
[0020] Furthermore, the reward function in step S3 is the sum of the products of the motion state values of several robots and their weight coefficients.
[0021] Furthermore, the reward function is specifically r=w1r τ +w2r v +w3r j +w4r b +w s r h +w6r c , where w1-w6 are weights, r j is the deviation parameter between the actual state of the robot and the reference state generated in step S2, r τ To encourage the robot to save motor torque parameters, r v A parameter that encourages the robot's actual speed to follow the command speed, r b To encourage the robot to maintain a stable posture, r h To encourage the robot's body height to be stable at a certain value, r c Parameters that encourage the contact state of each foot of the robot with the ground to be the same as the contact state of the reference motion.
[0022] Furthermore, in the step S3, the size and mass, contact friction and delay of each component of the robot are randomized.
[0023] A computer-readable storage medium stores a computer program or a code set, and when the computer program or the code set is executed by a processor, the method for generating a multi-gait controller for a legged robot is implemented.
[0024] Beneficial effects of the present invention:
[0025] Since reinforcement learning has a large degree of randomness, it is easy to obtain a control algorithm with very unnatural motion. The present application can effectively avoid the problem of unnatural motion by generating a reference motion in step S2 and taking the difference between the actual motion of the robot and the reference motion as one of the targets in step S3.
[0026] The method of generating reference motion in step S2 is very simple. In the past, those skilled in the art believed that this simple geometric reference motion control effect was poor, and it was necessary to establish a simplified dynamic model for the robot and use a model-based control algorithm to obtain a high-quality controller. However, this controller is difficult to establish. The present application uses the motion of step S2 as a reference and combines it with step S3 to obtain a fast and agile controller, thereby overcoming the technical prejudice of those skilled in the art.
[0027] This application uses a long short-term memory network, which is a network structure that can fully mine the implicit information in time series data. For this problem, the long short-term memory network can use time series information to automatically identify the system characteristics of the robot during the robot's movement, so that the controller can be directly migrated from the simulation environment to the physical robot without additional debugging. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0029] The present invention is further described below in conjunction with the accompanying drawings and embodiments.
[0030] Figure 1 It is a flow chart of a method for generating a multi-gait controller for a legged robot according to the present invention. DETAILED DESCRIPTION
[0031] Combine the following Figure 1 The present invention is described in detail.
[0032] A method for generating a multi-gait controller for a legged robot according to the present invention comprises the following steps:
[0033] S1: Use any physics engine to build a simulation environment. For example, use the open source Bullet physics engine to build a fast simulation environment for multi-legged robots, including multiple sets of robot physical models and the physical properties of the surrounding environment. Multiple sets of robot sensor information are added to the simulation environment through plug-ins and displayed in a visual way.
[0034] S2: Input the initial parameters and use the function to generate the reference motion. The function to generate the reference motion is:
[0035]
[0036]
[0037]
[0038]
[0039]
[0040] where p i For the position of the feet, is the three-dimensional coordinate of the foot, is the phase, represents the step length, T is the period, β is the proportion of the ground time, v x , v y are all movement speeds, h is the leg-lifting height, and the initial parameters input in the S2 step include the robot's sensor data, control instructions, and phase information. The sensor data include the motor position and speed, the robot's posture, and the robot's center of mass speed. The control instructions include the target linear velocity and angular velocity. The phase information takes a quadruped robot as an example, which is 4 phases. Each phase corresponds to the periodic motion of a leg. During the working process, each phase continuously cycles from 0 to 2π, and the sin and cos functions are calculated simultaneously for the phase to obtain the final input quantity.
[0041] S3: Use optimization algorithms to conduct reinforcement learning training in a simulation environment. The complete reinforcement learning training includes the simulation environment, strategy (or controller, control algorithm, that is, the mathematical form from input to output), state space and action space (that is, the input and output of the strategy), reward function (or objective function) and optimization algorithm. Use the reinforcement learning method to repeatedly try and error in the simulation environment, and automatically determine the parameters through the optimization algorithm;
[0042] The optimization algorithm is specifically a policy gradient algorithm such as PPO or TRPO, and an algorithm such as Q-Learning or DQN may also be used. A reward function is added, and the reward function is the sum of the product of the motion state values of several robots and their weight coefficients. Preferably, the reward function is specifically r=w1r τ +w2rv +w3r j +w4r b +w5r h +w6r c , where w1-w6 are weights, r j is the deviation parameter between the actual state of the robot and the reference state generated in step S2, r τ To encourage the robot to save motor torque parameters, r v A parameter that encourages the robot's actual speed to follow the command speed, r b To encourage the robot to maintain a stable posture, r h To encourage the robot's body height to be stable at a certain value, r c To encourage the contact state between each foot of the robot and the ground to be the same as the contact state of the reference motion, thereby taking the difference between the actual motion of the robot and the reference motion in step S2 as one of the targets, and then outputting the controller;
[0043] The strategy for reinforcement learning training in step S3 is the long short-term memory neural network. This network structure can fully mine the implicit information in time series data. For this problem, the long short-term memory network can use time series information to automatically identify the system characteristics of the robot during the robot's movement, so that the controller can be directly migrated from the simulation environment to the physical robot without additional debugging.
[0044] S4: The controller obtained in step S3 is transferred to the physical robot. The controller outputs the target position of each joint of the robot, so as to realize the control of the robot, enable the robot to follow the speed instruction, move in the gait specified by the phase, and switch between multiple gaits.
[0045] Advantageously, in the step S3, the size and mass of each robot component, contact friction, delay and other parameters are randomized to simulate actual conditions such as hardware processing errors, ground conditions, system delays, etc., to enhance robustness and improve the success rate of migration from simulation to physical objects.
[0046] A computer-readable storage medium stores a computer program or a code set, and when the computer program or the code set is executed by a processor, the above-mentioned method for generating a multi-gait controller for a legged robot is implemented.
[0047] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology in this field to understand the content of the present invention and implement it, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for generating a multi-gait controller for a legged robot, characterized in that: The steps include: S1: Use any physics engine to build a simulation environment; S2: Input initial parameters and use the function to generate reference motion; S3: Perform reinforcement learning training in a simulation environment using an optimization algorithm, add a reward function, imitate the motion generated in step S2, the reward function includes a deviation weight between the actual state of the robot and the reference state in step S2, and then output a controller; In the step S2, a plurality of phases are used, each phase corresponds to the periodic motion of a leg, and each phase is generated in the same or different manner; The function for generating the reference motion in step S2 is: where p i For the position of the feet, is the three-dimensional coordinate of the foot, is the phase, represents the step length, T is the period, β is the proportion of the ground time, v x , v y are all movement speeds, and h is the height of leg lifting.
2. The method for generating a multi-gait controller for a legged robot according to claim 1, characterized in that: The strategy of reinforcement learning training in the S3 step is a long short-term memory neural network.
3. A method for generating a multi-gait controller for a legged robot according to claim 2, characterized in that: The optimization algorithm in step S3 is one of the policy gradient algorithm, Q-Learning or DQN.
4. The method for generating a multi-gait controller for a legged robot according to claim 3, characterized in that: The policy gradient algorithm includes a PPO or a TRPO algorithm.
5. The method for generating a multi-gait controller for a legged robot according to claim 4, characterized in that: The reward function in step S3 is the sum of the products of the motion state values of several robots and their weight coefficients.
6. The method for generating a multi-gait controller for a legged robot according to claim 5, characterized in that: The reward function is specifically r=w1r τ +w2r v +w3r j +w4r b +w5r h +w6r c , where w1-w6 are weights, r j is the deviation parameter between the actual state of the robot and the reference state generated in step S2, r τ To encourage the robot to save motor torque parameters, r v To encourage the robot's actual speed to follow the command speed parameter, r b To encourage the robot to maintain a stable posture, r h To encourage the robot's body height to be stable at a certain value, r c Parameters that encourage the contact state of each foot of the robot with the ground to be the same as the contact state of the reference motion.
7. A method for generating a multi-gait controller for a legged robot according to any one of claims 3 to 6, characterized in that: In the step S3, the size and mass, contact friction and delay of each component of the robot are randomized.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or a code set, and when the computer program or the code set is executed by a processor, the method for generating a multi-gait controller for a legged robot according to any one of claims 1 to 7 is implemented.
