Legged robot planning and control method and device, robot, and storage medium

By constructing foot dynamics and discrete collision models, planning the trajectory of a collision-aware swinging leg, and implementing full-body control, the collision problem of legged robots in high-dynamic motion is solved, improving motion stability and hardware lifespan.

CN117572768BActive Publication Date: 2026-11-24TSINGHUA UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311511514.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2026-11-24
Estimated Expiration
2043-11-13

AI Technical Summary

Technical Problem

In existing technologies, the collision problem of legged robots during high-dynamic movements has not been effectively solved, resulting in severe hardware wear and short service life. Furthermore, the control algorithm suffers from trajectory errors and large impact forces, affecting motion stability.

Method used

By constructing a foot dynamics model and a discrete collision model, a collision-aware swing leg trajectory is planned and controlled throughout the body. The control strategy is optimized to reduce impact and improve movement stability.

Benefits of technology

It reduces the impact of the foot colliding with the ground, extends the lifespan of the robot hardware, and improves the stability of its movement.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117572768B_ABST
    Figure CN117572768B_ABST
Patent Text Reader

Abstract

This application relates to the field of robotics, and particularly to a method, device, robot, and storage medium for planning and controlling a legged robot. The method includes: determining the foot-end reference state of each leg based on the robot's motion state and the swing parameters of each leg at the next moment; for a leg that will begin swinging at the next moment, planning a collision-aware swinging leg trajectory based on a foot-end dynamics model and a discrete collision model; and performing whole-body control of the legged robot based on the motion state, reference state sequence, and foot-end reference state. Specifically, for legs that are planned as support legs and are not touching the ground, collision-aware whole-body control is performed based on a whole-body dynamics model and a discrete collision model. This solves the problems in related technologies, such as limited passive flexible buffering for collisions in legged robots, high computational load in algorithm control, low control accuracy, resulting in high wear and tear on robot hardware, short service life, and inability to meet practical needs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of robotics technology, and in particular to a method, apparatus, robot, and storage medium for planning and controlling a legged robot. Background Technology

[0002] Legged robots are developing rapidly, and many are no longer limited to static walking, but are evolving towards faster, more agile, more robust, safer, and more functional designs. However, the collision issue between the soles of the legs and the ground is a significant concern when legged robots perform highly dynamic movements.

[0003] In related technologies, legged robots can be adjusted from both hardware and control algorithm perspectives. On the hardware side, flexible footpads can be installed on the robot's feet, or spring-damped buffer devices can be installed at the robot's drive joints. Alternatively, VIA (Variable Impedance Actuators) or VSA (Variable Stiffness Actuators) can be used to provide the desired passive mechanical impedance, achieving a mechanical change in joint impedance and thus adjusting the buffering effect according to actual needs. On the control algorithm side, the contact velocity between the foot and the ground can be kept close to zero during motion planning.

[0004] However, the related technologies have certain shortcomings: In terms of hardware, the introduction of materials affects the robot system's response frequency, and because the stiffness, damping, and inertia characteristics of the materials are fixed, the buffering effect cannot be adjusted according to actual needs; the overall structure using VIA or VSA is too complex, with large size and weight, making it difficult to apply such actuators to legged robots requiring high-dynamic motion. Regarding control algorithms, when legged robots perform high-dynamic motion, the actual trajectory of the swinging leg may deviate significantly from the planned trajectory, causing the sole to touch the ground prematurely or delayed, potentially generating huge impact forces, leading to joint drift and accelerated hardware aging. Summary of the Invention

[0005] This application provides a method, device, robot, and storage medium for planning and control of a legged robot, in order to solve the problems in related technologies such as limited passive flexible buffering for collisions in legged robots, large computational load and low control accuracy of algorithm control, resulting in high wear and tear on robot hardware and short service life, which cannot meet the needs of practical applications.

[0006] The first aspect of this application provides a method for planning and controlling a legged robot, comprising the following steps: acquiring motion commands and motion states of the legged robot; generating a reference state sequence of the legged robot and swing parameters for each leg at the next moment based on the motion commands and motion states; determining a foot reference state for each leg based on the motion states and swing parameters for each leg at the next moment; for a leg that starts swinging at the next moment, planning a swinging leg trajectory with collision awareness based on a foot dynamics model and a discrete collision model, so that the impact of premature collision is within the target constraint range; and performing whole-body control of the legged robot based on the motion states, the reference state sequence, and the foot reference states, wherein, for a leg that should be a supporting leg in the planning and that is not touching the ground, performing whole-body control with collision awareness based on a whole-body dynamics model and a discrete collision model, so that the impact of delayed collision is within the target constraint range.

[0007] Optionally, the foot dynamics model is:

[0008]

[0009] in, Let Λ be the linear acceleration of the l-th leg tip in inertial frame I. c,l Let h be the mass matrix in the operation space. c,l This term includes the Coriolis force, centripetal force, and gravity within the operating space. It is the torque τ that drives the joint. j The foot-end driving force mapped to the operating space; the discrete collision model is:

[0010]

[0011] in, It is the projection operator on the collision normal vector. It is the unit normal vector of the collision surface; These are the velocities of object 1 before and after the collision. These are the velocities of object 2 before and after the collision, c. r The coefficient of recovery.

[0012] Optionally, the step of planning the swing leg trajectory with collision awareness based on the foot dynamics model and the discrete collision model includes: obtaining pre-defined state variables and target constraints; constructing a continuous-time trajectory optimization problem for the leg that starts swinging at the next moment based on the foot dynamics model, the pre-defined state variables, and the target constraints; discretizing the continuous-time trajectory optimization problem to obtain a discrete-time trajectory optimization problem for the swing leg foot, and solving this problem to obtain the swing leg trajectory with collision awareness.

[0013] Optionally, the pre-defined state variables include one or more of the initial state of the swing leg foot tip, the landing state of the swing leg foot tip, the duration of the swing, and the expected maximum ground clearance of the swing leg foot tip. The target constraints include one or more of the following: state equation equality constraints, driving force inequality constraints, trajectory height inequality constraints, initial state equality constraints, terminal state equality constraints, collision awareness inequality constraints, and terminal velocity direction inequality constraints.

[0014] Optionally, the objective function of the continuous-time trajectory optimization problem is:

[0015]

[0016] in, and These are weight matrices with different dimensions (mostly diagonal matrices); ||a|| Q =a T Qa represents the weighted magnitude of vector a under the weight matrix Q; The task reflects the landing state of the swing leg's foot. and These are the known position and linear velocity of the swing leg's foot end point; It is the control variable (i.e., linear acceleration) that minimizes the entire oscillation process, t0 = 0, t F =T SW T SW The duration of the oscillation; This reflects the task of achieving the maximum height of the swing leg off the ground, t h1 and t h2 The two parameters specify the time period for reaching the maximum height, satisfying t0 ≤ t h1 ≤t h2 ≤t F ;z c This is the third component of the state variable, representing the height of the foot off the ground; the objective function of the discrete-time trajectory optimization problem of the swing leg foot is:

[0017]

[0018]

[0019] f min ≤Λ c u k +h c ≤f max k = 0, 1, ..., N-1

[0020] z c,min ≤S z x k ≤zc,max k = 1, 2, ..., N-1

[0021]

[0022]

[0023]

[0024]

[0025] in, It is a vector composed of control values ​​from each frame; These are diagonal weight matrices with different dimensions; current foot state (including position and velocity) feedback. Reference terminal foot state (including position and velocity) It is the selection matrix for the linear velocity of the foot tip; and The start and end frames for maintaining the swing height are manually specified, satisfying... k imp It is the starting frame for enabling collision awareness constraints and end-velocity direction constraints, satisfying 0≤k imp ≤N.

[0026] Optionally, the optimization problem of the whole-body control is:

[0027]

[0028] stlb j ≤C j χ≤ub j j = 1, 2, ..., n constraint ,

[0029] Among them, A i It is a task matrix, b i It is the task vector, C j It is a constraint matrix, lb j and ub j It constrains the lower and upper boundaries, W i Let n be the weight matrix. task n represents the number of tasks. constraint The number of constraints.

[0030] Optionally, the tasks processed simultaneously by the whole-body control include multiple tasks such as trunk trajectory tracking, foot trajectory tracking, plantar force tracking, minimizing joint torque variation, and minimizing plantar force variation; the constraints processed simultaneously by the collision-aware whole-body control include multiple constraints such as floating base dynamics equality constraints, plantar force inequality constraints, joint output torque saturation inequality constraints, joint rotational speed saturation inequality constraints, joint output power saturation inequality constraints, and collision awareness constraints.

[0031] Optionally, the step of performing whole-body control of the legged robot based on the motion state, the reference state sequence, and the foot reference state includes: if the planned leg is a swing leg, then setting the foot trajectory tracking task to track the trajectory of the swing leg with collision awareness, setting the target foot force of the foot force tracking task to a preset value, setting the foot force constraint in the foot force inequality constraint to a preset value, and disabling the collision awareness constraint; if the planned leg is a support leg and the support leg is in contact with the ground, then setting the target linear acceleration of the foot trajectory tracking task to a preset value, setting the target foot force of the foot force tracking task to the foot force provided by MPC (Model Predictive Control) or other modules, setting the foot force constraint to a friction cone constraint, and disabling the collision awareness constraint; if the planned leg is a support leg and the support leg is not in contact with the ground, then setting the target of the foot trajectory tracking task to track a velocity pointing towards an impact surface, setting the target foot force of the foot force tracking task to a preset value, setting the foot force constraint to a preset value, and enabling the collision awareness constraint.

[0032] Optionally, the whole-body dynamics model is:

[0033]

[0034] in, It is a generalized mass matrix. It includes the Coriolis force, centripetal force, and gravity. Indicates the output torque of the drive joint; 0 n×m Represents a zero matrix of size n×m; and F c These are, respectively, the augmented Jacobian matrix formed by stacking the contact Jacobian matrices of each supporting leg and the augmented plantar force formed by stacking the reaction forces of the ground on the soles of each supporting leg; q g For generalized joint spatial location, For generalized joint space velocity, Let be the generalized joint space acceleration; the expressions for the collision awareness constraint matrix and vector are:

[0035]

[0036]

[0037]

[0038] in, These are the lower and upper limits of the permissible collision impulse, which are specified manually, respectively, and δt represents the time interval between the current moment and the next moment.

[0039] A second aspect of this application provides a legged robot planning and control device, comprising: an acquisition module for acquiring motion commands and motion states of the legged robot; a generation module for generating a reference state sequence of the legged robot and swing parameters of each leg at the next moment based on the motion commands and motion states; a planning module for determining the foot reference state of each leg based on the motion states and the swing parameters of each leg at the next moment, and for a leg that starts swinging at the next moment, planning a swinging leg trajectory with collision awareness based on a foot dynamics model and a discrete collision model, so that the impact of premature collision is within the target constraint range; and a control module for performing whole-body control of the legged robot based on the motion states, the reference state sequence, and the foot reference states, wherein for a leg that should be a supporting leg in the planning and that is not touching the ground, performing whole-body control with collision awareness based on a whole-body dynamics model and a discrete collision model, so that the impact of delayed collision is within the target constraint range.

[0040] Optionally, the foot dynamics model of the legged robot planning and control device is as follows:

[0041]

[0042] in, Let Λ be the linear acceleration of the l-th leg tip in inertial frame I. c,l Let h be the mass matrix in the operation space. c,l This term includes the Coriolis force, centripetal force, and gravity within the operating space. It is the torque τ that drives the joint. j The foot-end driving force mapped to the operating space; the discrete collision model is:

[0043]

[0044] in, It is the projection operator on the collision normal vector. It is the unit normal vector of the collision surface; These are the velocities of object 1 before and after the collision. These are the velocities of object 2 before and after the collision, c. r The coefficient of recovery.

[0045] Optionally, the planning module is further configured to: obtain pre-defined state variables and target constraints; construct a continuous-time trajectory optimization problem for the leg that begins to swing at the next moment based on the foot dynamics model, the pre-defined state variables, and the target constraints; discretize the continuous-time trajectory optimization problem to obtain a discrete-time trajectory optimization problem for the swinging leg foot; and solve this problem to obtain the trajectory of the swinging leg with collision awareness.

[0046] Optionally, the pre-defined state variables of the planning module include one or more of the initial state of the swing leg foot, the landing state of the swing leg foot, the duration of the swing, and the expected maximum ground clearance of the swing leg foot. The target constraints include one or more of the following: state equation equality constraints, driving force inequality constraints, trajectory height inequality constraints, initial state equality constraints, terminal state equality constraints, collision awareness inequality constraints, and terminal velocity direction inequality constraints.

[0047] Optionally, the objective function of the continuous-time trajectory optimization problem of the planning module is:

[0048]

[0049] in, and These are weight matrices with different dimensions (mostly diagonal matrices); ||a|| Q =a T Qa represents the weighted magnitude of vector a under the weight matrix Q; The task reflects the landing state of the swing leg's foot. and These are the known position and linear velocity of the swing leg's foot end point; It is the control variable (i.e., linear acceleration) that minimizes the entire oscillation process, t0 = 0, t F =T SW T SW The duration of the oscillation; This reflects the task of achieving the maximum height of the swing leg off the ground, t h1 and t h2 The two parameters specify the time period for reaching the maximum height, satisfying t0 ≤ t h1 ≤t h2 ≤t F z c This is the third component of the state variable, representing the height of the foot off the ground; the objective function of the discrete-time trajectory optimization problem of the swing leg foot is:

[0050]

[0051]

[0052] f min ≤Λ c u k +h c ≤f max k = 0, 1, ..., N-1

[0053] z c,min ≤S z x k ≤z c,max k = 1, 2, ..., N-1

[0054]

[0055]

[0056]

[0057]

[0058] in, It is a vector composed of control values ​​from each frame; These are diagonal weight matrices with different dimensions; current foot state (including position and velocity) feedback. Reference terminal foot state (including position and velocity) It is the selection matrix for the linear velocity of the foot tip; and The start and end frames for maintaining the swing height are manually specified, satisfying... k imp It is the starting frame for enabling collision awareness constraints and end-velocity direction constraints, satisfying 0≤k imp ≤N.

[0059] Optionally, the optimization problem for the whole-body control of the legged robot planning and control device is:

[0060]

[0061] stlb j ≤C j χ≤ub j j = 1, 2, ..., n constraint ,

[0062] Among them, A i It is a task matrix, b i It is the task vector, C j It is a constraint matrix, lb j and ub j It constrains the lower and upper boundaries, Wi Let n be the weight matrix. task n represents the number of tasks. constraint The number of constraints.

[0063] Optionally, the tasks processed simultaneously by the whole-body control include multiple tasks such as trunk trajectory tracking, foot trajectory tracking, plantar force tracking, minimizing joint torque variation, and minimizing plantar force variation; the constraints processed simultaneously by the collision-aware whole-body control include multiple constraints such as floating base dynamics equality constraints, plantar force inequality constraints, joint output torque saturation inequality constraints, joint rotational speed saturation inequality constraints, joint output power saturation inequality constraints, and collision awareness constraints.

[0064] Optionally, the step of performing whole-body control of the legged robot based on the motion state, the reference state sequence, and the foot reference state includes: if the planned leg is a swing leg, then setting the foot trajectory tracking task to track the trajectory of the swing leg with collision awareness, setting the target foot force of the foot force tracking task to a preset value, setting the foot force constraint in the foot force inequality constraint to a preset value, and disabling the collision awareness constraint; if the planned leg is a support leg and the support leg is in contact with the ground, then setting the target linear acceleration of the foot trajectory tracking task to a preset value, setting the target foot force of the foot force tracking task to the foot force provided by the MPC or other modules, setting the foot force constraint to a friction cone constraint, and disabling the collision awareness constraint; if the planned leg is a support leg and the support leg is not in contact with the ground, then setting the target of the foot trajectory tracking task to track a velocity pointing towards an impact surface, setting the target foot force of the foot force tracking task to a preset value, setting the foot force constraint to a preset value, and enabling the collision awareness constraint.

[0065] Optionally, the whole-body dynamics model of the legged robot planning and control device is as follows:

[0066]

[0067] in, It is a generalized mass matrix. It includes the Coriolis force, centripetal force, and gravity. Indicates the output torque of the drive joint; 0 n×m Represents a zero matrix of size n×m; and F c These are, respectively, the augmented Jacobian matrix formed by stacking the contact Jacobian matrices of each supporting leg and the augmented plantar force formed by stacking the reaction forces of the ground on the soles of each supporting leg; q g For generalized joint spatial location, For generalized joint space velocity, Let be the generalized joint space acceleration; the expressions for the collision awareness constraint matrix and vector are:

[0068]

[0069]

[0070]

[0071] in, These are the lower and upper limits of the permissible collision impulse, which are specified manually, respectively, and δt represents the time interval between the current moment and the next moment.

[0072] A third aspect of this application provides a legged robot, including: a memory, a processor, and a computer program stored in the memory and executable on the processor. The processor executes the program to implement the legged robot planning and control method as described in the above embodiments.

[0073] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which is executed by a processor to implement the legged robot planning and control method as described in the above embodiments.

[0074] Therefore, this application has at least the following beneficial effects:

[0075] This application embodiment can simplify the foot dynamics model and optimize the trajectory of the discrete collision model. It plans the swing process to address the problem of premature collision, ensuring that the impact of premature collision is within the target constraint range. At the same time, it can perform whole-body control on the legged robot's whole-body dynamics model and discrete collision model, and handle the problem of lag at the control stage, ensuring that the impact of lag collision is within the target constraint range. Because it considers both premature and lag collisions, this application embodiment can reduce the impact generated by the collision between the foot and the ground, reduce the impact of the collision, thereby improving the stability of the robot's motion state and extending the service life of the robot hardware.

[0076] Additional aspects and advantages of this application will be set forth in part in the description which follows, and in part will be obvious from the description, or may be learned by practice of this application. Attached Figure Description

[0077] The above and / or additional aspects and advantages of this application will become apparent and readily understood from the following description of the embodiments taken in conjunction with the accompanying drawings, wherein:

[0078] Figure 1 This is a flowchart illustrating a legged robot planning and control method according to an embodiment of this application;

[0079] Figure 2 This is a schematic diagram of a collision-aware gait control system for a quadruped robot according to an embodiment of this application.

[0080] Figure 3 This is a schematic diagram of a decision tree for collision-aware full-body control in an embodiment of this application.

[0081] Figure 4 This is an example diagram of a legged robot planning and control device according to an embodiment of this application;

[0082] Figure 5 This is a schematic diagram of the structure of a legged robot according to an embodiment of this application. Detailed Implementation

[0083] The embodiments of this application are described in detail below. Examples of these embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals denote the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are exemplary and intended to explain this application, and should not be construed as limiting this application.

[0084] In recent years, the field of legged robots has developed rapidly, with more and more mature and stable methods being applied to the motion planning and control of legged robots. Many research institutions are no longer limiting their legged robots to static walking, but are developing them towards faster, more agile, more robust, safer, and more functional directions. When legged robots perform high-dynamic movements, some problems that were negligible in low-dynamic situations become significant, such as the collision between the foot and the ground when the robot is running at high speed. The movement of a legged robot relies on the continuous switching of its supporting legs. Each step requires the foot to contact the ground, which is a purposeful collision with the environment and a common collision problem when legged robots interact with their environment. Inappropriate control strategies can cause violent collisions between the foot and the ground, affecting the robot's subsequent movement, causing it to lose balance, fall, or even shorten or damage the hardware's lifespan.

[0085] Among related technologies, solutions to the collision problem of legged robots can be proposed from two aspects: hardware and control algorithms.

[0086] In terms of hardware, options include installing flexible footpads on the robot's feet, or installing spring-damped buffers at the robot's drive joints. VIA or VSA can also be used. VIA and VSA can provide the desired passive mechanical impedance, achieving a change in joint impedance at the mechanical level, thus allowing for adjustment of the buffering effect according to actual needs. The practice of installing buffers on the robot is generally referred to as the passive compliance method.

[0087] In terms of control algorithms, to minimize the negative impact of foot-to-ground collisions on the robot's state during walking, the contact velocity between the foot and the ground can be kept close to zero during motion planning. When small or lightweight legged robots walk slowly on flat terrain, the controller's performance usually ensures that the actual trajectory of the swinging leg is basically consistent with the planned trajectory, resulting in good performance. When the terrain is uneven, visual sensors such as cameras or LiDAR can be used to estimate the terrain, and a foot motion trajectory with a contact velocity close to zero can be planned based on the estimated terrain, thereby avoiding collisions caused by premature or delayed ground contact.

[0088] However, the methods in the relevant technologies have certain limitations.

[0089] In terms of hardware, passive compliance methods can reduce the impact of collisions to some extent, but they also have some problems. First, the introduction of these passively compliant materials will affect the response frequency of the robot system. If the control algorithm does not take this effect into account, it is easy for the robot to generate unstable vibrations during movement. On the other hand, the buffering effect of passive compliance methods is limited. Once the material of the buffer device is determined, its stiffness, damping, and inertia characteristics are also determined, so the buffering effect cannot be adjusted according to actual needs. When using the VIA or VSA method, two motors can be used. One motor independently controls the mechanical stiffness of the joint, while the other motor generates torque. The overall structure is too complex, and the size and weight are large, making it difficult to apply such actuators to legged robots that need to perform high-dynamic movements.

[0090] In terms of control algorithms, when legged robots perform high-dynamic movements such as high-speed running, there may be significant errors between the actual trajectory of the swinging leg and the planned trajectory, resulting in premature or delayed ground contact. In cases of delayed ground contact, if the foot is not yet on the ground but is planned to support the torso, the leg will quickly slam into the ground, causing a violent collision and generating a huge impact force at the moment of impact. For heavy legged robots, the impact force from such collisions is often even greater. When legged robots run at high speeds, the violent impacts may cause joint drift, and frequent, long-term impacts on the foot may accelerate hardware aging.

[0091] In summary, the control strategies in related technologies treat the impact force during a collision as a disturbance, focusing on the robot's balance control after the collision, while ignoring the impact of such frequent, purposeful collisions on the robot's hardware lifespan.

[0092] To address the problems mentioned in the background section, this application provides a legged robot planning and control method. The following description, with reference to the accompanying drawings, outlines the legged robot planning and control method, apparatus, robot, and storage medium according to embodiments of this application.

[0093] Specifically, Figure 1 This is a flowchart illustrating a legged robot planning and control method provided in an embodiment of this application.

[0094] like Figure 1 As shown, the planning and control method for this legged robot includes the following steps:

[0095] In step S101, the motion commands and motion state of the legged robot are acquired.

[0096] The driving commands can include user-inputted motion speed commands, direction commands, etc., and the motion states can include the robot's torso state, the state of each leg's foot end, and the bottoming state of each leg, etc.

[0097] It is understood that the embodiments of this application can use at least one method to acquire the motion commands and motion states of the legged robot; the actuators of the legged robots in the embodiments of this application are all motors with force control capabilities, and the sensors they have include IMU (Inertial Measurement Unit), motor angle encoder, motor torque sensor, etc., which will be used as the basis for the following embodiments.

[0098] For example, Figure 2 This is a block diagram of a collision-aware quadruped robot gait control system according to an embodiment of this application. This diagram is applicable to both simulation and physical implementations. The entire control framework mainly consists of five modules: State Estimator, Rough Planning, SRB-MPC (Single Rigid Body Model Predictive Control), IA-TO (Impact-aware Trajectory Optimization), and IA-WBC (Impact-aware Whole-body Control). The system operates at relatively high frequencies (e.g., 500Hz, 1kHz), with IA-WBC operating at the same frequency, SRB-MPC operating at around 40Hz, and the optimization problem in IA-TO calculated only once before each leg needs to swing. The following embodiments will use this system as an example for illustration.

[0099] Specifically, such as Figure 2 As shown, this embodiment of the application can estimate the torso state of a legged robot based on the read IMU data and motor state information. The IMU data may include three-dimensional Euler angles, three-dimensional angular velocity, and three-dimensional linear acceleration, etc. The motor state information may include motor rotation angle, speed, and feedback torque, etc. The torso state of the legged robot may include the torso's point position, posture unit quaternion, linear velocity, and angular velocity, etc. The state of each leg's foot end may include point position and linear velocity. This embodiment of the application can use an EKF (Extended Kalman Filter) to estimate the torso state, without specific limitations.

[0100] The state estimation in this application embodiment will transmit corresponding information according to different needs, such as Figure 2 As shown, for SRB-MPC, only the trunk state is transmitted; for IA-TO, the trunk state, the state of each leg's foot, and the joint state are transmitted; for IA-WBC, the trunk state, the state of each leg's foot, the joint state, and the ground contact state of each leg are transmitted; for the coarse planning module, the trunk state and the state of each leg's foot can be transmitted. The above transmission process will be specifically described in the following embodiments, and will not be repeated here.

[0101] In step S102, a reference state sequence for the legged robot and the swing parameters of each leg at the next moment are generated based on the motion command and motion state.

[0102] The reference state sequence can be a series of references from the current moment to a future period of time; the reference state sequence can include the torso reference state sequence, the reference position sequence of the supporting leg foot end, the reference contact state sequence, and the MPC reference frame interval sequence, etc.; the swing parameters include the initial state of the swinging leg foot end (initial point position and linear velocity), the landing state (point position and linear velocity at landing), the duration of the swing, and the expected maximum height off the ground of the swinging leg foot end, etc.

[0103] It is understood that the embodiments of this application can use the acquired motion commands and motion states to generate a reference state sequence for the legged robot and the swing parameters of each leg at the next moment; the embodiments of this application can use at least one method to generate the reference state sequence and the swing parameters at the next moment, such as using the acquired information for motion planning, etc.

[0104] Specifically, such as Figure 2As shown, the coarse planning module can perform a rough motion plan for the quadruped robot based on the feedback information from the state estimation and the motion speed commands (including forward and backward walking speeds, left and right lateral translational speeds) and direction commands (i.e., yaw angular velocity) input by the user (e.g., via a remote controller). The coarse planning module needs to provide the SRB-MPC with a reference state sequence, where the number of reference state sequences is the same as the number of prediction frames of the SRB-MPC. The coarse planning module also needs to provide the IA-TO with the landing point position of each leg for the next swing, the swing duration, and the current reference contact state.

[0105] In step S103, the foot reference state of each leg is determined according to the motion state and the swing parameters of each leg at the next moment. For the leg that starts swinging at the next moment, the swinging leg trajectory with collision awareness is planned according to the foot dynamics model and discrete collision model, so that the impact of the collision is within the target constraint range.

[0106] It is understood that, in the embodiments of this application, the foot reference state of each leg can be determined based on the obtained motion state and the swing parameters of each leg of the leg robot at the next moment; when there is a leg that will start swinging at the next moment, the trajectory of the swinging leg is planned with collision awareness using the foot dynamics model and discrete collision model, so that the impact of the swinging leg after the collision is in advance is within the target constraint range.

[0107] It should be noted that due to factors such as slight ground undulations, errors in state estimation, and control errors, the swing leg of a legged robot may contact the ground before the planned landing time, which is called premature collision. This unexpected premature contact often leads to unexpected collision impacts. This problem can actually be solved in the planning stage, that is, by planning a collision-aware trajectory for the swing leg, so that even if a premature collision occurs, its impact is within the expected range. Therefore, the embodiments of this application can construct a trajectory optimization problem applicable to the swing leg of a legged robot. The robot dynamics model used is a linearized dynamics model of the swing leg in the operating space, and the discrete collision model is a discrete collision dynamics model. In this trajectory optimization problem, the prediction time window depends on the planned swing time of the leg, i.e., it is pre-specified. To enable the computer on the robot to perform trajectory optimization online, the corresponding optimization problem is designed as an easily solvable QP (Quadratic Programming) problem.

[0108] Specifically, such as Figure 2As shown, the coarse planning module can provide the IA-TO with the landing point position, swing duration, and current reference contact state for each leg's next swing. The IA-TO module receives feedback information from the state estimation and reference information provided by the coarse planning, generating a suitable reference state (including the reference point position and linear velocity) for each leg's foot end. The SRB-MPC module can solve an optimization problem in model predictive control based on the reference information provided by the coarse planning, obtaining the optimal trunk reference state and the optimal reference foot force, which are directly passed to the IA-WBC. The SRB-MPC can solve the optimization problem approximately every frame. When it does not need to solve the problem, its output is not updated, meaning the output data is zero-order preserved.

[0109] For the supporting leg, its reference state is to remain stationary on the ground; for the leg about to swing, a collision-aware trajectory optimization problem is solved; for the leg already swinging, the optimal solution of the trajectory optimization is interpolated to obtain the reference state at the current moment. The IA-TO module only performs trajectory optimization once before a leg needs to swing, and the computational load at other times is minimal. The IA-TO module ultimately passes the reference state of each leg's foot, along with the reference contact state provided by the rough planning, to the IA-WBC.

[0110] In this embodiment of the application, the trajectory of a swinging leg with collision awareness is planned based on the foot dynamics model and the discrete collision model, including: obtaining pre-defined state variables and target constraints; constructing a continuous-time trajectory optimization problem for the leg that starts swinging at the next moment based on the foot dynamics model, the pre-defined state variables and target constraints; discretizing the continuous-time trajectory optimization problem to obtain the discrete-time trajectory optimization problem of the swinging leg foot, and solving the problem to obtain the trajectory of the swinging leg with collision awareness.

[0111] The pre-specified quantities may include: the initial state of the swing leg's foot, including its initial position and linear velocity; the landing state of the swing leg's foot, including its landing position and linear velocity; and the duration of the swing. The expected maximum ground clearance of the swing leg foot

[0112] The predefined state variables in this application embodiment include one or more of the initial state of the swing leg foot, the landing state of the swing leg foot, the duration of the swing, and the expected maximum ground clearance of the swing leg foot. The target constraints include one or more of the following: state equation equality constraints, driving force inequality constraints, trajectory height inequality constraints, initial state equality constraints, terminal state equality constraints, collision awareness inequality constraints, and terminal velocity direction inequality constraints.

[0113] Understandably, each leg needs to solve a trajectory optimization problem before it begins to swing to obtain the optimal foot swing trajectory. Considering the limited computing power of actual robots, the trajectory optimization problem for the same leg is not solved repeatedly during the foot swing process. Since the expression for the trajectory optimization problem for each leg is not fundamentally different, for the sake of simplicity, this embodiment omits all subscripts l used to represent the leg numbers where there is no ambiguity.

[0114] Specifically, in the embodiments of this application, the acceleration of the swing leg's foot end line can be used as a control variable, that is... The state variables are chosen as the position and linear velocity of the foot tip, i.e. Based on this, the objective function, constraints, and discrete-time trajectory optimization problem of the embodiments of this application are described below:

[0115] I. Objective Function

[0116] In this embodiment of the application, the foot dynamics model is as follows:

[0117]

[0118] in, Let Λ be the linear acceleration of the l-th leg tip in inertial frame I. c,l The mass matrix h in the operation space c,l This term includes the Coriolis force, centripetal force, and gravity within the operating space. It is the torque τ that drives the joint. j The foot-end driving force mapped to the operating space; the process of obtaining the foot-end dynamic model in this embodiment of the application can be specifically as follows:

[0119] In this embodiment of the application, the position, linear velocity, and linear acceleration of the foot of the lth leg in inertial frame I can be set as follows: The dynamic equation of the foot in the operating space is:

[0120]

[0121] in, These are the torques τ that drive the joint. j The driving force of the foot and the reaction force of the ground on the foot after being mapped into the operating space (the latter only exists when in contact with the ground); while Λ c,l (q g Let be the mass matrix in the operation space. It includes the Coriolis force, centripetal force, and gravity in the operating space.

[0122] Considering that even when a legged robot performs dynamic movements, its swinging leg is mostly located within a certain range below the torso, the embodiments of this application can be considered that the range of leg configuration changes during a single swing is not particularly large, therefore Λ c,l (q g The nonlinear term can be approximated as independent of the configuration and treated as a constant matrix; experiments have shown that the nonlinear term... The changes during the leg swing are actually not significant and can be approximated as a constant vector.

[0123] Therefore, a simplified foot dynamics model can be obtained:

[0124]

[0125] Considering the sole of the l-th leg as object 1 and the ground as object 2, and taking into account that the mass of the ground is much greater than the mass of the robot, and that the ground's velocity is zero before and after the collision, the discrete collision model of this embodiment can be further obtained as follows:

[0126]

[0127] in, It is the projection operator on the collision normal vector. It is the unit normal vector of the collision surface; These are the velocities of object 1 before and after the collision. These are the velocities of object 2 before and after the collision; c r The coefficient of restitution is defined as follows:

[0128] In this embodiment of the application, the objective function of the continuous-time trajectory optimization problem is:

[0129]

[0130] in, and These are weight matrices with different dimensions (mostly diagonal matrices); ||a|| Q =a T Qa represents the weighted magnitude of vector a under the weight matrix Q; The task reflects the landing state of the swing leg's foot. and These are the known position and linear velocity of the swing leg's foot end point; It is the control variable (i.e., linear acceleration) that minimizes the entire oscillation process, t0 = 0, t F =T SW T SW The duration of the oscillation; This reflects the task of achieving the maximum height of the swing leg off the ground, t h1 and t h2 The two parameters specify the time period for reaching the maximum height, satisfying t0≤t h1 ≤t h2 ≤t F z c It is the third component of the state quantity, that is, the component in the state quantity that represents the height of the foot off the ground.

[0131] II. Constraints

[0132] (1) State equation equality constraints: Since the control variable is chosen as foot-end linear acceleration, the state equation is very easy to express; let

[0133]

[0134] The state equation of the system can then be written as:

[0135]

[0136] (2) Driving force constraint: Since the output torque of the actual actuator has a lower limit and an upper limit, the corresponding lower limit of the foot driving force in the operating space is... and upper limit Therefore, the driving force constraint can be written as:

[0137] f min ≤Λ c u(t)+h c ≤f max fort∈[t0,t F ].

[0138] (3) Trajectory Height Constraint: To prevent the optimized trajectory from being lower than the ground or higher than the desired maximum ground clearance, the trajectory height needs to be constrained, i.e.

[0139] z c,min ≤S z x(t)≤z c,max fort∈[t0,t F ],

[0140] in, These are the upper and lower limits of the trajectory height; It is the selection matrix used to select the third component of the state.

[0141] (4) Initial State Constraint: The initial state in the optimization of the swing leg foot trajectory should be the state just before the foot leaves the ground. Therefore, the initial state constraint is:

[0142]

[0143] in, These are the latest feedback point position and linear velocity of the swing leg foot end before solving the trajectory optimization problem.

[0144] (5) Terminal State Constraint: Although the objective function already reflects the terminal state task, it cannot guarantee that the optimized foot trajectory's end point will be at zero ground clearance, which could result in the trajectory end point either hanging in the air or plunging into the ground. Therefore, a terminal state constraint is needed, i.e.

[0145]

[0146] in, and These are the reference height at the end of the trajectory and the reference velocity in the vertical direction, respectively. and It is the corresponding selection matrix, i.e.

[0147]

[0148] It should be noted that the terminal state constraints in this application embodiment do not concern themselves with the horizontal component in the state. This is because, under a large number of constraints, the desired terminal state in the horizontal direction may not be achievable, and forcibly imposing horizontal terminal state constraints may lead to an unsolvable optimization problem.

[0149] (6) Collision Awareness Constraint: In order to ensure that the swing leg decelerates sufficiently to a safe speed before landing, the embodiments of this application may consider collision awareness constraints at the end of the trajectory: assuming the collision process starts from t c The time starts and continues until t c At time +δt, the process ends. Integrating both sides of the equation, we have:

[0150]

[0151] Since the robot's configuration remains almost unchanged immediately before and after the collision, that is... Meanwhile, the collision process is extremely brief, i.e., δt→0. At this point, the impulse from finite forces (such as gravity, Coriolis force, and centripetal force) disappears in this limit, leaving only the impulse generated by the collision; therefore, the above formula becomes as δt→0:

[0152]

[0153] in, Let represent the impulse exerted by the ground on the foot; substituting this equation into the discrete collision model yields the collision awareness constraint:

[0154]

[0155] in, These are the lower and upper limits of the permissible collision impulse, which are selected manually; t imp The time for activating collision awareness constraints is artificially selected, satisfying t0≤t imp ≤t F .

[0156] It is understandable that the collision awareness constraint formula can represent the moment just before the swing leg's foot lands, i.e., [t] imp ,t F If a collision occurs prematurely for some reason during this period, the impulse caused by the collision should be within the constraint range of this formula; however, this constraint cannot be activated throughout the entire swing, otherwise the entire swing process will be very slow and normal running motion will not be possible.

[0157] (7) Terminal velocity direction constraint: If the velocity direction of the swing leg foot just before landing is nearly horizontal, then due to errors in foot height control, the sole of the foot may touch the ground prematurely, causing the swing leg foot to not land at the planned landing point, which may affect the stability of the robot's center of mass. Therefore, embodiments of this application can design a terminal velocity direction constraint on the foot, so that the velocity direction of the swing leg foot before landing is controlled. The angle θ between the collision surface and the unit normal vector -n (the negative sign indicates the direction is inward) c Within a certain specified range, that is:

[0158]

[0159] in, This is the maximum allowable angle specified by the user. The above formula is a non-linear expression, which can be scaled to obtain a linear expression; based on the vector... Norm and The relationships between norms are:

[0160]

[0161] Therefore, we can obtain the rewritten version. All solutions that satisfy the rewritten equation also satisfy the original equation. Therefore, the rewritten equation can be used as the final velocity direction constraint for TO, and can be further written as:

[0162]

[0163] in, yes The various components; by traversing all cases within the absolute value sign, the above equation can be further written as eight equivalent inequalities, namely

[0164]

[0165] However, there is usually a short period of time before the swing leg lands. The first four lines in this formula are usually redundant, so the final velocity direction constraint can be simplified to:

[0166]

[0167] in,

[0168] III. Discrete-Time Trajectory Optimization Problem

[0169] It is understood that, in order to facilitate solving the above-mentioned continuous-time trajectory optimization problem in a computer, the embodiments of this application can also be discretized; wherein, the embodiments of this application can use at least one discretization method, for example, the integral term in the objective function can be replaced by a finite summation of terms, and the state equation constraints can be replaced by a Taylor expansion formula that ignores higher-order terms, etc.

[0170] In this embodiment, the swing process is assumed to be divided into N segments over time, i.e., a total of N frames, with a frame interval of Δt = T. sw / N. Let t k =t0+k(t) F -t0) / N, k=1,2,…,N, then x can be simply written as k =x(t) k ), u k =u(t) k The objective function for optimizing the discrete-time trajectory of the swing leg foot can be obtained as follows:

[0171]

[0172]

[0173] f min ≤Λ c u k +h c ≤f max k = 0, 1, ..., N-1

[0174] z c,min ≤S z x k ≤z c,max k = 1, 2, ..., N-1

[0175]

[0176]

[0177]

[0178]

[0179] in, It is a vector composed of control values ​​from each frame; These are diagonal weight matrices with different dimensions; current foot state (including position and velocity) feedback. Reference terminal foot state (including position and velocity) It is the selection matrix for the linear velocity of the foot tip; and The start and end frames for maintaining the swing height are manually specified, satisfying... k imp It is the starting frame for enabling collision awareness constraints and end-velocity direction constraints, satisfying 0≤k imp ≤N.

[0180] It is understandable that since many trajectory optimization problems in research are highly nonlinear and usually nonconvex, while some professional nonlinear solvers can find local optima for these trajectory optimization problems, they cannot guarantee finding the global optimum. The trajectory optimization problem in this application is a QP problem, which is a typical convex optimization problem. Therefore, as long as it has a non-empty solution set, the optimal solution found by the optimizer must be the global optimum.

[0181] The objective function of the aforementioned discrete-time trajectory optimization problem for the swing leg foot can be solved using some QP solvers. For example, in this embodiment, the open-source C++ library qpOASES can be used, but the QP problem needs to be converted into a standard form:

[0182]

[0183] stlb≤CU≤ub

[0184] After solving the above equation for the optimal solution, we only obtain the optimal control quantity U for N frames. * Furthermore, it is necessary to use this to obtain the optimal position and velocity trajectory. The above N lines of discrete dynamic equations can be written as linear expressions with respect to the initial state and optimization variables, i.e.

[0185]

[0186] in, And A QP and B QP They are:

[0187]

[0188] Therefore, U *Substituting the above linear expression, we can obtain the corresponding optimal position and velocity for N frames.

[0189] Since the subsequent control program may require the corresponding reference trajectory at any time, it is necessary to use interpolation to transform N discrete points into a continuous curve. In this application embodiment, at least one method can be used to implement interpolation. In order to maximize computational efficiency, the simplest linear interpolation can be used in this application embodiment.

[0190] For example, suppose that t has elapsed since the swing leg leaves the ground. sw Time, t sw ∈[0,T sw The nearest previous frame is the k-th frame, and the corresponding optimal position is... Using linear interpolation, the optimal reference position at this moment should be:

[0191]

[0192] Similarly, the corresponding optimal reference speed can be obtained.

[0193] It should be noted that this interpolation method cannot guarantee that the time integral of the velocity curve is the position curve. To achieve this, a higher-order interpolation function is required. Here, some interpolation accuracy is sacrificed simply to maximize computational efficiency.

[0194] In step S104, the legged robot is controlled in its entirety according to the motion state, reference state sequence and foot reference state. For the leg that should be a support leg in the plan and is not touching the ground, the robot is controlled in its entirety with collision awareness according to the whole-body dynamics model and discrete collision model, so that the effect of the delayed collision is within the target constraint range.

[0195] It is understandable that, such as Figure 2 As shown, the embodiments of this application can solve WQP (Weighted Quadratic Programming) and calculate the optimal joint torque command based on the feedback information of state estimation, the reference information of SRB-MPC and IA-TO modules, to perform whole-body control of the legged robot and handle the problem of delayed collision.

[0196] It should be noted that delayed collision refers to a situation where, due to certain reasons (such as slight undulations in the ground, errors in state estimation, and control errors), the foot has not yet made contact with the ground at the originally planned time. In this case, the contact with the ground will inevitably be later than the originally planned time. Without a suitable control strategy, this unexpected delayed collision can easily lead to unexpected collision impacts. The delayed collision problem is fundamentally different from the premature collision problem; that is, delayed collisions occur outside the planned swing process. It is impossible to accurately know the distance between the sole of the foot and the ground (which should be zero), nor can it determine when contact with the ground will occur (which should occur on time). Therefore, it needs to be effectively resolved in the control stage. Thus, based on the core idea of ​​one-step predictive control, this application embodiment can use a collision-aware WBC (Whole Body Control) method.

[0197] Specifically, the following embodiments will use a quadruped robot as an example to illustrate the WBC method of this application; wherein, collision awareness constraints are not always activated, and the task objectives and constraint settings for whole-body control are different under different circumstances. Therefore, the embodiments of this application can use a method such as Figure 3 The decision tree shown is used to express the whole-body control of collision awareness in this embodiment of the application as follows:

[0198] I. Whole-body control based on weighted quadratic programming

[0199] It is understandable that, in order to handle inequality constraints such as collision awareness constraints well, the implementation of whole-body control should choose an optimization-based method; at the same time, considering that the computing resources on actual robots are very limited and there are many programs that need to run simultaneously (such as communication, control algorithms, etc.), the embodiments of this application can adopt a whole-body control method based on WQP.

[0200] In this embodiment of the application, the optimization problem of whole-body control is:

[0201]

[0202] stlb j ≤C j χ≤ub j j = 1, 2, ..., n constraint ,

[0203] Among them, A i It is a task matrix, b i It is the task vector, C j It is a constraint matrix, lb j and ub j It constrains the lower and upper boundaries, W iLet n be the weight matrix. task n represents the number of tasks. constraint The number of constraints.

[0204] Understandably, in WQP, all tasks that need to be completed are defined using the term A. i χ-b i The form is expressed in the objective function, through the weight matrix W. i To adjust the relative priority of tasks; all constraints are expressed as lb. j ≤c j χ≤ub j For equality constraints, in the form of lb, it can be determined by letting lb... j =ub j To achieve this, in this embodiment, the optimization variable for WBC is selected as generalized joint space acceleration. The augmented plantar force F, which is the sum of the forces acting on the feet of the four legs, is generated by the combined forces acting on the feet. c ,Right now Where, n χ =n q +n F .

[0205] When the quadruped robot is standing upright, the whole-body dynamics model of the legged robot corresponding to the embodiments of this application is as follows:

[0206]

[0207] in, It is a generalized mass matrix. It includes the Coriolis force, centripetal force, and gravity. Indicates the output torque of the drive joint; 0 n×m Represents a zero matrix of size n×m; and F c These are, respectively, the augmented Jacobian matrix formed by stacking the contact Jacobian matrices of each supporting leg and the augmented plantar force formed by stacking the reaction forces of the ground on the soles of each supporting leg; q g For generalized joint spatial location, For generalized joint space velocity, This refers to the generalized joint space acceleration.

[0208] By solving the QP problem above, the optimal solution χ can be obtained. * By combining the complete dynamic equations, the optimal joint torque index can be easily calculated.

[0209]

[0210] in, It is the selection matrix for driving joints. and These are the generalized joint spatial position and velocity feedback provided by state estimation, respectively.

[0211] II. Task Settings

[0212] In this embodiment, the tasks processed simultaneously by the whole-body control include multiple tasks such as trunk trajectory tracking, foot trajectory tracking, plantar force tracking, minimizing joint torque variation, and minimizing plantar force variation; the constraints of the simultaneous processing of the whole-body control with collision awareness include multiple constraints such as floating base dynamics equality constraints, plantar force inequality constraints, joint output torque saturation inequality constraints, joint rotation speed saturation inequality constraints, joint output power saturation inequality constraints, and collision awareness constraints.

[0213] Specifically, (1) Torso tracking task: Torso trajectory tracking is a fundamental and indispensable task for enabling quadruped robots to move. In the embodiments of this application, a torso reference motion trajectory provided by MPC (Model Predictive Control) can be used, which includes the optimal reference point position of the torso in inertial frame I. Optimal reference linear velocity Optimal ZYX Euler Angles and the optimal reference angular velocity of the torso under floating base frame B

[0214] In WBC, PD control is first performed based on the optimal reference trajectory provided by MPC and the feedback state provided by state estimation to obtain the linear acceleration command of the torso in inertial frame I. and angular acceleration command in floating base frame B Then, design corresponding tasks to complete these instructions. The PD control is as follows:

[0215]

[0216]

[0217] in, These are the PD gain coefficient matrices, and they are both diagonal matrices. It is based on the ZYX Euler angles. Feedback on ZYX Euler Angles The calculated axis angle represents the attitude error.

[0218] because The first six rows correspond to the linear and angular accelerations of the floating base, therefore the corresponding matrices and vectors for the torso trajectory tracking task are written as follows:

[0219]

[0220]

[0221] (2) Foot trajectory tracking task: The foot trajectory tracking task is also a fundamental and indispensable task for quadruped robot locomotion. For the foot of the l-th leg, according to the kinematics of the acceleration level (excluding rotation), we have:

[0222]

[0223] Therefore, the matrix and vector corresponding to the foot trajectory tracking subtask of the l-th leg can be written as:

[0224]

[0225]

[0226] l = 1, 2, 3, 4

[0227] in, It is the linear acceleration command of the l-th leg's foot in inertial frame I. The command is different when the leg is in different states.

[0228] For example, when this leg is the supporting leg, the foot should be fixed to the ground and remain stationary. When it should have acted as a supporting leg but had not yet touched the ground (lagging contact), Differential control for tracking a velocity pointing towards the collision surface:

[0229]

[0230] in, It is a manually specified desired collision speed. It is the unit normal vector of the collision surface mentioned earlier, pointing outwards from the collision surface; when this leg is used as the swing leg... Derived from PD control:

[0231]

[0232] in, These are the PD gain coefficient matrices, and they are all diagonal matrices. The optimal reference point position and linear velocity of the swing leg foot end are calculated for the above embodiments.

[0233] It should be noted that the foot trajectory tracking subtasks of the four legs in this embodiment constitute the complete foot trajectory tracking task. Therefore, the corresponding matrices and vectors can be written as follows:

[0234]

[0235]

[0236] (3) Foot force tracking task: In addition to the influence of gravity, the linear momentum and angular momentum of the quadruped robot are also affected by the reaction force of the ground on the foot end (i.e., foot force); when performing high dynamic motion, the appropriate foot force is very important.

[0237] This application provides an embodiment of a method for optimizing plantar force using a single rigid body model (MPC), which has reference value. In this method, corresponding tasks need to be set up in WBC to complete the tracking of plantar force.

[0238] Since the quadruped robot used in this embodiment does not have force / torque sensors at its feet, it is difficult to implement plantar force feedback control in WBC. Therefore, the plantar force tracking task can only be set as a simple feedforward force task, and the corresponding matrices and vectors can be written as follows:

[0239]

[0240]

[0241] in, When the lth leg has made contact with the ground and is acting as the supporting leg, it should execute the reference plantar force provided by the MPC, therefore When this leg is a swing leg or, in the design, a supporting leg but has not yet touched the ground (i.e., delayed contact), the foot of this leg should not be subject to external forces.

[0242] (4) Minimize the change in joint torque: Since the actual motor force control bandwidth is limited, the output torque change is too drastic and cannot be achieved by the actual machine. When the actual motor cannot perform the action according to the optimal solution of WBC, the control error is easy to increase. Therefore, the embodiments of this application can take into account the "reduction of the change in joint torque" in WBC, so that the actual motor can more easily perform the action according to the optimal solution of WBC.

[0243] Let the optimal joint torque command calculated by WBC in the previous control cycle be... The matrix and vector for minimizing the joint torque change during this control cycle can be written as follows:

[0244]

[0245]

[0246] It should be noted that this task has a potential conflict with the aforementioned trunk trajectory tracking task, foot trajectory tracking task, and plantar force tracking task. Therefore, in this embodiment of the application, the weight of this task cannot be too large, otherwise it will affect the execution effect of the aforementioned tasks.

[0247] (4) Minimize the change in plantar force: In order to make the change in plantar force smoother (and thus make the change in the state of the center of mass smoother), the embodiments of this application can consider the task of “reducing the change in plantar force” in WBC.

[0248] Let the optimal plantar force calculated by WBC in the previous control cycle be... The matrix and vector for minimizing the change in plantar force during this control cycle can be written as follows:

[0249]

[0250]

[0251] It should be noted that, similarly, this task has a potential conflict with the aforementioned trunk trajectory tracking task, foot trajectory tracking task, and plantar force tracking task. Therefore, the weight of this task should not be too large, otherwise it will affect the performance of other tasks.

[0252] III. Constraint Settings

[0253] (1) Floating-base dynamics equality constraints: The torso of the quadruped robot does not have direct driving force and torque. Therefore, there is no joint output torque in the first 6 lines of the complete motion equation. These 6 lines are the floating-base dynamics equation, which are equality constraints that must be satisfied. The corresponding matrices and vectors are as follows:

[0254]

[0255]

[0256] in, It is the selection matrix of the floating basis.

[0257] (2) Foot force inequality constraint: To avoid relative sliding between the foot of the supporting leg and the ground, the ratio of the magnitude of the component of the foot force parallel to the contact surface to the magnitude of the component perpendicular to the contact surface should be less than the coefficient of friction, that is, the ratio of the foot force F of the l-th leg to the coefficient of friction should be less than the coefficient of friction. c,l The following constraints must be met to prevent slippage:

[0258] ||(I 3×3 -nn T )F c,l ||2≤μ|n T F c,l |,

[0259] Where μ is the coefficient of friction.

[0260] It is understandable that the above formula describes a conical interval, therefore this constraint to prevent foot slippage is also called a friction cone constraint; since the formula contains The norm is a nonlinear expression. In order to facilitate the solution of the WBC optimization problem, the embodiments of this application can simplify it.

[0261] The embodiments of this application can first linearize the equation, that is, replace the cone with a square pyramid; secondly, it is assumed that the quadruped robot usually walks on flat ground with a slope close to zero, so F can be... c,l The Z-axis component is considered as the component perpendicular to the contact surface; therefore, the above equation can be rewritten as:

[0262]

[0263] It should be noted that plantar force is the reaction force of the ground on the sole of the foot, therefore its Z-axis component is always greater than zero. To avoid hardware damage caused by optimizing for excessively large plantar forces, embodiments of this application can also adjust F... c,l The magnitude of the Z-axis component is restricted; therefore, the inequality constraint of the plantar force of the l-th leg can be written as:

[0264]

[0265] in, It is the maximum plantar force in the Z-axis direction, as specified by the user: when this leg is already the supporting leg. It is a pre-defined positive number; however, when this leg is a swing leg or is planned to be a supporting leg but has not yet landed (lagging landing), the plantar force of this leg should be zero, therefore it is set to... In this embodiment of the application, the above formula can also be equivalently expressed in matrix form, that is:

[0266] 0 5×1 ≤C F F c,l ≤ub F ,

[0267] in,

[0268] Finally, the plantar force constraints of all four legs combined constitute the complete plantar force inequality constraints, and the corresponding matrices and vectors can be written as follows:

[0269]

[0270] lb2=0 20×1 ,

[0271] (3) Joint Output Torque Saturation Inequality Constraint: Actual motor performance is limited; even in a stalled state, its output torque has an upper limit. The WBC needs to consider the actual motor's output torque limitations to better coordinate the joints and simultaneously complete multiple desired tasks. Therefore, the matrix and vector of the joint output torque saturation inequality constraint can be written as:

[0272]

[0273]

[0274]

[0275] Where, τ j,min ,τ j,max These are the lower and upper limits of the joint output torque, respectively.

[0276] (4) Joint speed saturation inequality constraint: Similar to the joint output torque saturation inequality constraint, even under no-load conditions, the actual motor speed has an upper limit. The actual motor speed limit must be considered in WBC in order to better coordinate the joints to complete multiple desired tasks at the same time.

[0277] By performing a Taylor expansion on the joint rotational speed at time t, and ignoring higher-order terms above the acceleration, the embodiments of this application can... Perform linear prediction:

[0278]

[0279] Within the same control cycle, the embodiments of this application can use the latest feedback joint speed. As the joint speed at the current moment And the joint acceleration in the optimization variables is used as the joint acceleration at the current moment. Therefore, the joint rotational speed at time t+δt can be linearly expressed using the above formula as the optimization variable. Thus, the corresponding matrices and vectors for the joint rotational speed saturation inequality constraint are as follows:

[0280]

[0281]

[0282]

[0283] in, These are the lower and upper limits of the joint rotation speed, respectively.

[0284] (5) Joint output power saturation inequality constraint: Similar to the joint output torque saturation inequality constraint, the actual motor output power also has an upper limit. The WBC must consider the actual motor output power limit in order to better coordinate the joints to complete multiple desired tasks simultaneously. Considering that the environment may also do work on the motor, the embodiments of this application do not constrain the joint input power, but only constrain the joint output power.

[0285] For the α-th joint, let its output torque be... Output speed is The output power of this joint is Let n j The output power of each joint is Then we have:

[0286]

[0287] Among them, the rotational speed of the joint can be used Substituting these values, the output torque of the joint can be linearly expressed using optimization variables. Therefore, the corresponding matrices and vectors for the joint output power saturation inequality constraint are as follows:

[0288]

[0289]

[0290]

[0291] in, It is the upper limit of the joint's output power.

[0292] (6) Collision awareness constraint: The idea of ​​collision awareness constraint in WBC is similar to that in TO, and the discrete collision model used is also the same, namely the discrete collision dynamics model.

[0293] Understandably, in WBC (Warp-Brain Collision), assuming the collision occurs in the next moment (i.e., time t+δt), this embodiment can first use the Taylor expansion formula to predict the linear velocity of the foot before the collision, then predict the sudden change in the foot's linear velocity caused by the collision, then predict the impulse caused by the collision, and finally constrain this impulse within the current control cycle. Thus, the joint acceleration optimized by WBC can make the linear velocity of the foot sufficiently small, so that if the collision does occur in the next moment, the impulse caused by the collision is within the collision awareness constraint range of WBC; if no collision occurs in the next moment, the robot exhibits a significantly reduced foot movement speed.

[0294] Specifically, for the l-th leg, the linear velocity of the forefoot end at time t+δt can be linearly predicted using the robot's kinematics and Taylor expansion formulas, with the joint acceleration among the optimization variables.

[0295]

[0296] Substituting the above equations into the discrete collision dynamics model and... The predicted sudden change in foot-base velocity caused by a collision can be linearly represented by the joint acceleration in the optimization variables.

[0297]

[0298] The predicted collision impulse ι is linearly represented by the joint acceleration in the optimization variables. c,l,next :

[0299]

[0300] Therefore, the collision awareness constraint is obtained, and its matrix and vector expressions are as follows:

[0301]

[0302]

[0303]

[0304] in, These are the lower and upper limits of the permissible collision impulse, which are specified manually, respectively, and δt represents the time interval between the current moment and the next moment.

[0305] Understandably, when a leg is planned to be a swing leg or has already made contact with the ground and become a supporting leg, this leg does not need collision awareness constraints; conversely, when this leg is planned to be a supporting leg but has not yet landed (i.e., delayed landing), this leg needs to activate the corresponding collision awareness constraints.

[0306] Specifically, the legged robot is controlled in its entirety based on its motion state, reference state sequence, and foot reference state. This includes: if the planned leg is a swing leg, then the foot trajectory tracking task is set to track the trajectory of a swing leg with collision awareness; the target foot force of the foot force tracking task is a preset value; the foot force constraint in the foot force inequality constraint is a preset value; and collision awareness constraint is disabled. If the planned leg is a support leg and the support leg is in contact with the ground, then the target linear acceleration of the foot trajectory tracking task is a preset value; the target foot force of the foot force tracking task is the foot force provided by the MPC or other modules; the foot force constraint is a friction cone constraint; and collision awareness constraint is disabled. If the planned leg is a support leg and the support leg is not in contact with the ground, then the target of the foot trajectory tracking task is set to track a velocity pointing towards an impact surface; the target foot force of the foot force tracking task is a preset value; the foot force constraint is a preset value; and collision awareness constraint is enabled.

[0307] Among them, the module that can provide the target plantar force for the plantar force tracking task may include the above-mentioned MPC module, etc.; the preset values ​​of the target plantar force, the plantar force constraint in the inequality constraint, and the target linear acceleration of the tracking task can be 0; in this embodiment, the preset value of 0 is used for explanation.

[0308] It should be noted that the embodiments of this application can further predict the impact of the collision in the joint space, such as predicting the impact of the collision on the joints by mapping the collision force onto each joint; however, generally, as long as the impulse caused by the collision is small enough in the operating space, the impact of the collision in the joint space will not be significant. In order to maximize the computational efficiency of WBC, the collision awareness constraint in the embodiments of this application is limited to the operating space, consistent with the trajectory optimization method in the above embodiments.

[0309] IV. Decision-making for Achieving Whole-Body Control

[0310] It is understood that in the WBC of this application embodiment, there are three unchanging task settings: trunk trajectory tracking task, minimizing joint torque change task, and minimizing plantar force change task; there are four unchanging constraint settings: floating base dynamics equality constraint, motor output torque saturation inequality constraint, motor output speed saturation inequality constraint, and motor output power saturation inequality constraint; the settings of other tasks and constraints are different under different conditions, namely, foot trajectory tracking task, plantar force tracking task, plantar force inequality constraint, and collision awareness constraint.

[0311] It should be noted that, as Figure 3As shown, when a leg is planned as a swing leg, if the WBC (Warfare Constraints) activates the corresponding collision awareness constraint when that leg is a swing leg, there are two scenarios: First, since the TO (Traffic Objective) already has a collision awareness constraint, the reference linear velocity of the leg's foot is already very small. In this case, the optimal solution optimized by WBC is not on the corresponding collision awareness constraint boundary, meaning the corresponding collision awareness constraint in WBC has no effect. The other scenario is that the optimal solution optimized by WBC is on the corresponding collision awareness constraint boundary, meaning the constraint takes effect, causing the leg's foot velocity to be lower than the reference linear velocity given by TO. This prevents the leg's foot from touching the ground at the time specified by TO, resulting in a delayed landing. Therefore, when a leg is planned as a swing leg, activating the collision awareness constraint for that leg in WBC either has no effect or has a negative impact; thus, the collision awareness constraint in WBC is only activated when a delayed landing occurs.

[0312] Furthermore, when a leg is planned to be the supporting leg but has not yet been detected to have made contact with the ground (i.e., delayed landing), the goal of the foot trajectory tracking task is to track a velocity -v pointing towards the impact surface. imp n, where v imp It shouldn't be set too small, otherwise the landing will be delayed for a long time; but there's no need to consider v. imp If the value is set too high, the impact velocity will be too great; collision awareness constraints can limit the velocity of the foot. Each leg of the legged robot in this embodiment can be limited according to... Figure 3 The decision tree shown is used to make judgments, thereby determining the expressions for all tasks and constraints, that is, determining the expression for WQP.

[0313] In summary, the legged robot planning and control method proposed in this application can simplify the foot dynamics model and optimize the trajectory of the discrete collision model. It can plan the early collision problem from the swinging process, ensuring that the impact of the early collision is within the target constraint range. Simultaneously, it can perform whole-body control on the legged robot's whole-body dynamics model and discrete collision model, handling the lag problem from the control stage, ensuring that the impact of the lag collision is within the target constraint range. Because both early and lag collisions are considered simultaneously, this application can reduce the impact of the foot colliding with the ground, reduce the impact of the collision, thereby improving the stability of the robot's motion state and extending the lifespan of the robot hardware.

[0314] Next, with reference to the accompanying drawings, a legged robot planning and control device according to an embodiment of this application is described.

[0315] Figure 4 This is a block diagram of a legged robot planning and control device according to an embodiment of this application.

[0316] like Figure 4 As shown, the legged robot planning and control device 10 includes: an acquisition module 100, a generation module 200, a planning module 300, and a control module 400.

[0317] The system comprises: an acquisition module 100 for acquiring motion commands and motion states of the legged robot; a generation module 200 for generating a reference state sequence and swing parameters for each leg at the next moment based on the motion commands and motion states; a planning module 300 for determining the foot reference state of each leg based on the motion states and swing parameters for each leg at the next moment, and for planning the trajectory of the swinging leg with collision awareness based on the foot dynamics model and discrete collision model, so that the impact of premature collision is within the target constraint range; and a control module 400 for performing whole-body control of the legged robot based on the motion states, reference state sequence, and foot reference states, wherein for legs that should be supporting legs in the planning and that are not touching the ground, whole-body control with collision awareness is performed based on the whole-body dynamics model and discrete collision model, so that the impact of delayed collision is within the target constraint range.

[0318] In this embodiment of the application, the foot dynamics model of the legged robot planning and control device is as follows:

[0319]

[0320] in, Let Λ be the linear acceleration of the l-th leg tip in inertial frame I. c,l The mass matrix h in the operation space c,l The term encompasses the Coriolis force, centripetal force, and gravity within the operating space, and is the torque τ that drives the joint. j Foot driving force mapped to the operating space; discrete collision model is:

[0321]

[0322] in, It is the projection operator on the collision normal vector. It is the unit normal vector of the collision surface; These are the velocities of object 1 before and after the collision. These are the velocities of object 2 before and after the collision, c. r The coefficient of recovery.

[0323] In this embodiment of the application, the planning module is further used to: obtain pre-defined state variables and target constraints; construct a continuous-time trajectory optimization problem for the leg that starts swinging at the next moment based on the foot dynamics model, the pre-defined state variables and target constraints; discretize the continuous-time trajectory optimization problem to obtain a discrete-time trajectory optimization problem for the swinging leg foot; and solve the problem to obtain the trajectory of the swinging leg with collision awareness.

[0324] In this embodiment of the application, the pre-defined state variables of the planning module include one or more of the initial state of the swing leg foot, the landing state of the swing leg foot, the duration of the swing, and the expected maximum ground clearance of the swing leg foot. The target constraints include one or more of the following: state equation equality constraints, driving force inequality constraints, trajectory height inequality constraints, initial state equality constraints, terminal state equality constraints, collision awareness inequality constraints, and terminal velocity direction inequality constraints.

[0325] In this embodiment, the objective function of the continuous-time trajectory optimization problem of the planning module is:

[0326]

[0327] in, and These are weight matrices with different dimensions (mostly diagonal matrices); ||a|| Q =a T Qa represents the weighted magnitude of vector a under the weight matrix Qa; The task reflects the landing state of the swing leg's foot. and These are the known position and linear velocity of the swing leg's foot end point; It is the control variable (i.e., linear acceleration) that minimizes the entire oscillation process, t0 = 0, t F =T SW T SW The duration of the oscillation; This reflects the task of achieving the maximum height of the swing leg off the ground, t h1 and t h2 The two parameters specify the time period for reaching the maximum height, satisfying t0 ≤ t h1 ≤t h2 ≤t F z c It is the third component of the state quantity, that is, the component in the state quantity that represents the height of the foot off the ground.

[0328] The objective function for optimizing the discrete-time trajectory of the swing leg foot is:

[0329]

[0330]

[0331] f min ≤Λ c u k +h c ≤f max k = 0, 1, ..., N-1

[0332] z c,min ≤s z x k ≤z c,max k = 1, 2, ..., N-1

[0333]

[0334]

[0335]

[0336]

[0337] in, It is a vector composed of control values ​​from each frame; These are diagonal weight matrices with different dimensions; current foot state (including position and velocity) feedback. Reference terminal foot state (including position and velocity) It is the selection matrix for the linear velocity of the foot tip; and The start and end frames for maintaining the swing height are manually specified, satisfying... k imp It is the starting frame for enabling collision awareness constraints and end-velocity direction constraints, satisfying 0≤k imp ≤N.

[0338] In this embodiment, the optimization problem of the whole-body control of the legged robot planning and control device is as follows:

[0339]

[0340] stlb j ≤C j χ≤ub j j = 1, 2, ..., n constraint ,

[0341] Among them, A i It is a task matrix, b i It is the task vector, C j It is a constraint matrix, lb j and ub jIt constrains the lower and upper boundaries, W i Let n be the weight matrix. task n represents the number of tasks. constraint The number of constraints.

[0342] In this embodiment, the tasks processed simultaneously by the whole-body control include multiple tasks such as trunk trajectory tracking, foot trajectory tracking, plantar force tracking, minimizing joint torque variation, and minimizing plantar force variation; the constraints of the simultaneous processing of the whole-body control with collision awareness include multiple constraints such as floating base dynamics equality constraints, plantar force inequality constraints, joint output torque saturation inequality constraints, joint rotation speed saturation inequality constraints, joint output power saturation inequality constraints, and collision awareness constraints.

[0343] In this embodiment, the legged robot is controlled in its entirety based on its motion state, reference state sequence, and foot reference state. This includes: if the planned leg is a swing leg, then the foot trajectory tracking task is set to track the trajectory of a swing leg with collision awareness; the target foot force of the foot force tracking task is a preset value; the foot force constraint in the foot force inequality constraint is a preset value; and collision awareness constraint is disabled. If the planned leg is a support leg and the support leg is in contact with the ground, then the target linear acceleration of the foot trajectory tracking task is a preset value; the target foot force of the foot force tracking task is the foot force provided by the MPC or other modules; the foot force constraint is a friction cone constraint; and collision awareness constraint is disabled. If the planned leg is a support leg and the support leg is not in contact with the ground, then the target of the foot trajectory tracking task is set to track a velocity pointing towards an impact surface; the target foot force of the foot force tracking task is a preset value; the foot force constraint is a preset value; and collision awareness constraint is enabled.

[0344] In this embodiment, the whole-body dynamics model of the legged robot planning and control device is as follows:

[0345]

[0346] in, It is a generalized mass matrix. It includes the Coriolis force, centripetal force, and gravity. Indicates the output torque of the drive joint; 0 n×m Represents a zero matrix of size n×m; and F c These are, respectively, the augmented Jacobian matrix formed by stacking the contact Jacobian matrices of each supporting leg and the augmented plantar force formed by stacking the reaction forces of the ground on the soles of each supporting leg; q g For generalized joint spatial location, For generalized joint space velocity, This refers to the generalized joint space acceleration.

[0347] The expressions for the collision awareness constraint matrix and vector are:

[0348]

[0349]

[0350]

[0351] in, These are the lower and upper limits of the permissible collision impulse, which are specified manually, respectively, and δt represents the time interval between the current moment and the next moment.

[0352] It should be noted that the foregoing explanation of the legged robot planning and control method embodiment also applies to the legged robot planning and control device of this embodiment, and will not be repeated here.

[0353] According to the legged robot planning and control device proposed in this application, the foot dynamics model can be simplified and the trajectory of the discrete collision model can be optimized. The problem of premature collision is planned from the swing process, so that the impact of premature collision is within the target constraint range. At the same time, the whole-body dynamics model and discrete collision model of the legged robot can be controlled, and the problem of lag is handled from the control link, so that the impact of lag collision is within the target constraint range. Since both premature and lag collisions are considered at the same time, the embodiments of this application can reduce the impact generated by the collision between the foot and the ground, reduce the impact of collision, thereby improving the stability of the robot's motion state and increasing the service life of the robot hardware.

[0354] Figure 5 This is a schematic diagram of the structure of a legged robot provided in an embodiment of this application. The legged robot may include:

[0355] The memory 501, the processor 502, and the computer program stored on the memory 501 and capable of running on the processor 502.

[0356] When the processor 502 executes the program, it implements the legged robot planning and control method provided in the above embodiments.

[0357] Furthermore, legged robots also include:

[0358] Communication interface 503 is used for communication between memory 501 and processor 502.

[0359] The memory 501 is used to store computer programs that can run on the processor 502.

[0360] The memory 501 may include high-speed RAM (Random Access Memory) memory, and may also include non-volatile memory, such as at least one disk storage.

[0361] If the memory 501, processor 502, and communication interface 503 are implemented independently, then the communication interface 503, memory 501, and processor 502 can be interconnected via a bus to complete communication between them. The bus can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, or an EISA (Extended Industry Standard Architecture) bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 5 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.

[0362] Optionally, in a specific implementation, if the memory 501, processor 502, and communication interface 503 are integrated on a single chip, then the memory 501, processor 502, and communication interface 503 can communicate with each other through an internal interface.

[0363] The processor 502 may be a CPU (Central Processing Unit), an ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement the embodiments of this application.

[0364] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the above-described legged robot planning and control method.

[0365] In the description of this specification, the references to terms such as "one embodiment," "some embodiments," "example," "specific example," or "some examples," etc., indicate that a specific feature, structure, material, or characteristic described in connection with that embodiment or example is included in at least one embodiment or example of this application. In this specification, the illustrative expressions of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in one or more embodiments or examples. Moreover, without contradiction, those skilled in the art can combine and integrate the different embodiments or examples described in this specification, as well as the features of different embodiments or examples.

[0366] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of that feature. In the description of this application, "N" means at least two, such as two, three, etc., unless otherwise explicitly specified.

[0367] Any process or method described in the flowchart or otherwise herein can be understood as representing a module, segment, or portion of code comprising one or N executable instructions for implementing custom logic functions or processes, and the scope of the preferred embodiments of this application includes additional implementations in which functions may be performed not in the order shown or discussed, including substantially simultaneously or in reverse order depending on the functions involved, as should be understood by those skilled in the art to which embodiments of this application pertain.

[0368] It should be understood that the various parts of this application can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, the N steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented using any one or a combination of the following techniques known in the art: discrete logic circuits having logic gates for implementing logical functions on data signals, application-specific integrated circuits (ASICs) having suitable combinational logic gates, programmable gate arrays (FPGAs), field-programmable gate arrays (FPGAs), etc.

[0369] Those skilled in the art will understand that all or part of the steps of the methods in the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, the program includes one or a combination of the steps of the method embodiments.

[0370] Although embodiments of this application have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting this application. Those skilled in the art can make changes, modifications, substitutions and variations to the above embodiments within the scope of this application.

Claims

1. A method for planning and controlling a legged robot, characterized in that, Includes the following steps: Acquire motion commands and motion status of the legged robot; The reference state sequence of the legged robot and the swing parameters of each leg at the next moment are generated based on the motion command and the motion state. Based on the motion state and the swing parameters of each leg at the next moment, the foot reference state of each leg is determined. For the leg that starts swinging at the next moment, the trajectory of the swinging leg with collision awareness is planned according to the foot dynamics model and the discrete collision model, so that the impact of the collision is within the target constraint range. The legged robot is controlled in its entire body according to the motion state, the reference state sequence and the foot reference state. If a leg is planned to be a supporting leg and the leg does not actually touch the ground, then the whole body control with collision awareness is performed according to the whole body dynamics model and the discrete collision model so that the effect of the delayed collision is within the target constraint range. The method of planning a swing leg trajectory with collision awareness based on a foot dynamics model and a discrete collision model includes: obtaining pre-defined state variables and target constraints; constructing a continuous-time trajectory optimization problem for the leg to start swinging at the next moment based on the foot dynamics model, the pre-defined state variables, and the target constraints; discretizing the continuous-time trajectory optimization problem to obtain a quadratic programming form of a discrete-time trajectory optimization problem for the swing leg foot; solving this problem before the swing begins at the next moment to obtain the swing leg trajectory with collision awareness; wherein, the pre-defined state variables include the initial state of the swing leg foot, the landing state of the swing leg foot, the duration of the swing, and the expected maximum ground clearance of the swing leg foot; wherein, the landing state includes: the point position and linear velocity at the time of landing; and the target constraints include state equation equality constraints, driving force inequality constraints, trajectory height inequality constraints, initial state equality constraints, terminal state equality constraints, collision awareness inequality constraints, and final velocity direction inequality constraints. The method of performing whole-body control of the legged robot based on the motion state, the reference state sequence, and the foot reference state includes: if the planned leg is a swing leg, then setting the foot trajectory tracking task to track the trajectory of a swing leg with collision awareness, setting the target foot force of the foot force tracking task to 0, setting the foot force constraint in the foot force inequality constraint to 0, and disabling the collision awareness constraint; if the planned leg is a support leg and the leg is in contact with the ground, then setting the target linear acceleration of the foot trajectory tracking task to 0, setting the target foot force of the foot force tracking task to the foot force provided by the MPC or other modules, setting the foot force constraint to the friction cone constraint, and disabling the collision awareness constraint; if the planned leg is a support leg and the leg is not in contact with the ground, then setting the target of the foot trajectory tracking task to track a normal velocity pointing towards the impact surface, setting the target foot force of the foot force tracking task to 0, setting the foot force constraint to 0, and enabling the collision awareness constraint.

2. The legged robot planning and control method according to claim 1, characterized in that, The foot dynamics model is as follows: , in, , for the first The foot of one leg is in an inertial frame linear acceleration in Let be the mass matrix in the operation space. This term includes the Coriolis force, centripetal force, and gravity within the operating space. It is the torque that drives the joint. The foot-driven force mapped into the operating space; The discrete collision model is as follows: , in, It is the projection operator on the collision normal vector. It is the unit normal vector of the collision surface; These are the velocities of object 1 before and after the collision. The coefficient of recovery.

3. The legged robot planning and control method according to claim 1, characterized in that, The objective function of the continuous-time trajectory optimization problem is: , in, , and These are weight matrices with different dimensions; Represents the weight matrix Lower vector The weighted modulus; The task reflects the landing state of the swing leg's foot. and These are the known position and linear velocity of the swing leg's foot end point; It is the control quantity that minimizes the entire oscillation process. , The duration of the oscillation; This reflects the task of achieving the maximum height of the swing leg off the ground. and The two parameters specify the time period for reaching the maximum height, satisfying... ; It is the third component of the state quantity, that is, the component in the state quantity that represents the height of the foot off the ground; The objective function for the discrete-time trajectory optimization problem of the swing leg foot end is: , in, It is a vector composed of control variables from each frame; , , These are diagonal weight matrices with different dimensions; the current foot state. Reference terminal foot state , It is the selection matrix for the linear velocity of the foot tip; and The start and end frames for maintaining the swing height are manually specified, satisfying... ; It is the starting frame for enabling collision awareness constraints and end-velocity direction constraints, satisfying... .

4. The legged robot planning and control method according to claim 1, characterized in that, The optimization problem of the whole-body control is: , , in, It is a task matrix. It is a task vector. It is a constraint matrix. and It constrains the lower and upper boundaries. This is the weight matrix. For the number of tasks, The number of constraints.

5. The legged robot planning and control method according to claim 1, characterized in that, The tasks processed simultaneously by the whole-body control include multiple tasks such as trunk trajectory tracking, foot trajectory tracking, plantar force tracking, minimizing joint torque variation, and minimizing plantar force variation; the constraints processed simultaneously by the collision-aware whole-body control include multiple constraints such as floating base dynamics equality constraints, plantar force inequality constraints, joint output torque saturation inequality constraints, joint rotation speed saturation inequality constraints, joint output power saturation inequality constraints, and collision awareness constraints.

6. The legged robot planning and control method according to claim 1, characterized in that, The whole-body dynamics model is as follows: in, It is a generalized mass matrix. It includes the Coriolis force, centripetal force, and gravity. This indicates the output torque of the drive joint; Indicates size is The zero matrix; and These are the augmented Jacobian matrix, which is formed by stacking the contact Jacobian matrices of each supporting leg, and the augmented plantar force, which is formed by stacking the reaction forces of the ground on the soles of each supporting leg. For generalized joint spatial location, For generalized joint space velocity, For generalized joint space acceleration; The expressions for the collision awareness constraint matrix and vector are as follows: in, These are the lower and upper limits of the permissible collision impulse, respectively, as specified by the user. It expresses the time interval between the current moment and the next moment.

7. A planning and control device for a legged robot, characterized in that, include: The acquisition module is used to acquire the motion commands and motion status of the legged robot. The generation module is used to generate a reference state sequence of the legged robot and the swing parameters of each leg at the next moment based on the motion command and the motion state. The planning module is used to determine the foot reference state of each leg based on the motion state and the swing parameters of each leg at the next moment. For the leg that starts swinging at the next moment, the module plans the swinging leg trajectory with collision awareness based on the foot dynamics model and discrete collision model, so that the impact of the collision is within the target constraint range. The control module is used to perform whole-body control of the legged robot based on the motion state, the reference state sequence and the foot reference state. If a certain leg is planned to be a supporting leg and the leg does not actually touch the ground, then the whole-body control with collision awareness is performed based on the whole-body dynamics model and the discrete collision model, so that the impact of the delayed collision is within the target constraint range. The planning module is further used to: obtain pre-defined state variables and target constraints; construct a continuous-time trajectory optimization problem for the leg that begins to swing at the next moment based on the foot dynamics model, the pre-defined state variables, and the target constraints; discretize the continuous-time trajectory optimization problem to obtain a quadratic programming form of a discrete-time trajectory optimization problem for the swinging leg foot; solve this problem before the swing begins at the next moment to obtain a swinging leg trajectory with collision awareness; wherein, the pre-defined state variables include the initial state of the swinging leg foot, the landing state of the swinging leg foot, the duration of the swing, and the expected maximum ground clearance of the swinging leg foot; wherein, the landing state includes: the point position and linear velocity at the time of landing; and the target constraints include state equation equality constraints, driving force inequality constraints, trajectory height inequality constraints, initial state equality constraints, terminal state equality constraints, collision awareness inequality constraints, and final velocity direction inequality constraints. The control module is further configured to: if the planned leg is a swing leg, then set the foot trajectory tracking task to track the trajectory of a swing leg with collision awareness, set the target foot force of the foot force tracking task to 0, set the foot force constraint in the foot force inequality constraint to 0, and disable the collision awareness constraint; if the planned leg is a supporting leg and the leg is in contact with the ground, then set the target linear acceleration of the foot trajectory tracking task to 0, set the target foot force of the foot force tracking task to the foot force provided by MPC or other modules, set the foot force constraint to the friction cone constraint, and disable the collision awareness constraint; if the planned leg is a supporting leg and the leg is not in contact with the ground, then set the target of the foot trajectory tracking task to track a normal velocity pointing towards the impact surface, set the target foot force of the foot force tracking task to 0, set the foot force constraint to 0, and enable the collision awareness constraint.

8. A legged robot, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, the processor executing the program to implement the legged robot planning and control method as described in any one of claims 1-6.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that, The program is executed by the processor to implement the legged robot planning and control method as described in any one of claims 1-6.