TWO-WHEELED ROBOT CONTROL METHOD AND APPARATUS, MEDIUM, PROGRAM, AND ROBOT
20240184307 ยท 2024-06-06
Inventors
Cpc classification
G05D2109/13
PHYSICS
International classification
Abstract
A robot control method includes calculating an optimal feedback gain, an optimal variable matrix, and uncertainty according to a first state variable and a first feedback gain of a robot. The optimal variable matrix represents a degree of a gain that a motion state of the robot has on a control mode of the robot. The method further includes calculating an angle deviation matrix and a noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and a second state variable of the robot, obtaining a control torque of the robot according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix, and controlling the robot according to the control torque.
Claims
1. A robot control method comprising: calculating an optimal feedback gain, an optimal variable matrix, and uncertainty according to a first state variable and a first feedback gain of a robot, the optimal variable matrix representing a degree of a gain that a motion state of the robot has on a control mode of the robot; calculating an angle deviation matrix and a noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and a second state variable of the robot; obtaining a control torque of the robot according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix; and controlling the robot according to the control torque.
2. The method according to claim 1, wherein calculating the optimal feedback gain, the optimal variable matrix, and the uncertainty according to the first state variable and the first feedback gain of the robot includes: obtaining a j.sup.th variable matrix according to the first state variable and a (j+1).sup.th feedback gain, j being an integer and having an initial value of 0; determining a (j+2).sup.th feedback gain according to the (j+1).sup.th feedback gain; updating j to j+1, and repeating operations of obtaining the j.sup.th variable matrix and determining the (j+2).sup.th feedback gain until the j.sup.th variable matrix reaches convergence; in response to the j.sup.th variable matrix reaching convergence, determining the j.sup.th variable matrix as the optimal variable matrix, and determining the (j+1).sup.th feedback gain as the optimal feedback gain; and determining the uncertainty according to the optimal variable matrix, the optimal feedback gain, and the first state variable.
3. The method according to claim 2, wherein obtaining the j.sup.th variable matrix according to the first state variable and the (j+1).sup.th feedback gain includes: determining a first intermediate matrix, a second intermediate matrix, and a third intermediate matrix according to the first state variable; obtaining a first polynomial of an equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix; obtaining a second polynomial of the equation according to the (j+1).sup.th feedback gain and the first intermediate matrix; and solving the equation with the first polynomial being equal to the second polynomial to obtain the j.sup.th variable matrix.
4. The method according to claim 3, further comprising: determining a fourth intermediate matrix according to the first state variable; and in response to the second intermediate matrix, the third intermediate matrix, and the fourth intermediate matrix reaching full rank, performing operation of obtaining the first polynomial of the equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix.
5. The method according to claim 4, wherein: the first intermediate matrix includes a difference between a tensor product of the first state variable and the first state variable at a first moment and a tensor product of the first state variable and the first state variable at a second moment; the second intermediate matrix includes an integral of a tensor product of the first state variable and the first state variable between the first moment and the second moment; the third intermediate matrix includes an integral of a tensor product of the first state variable and a torque of the robot between the first moment and the second moment; and the fourth intermediate matrix includes an integral of the first state variable between the first moment and the second moment.
6. The method according to claim 1, wherein calculating the angle deviation matrix and the noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the second state variable includes: determining an actual state variable according to the second state variable; obtaining an error linear function according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the actual state variable; and obtaining the angle deviation matrix and the noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the error linear function.
7. The method according to claim 6, wherein obtaining the error linear function according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the actual state variable includes: determining a first intermediate matrix, a second intermediate matrix, and a third intermediate matrix according to the actual state variable; obtaining a first polynomial of an equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix; obtaining a second polynomial of the equation according to the actual state variable and the first intermediate matrix; and solving the equation with the first polynomial being equal to the second polynomial to obtain the error linear function.
8. The method according to claim 7, further comprising: determining a fourth intermediate matrix according to the actual state variable; and in response to the second intermediate matrix, the third intermediate matrix, and the fourth intermediate matrix reaching full rank, performing operation of obtaining the first polynomial of the equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix.
9. The method according to claim 8, wherein: the first intermediate matrix includes a difference between a tensor product of the actual state variable and the actual state variable at a first moment and a tensor product of the actual state variable and the actual state variable at a second moment; the second intermediate matrix includes an integral of a tensor product of the actual state variable and the actual state variable between the first moment and the second moment; the third intermediate matrix includes an integral of a tensor product of the actual state variable and a torque of the robot between the first moment and the second moment; and the fourth intermediate matrix includes an integral of the actual state variable between the first moment and the second moment.
10. The method according to claim 1, wherein obtaining the control torque of the robot according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix includes: obtaining a system compensation value according to the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix; and obtaining the control torque of the robot according to the optimal feedback gain, the second state variable, and the system compensation value.
11. A robot comprising: one or more memories storing one or more computer programs; and one or more processors configured to execute the one or more computer programs to: calculate an optimal feedback gain, an optimal variable matrix, and uncertainty according to a first state variable and a first feedback gain of the robot, the optimal variable matrix representing a degree of a gain that a motion state of the robot has on a control mode of the robot; calculate an angle deviation matrix and a noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and a second state variable of the robot; obtain control torque of the robot according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix; and control the robot according to the control torque.
12. The robot according to claim 11, wherein the one or more processors are further configured to execute the one or more computer programs to: obtain a j.sup.th variable matrix according to the first state variable and a (j+1).sup.th feedback gain, j being an integer and having an initial value of 0; determine a (j+2).sup.th feedback gain according to the (j+1).sup.th feedback gain; update j to j+1, and repeating operations of obtaining the j.sup.th variable matrix and determining the (j+2).sup.th feedback gain until the j.sup.th variable matrix reaches convergence; in response to the j.sup.th variable matrix reaching convergence, determine the j.sup.th variable matrix as the optimal variable matrix, and determining the (j+1).sup.th feedback gain as the optimal feedback gain; and determine the uncertainty according to the optimal variable matrix, the optimal feedback gain, and the first state variable.
13. The robot according to claim 12, wherein the one or more processors are further configured to execute the one or more computer programs to: determine a first intermediate matrix, a second intermediate matrix, and a third intermediate matrix according to the first state variable; obtain a first polynomial of an equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix; obtain a second polynomial of the equation according to the (j+1).sup.th feedback gain and the first intermediate matrix; and solve the equation with the first polynomial being equal to the second polynomial to obtain the j.sup.th variable matrix.
14. The robot according to claim 13, wherein the one or more processors are further configured to execute the one or more computer programs to: determine a fourth intermediate matrix according to the first state variable; and in response to the second intermediate matrix, the third intermediate matrix, and the fourth intermediate matrix reaching full rank, perform operation of obtaining the first polynomial of the equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix.
15. The robot according to claim 14, wherein: the first intermediate matrix includes a difference between a tensor product of the first state variable and the first state variable at a first moment and a tensor product of the first state variable and the first state variable at a second moment; the second intermediate matrix includes an integral of a tensor product of the first state variable and the first state variable between the first moment and the second moment; the third intermediate matrix includes an integral of a tensor product of the first state variable and a torque of the robot between the first moment and the second moment; and the fourth intermediate matrix includes an integral of the first state variable between the first moment and the second moment.
16. The robot according to claim 11, wherein the one or more processors are further configured to execute the one or more computer programs to: determine an actual state variable according to the second state variable; obtain an error linear function according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the actual state variable; and obtain the angle deviation matrix and the noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the error linear function.
17. The robot according to claim 16, wherein the one or more processors are further configured to execute the one or more computer programs to: determine a first intermediate matrix, a second intermediate matrix, and a third intermediate matrix according to the actual state variable; obtain a first polynomial of an equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix; obtain a second polynomial of the equation according to the actual state variable and the first intermediate matrix; and solve the equation with the first polynomial being equal to the second polynomial to obtain the error linear function.
18. The robot according to claim 17, wherein the one or more processors are further configured to execute the one or more computer programs to: determine a fourth intermediate matrix according to the actual state variable; and in response to the second intermediate matrix, the third intermediate matrix, and the fourth intermediate matrix reaching full rank, perform operation of obtaining the first polynomial of the equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix.
19. The robot according to claim 18, wherein: the first intermediate matrix includes a difference between a tensor product of the actual state variable and the actual state variable at a first moment and a tensor product of the actual state variable and the actual state variable at a second moment; the second intermediate matrix includes an integral of a tensor product of the actual state variable and the actual state variable between the first moment and the second moment; the third intermediate matrix includes an integral of a tensor product of the actual state variable and a torque of the robot between the first moment and the second moment; and the fourth intermediate matrix includes an integral of the actual state variable between the first moment and the second moment.
20. A non-transitory computer-readable storage medium storing one or more computer programs that, when executed by one or more processors, cause the one or more processors to: calculate an optimal feedback gain, an optimal variable matrix, and uncertainty according to a first state variable and a first feedback gain of a robot, the optimal variable matrix representing a degree of a gain that a motion state of the robot has on a control mode of the robot; calculate an angle deviation matrix and a noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and a second state variable of the robot; obtain control torque of the robot according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix; and control the robot according to the control torque.
Description
BRIEF DESCRIPTION OF THE DRAWINGS
[0009]
[0010]
[0011]
[0012]
[0013]
[0014]
[0015]
[0016]
[0017]
[0018]
[0019]
[0020]
[0021]
[0022]
DESCRIPTION OF EMBODIMENTS
[0023] To make the objectives, technical solutions, and advantages of this application clearer, the following further describes implementations of this application in detail with reference to the accompanying drawings.
[0024] In this application, a prompt interface and a pop-up window may be displayed or voice prompt information may be outputted before and during relevant data of a user is collected. The prompt interface, the pop-up window, or the voice prompt information are used for prompting the user that relevant data is collected currently. In this way, in this application, only after a confirmation operation performed by the user on the prompt interface or the pop-up window is acquired, a relevant step of obtaining the relevant data of the user starts, or otherwise (that is, in response to that the confirmation operation performed by the user on the prompt interface or the pop-up window is not acquired), the relevant step of the relevant data of the user ends, that is, the relevant data of the user is not obtained. In other words, in this application, all collected user data are collected with the consent and authorization of users. The collection, use and processing of relevant user data need to comply with the relevant laws, regulations and standards of relevant countries and regions.
[0025] In this disclosure, the phrases at least one of A, B, and C and at least one of A, B, or C both mean only A, only B, only C, or any combination of A, B, and C.
[0026] In the embodiments of this application, an example in which a two-wheeled robot is a wheel-legged two-wheeled robot is used for description.
[0027] The base 11 is provided with a controller of the two-wheeled robot. As shown in
[0028] The leg 12 is provided with a motor 121, and the motor 121 is configured to drive a wheel 122. In some embodiments, the leg 12 uses a five-bar linkage mechanism to enable the motor 111 and the motor 112 on the base 11 to drive the leg 12, and the leg 12 has no drive on a knee.
[0029] The leg 13 is provided with a motor 131, and the motor 131 is configured to drive a wheel 132. In some embodiments, the leg 13 uses a five-bar linkage mechanism to enable the motor 113 and the motor 114 on the base 11 to drive the leg 13, and the leg 13 has no drive on a knee.
[0030] The tail rod 14 is provided with a motor 141 and a motor 142. In some embodiments, the motor 141 is configured to drive a wheel 143. In some embodiments, the motor 142 is configured to adjust a form of the tail rod 14. For example, the tail rod 14 has a lifted state and a lowered state. During the tail rod 14 is in the lifted state, the wheel 143 is in a suspended state and not in contact with the ground, and during the tail rod 14 is in the lowered state, the wheel 143 is in contact with the ground. In some embodiments, the two-wheeled robot 100 may flexibly switches between a two-wheeled mode and a three-wheeled mode by adjusting a state of the wheel 143. In some embodiments, the wheel-legged two-wheeled robot may cross obstacles, jump, and flip. In some embodiments, a height of the wheel-legged two-wheeled robot is between 0.33 m to 0.7 m.
[0031]
[0032]
[0033] A two-wheeled robot 201 obtains sensor data, and generates a state estimator 202 according to the sensor data. In some embodiments, the state estimator 202 includes at least one of a linear speed, a pitch angular velocity, a base height, and a ground slope. The adaptive adjustment sub-system 203 generates a balance control policy according to the state estimator 202, and the balance control policy is used for controlling the two-wheeled robot 201 to maintain balance.
[0034] The control system 200 obtains a motion instruction 205. In some embodiments, the motion instruction 205 includes at least one of stepping forward, stepping backward, remaining stationary, jumping, adjusting the base height, and flipping. The external instruction control sub-system 206 generates a motion control policy according to the motion instruction 205.
[0035] The control system 200 generates a whole-body control policy 204 according to the balance control policy and the motion control policy. The whole-body control policy 204 is used for controlling the two-wheeled robot 201 to move in a balance state. In some embodiments, the whole-body control policy includes at least one of the balance control policy, another control policy, and a constraint. The another control policy is used for representing a control mode other than controlling the two-wheeled robot 201 to maintain balance. The constraint is used for representing a restriction condition of the two-wheeled robot 201. The control system 200 sends the whole-body control policy 204 to the two-wheeled robot 201, and the two-wheeled robot 201 executes the whole-body control policy 204.
[0036]
[0037] The method includes the following processes:
[0038] Process 302: Calculate an optimal feedback gain, an optimal variable matrix, and uncertainty according to a first state variable and a first feedback gain of a two-wheeled robot, the optimal variable matrix being used for representing a degree of a gain that a motion state of the two-wheeled robot has on a control mode of the two-wheeled robot.
[0039] In the embodiments of this application, a variable matrix is a Lyapunov matrix.
[0040] The first state variable is used for representing a motion state of the two-wheeled robot measured in a first time period. In some embodiments, the first state variable includes at least one of a pitch angle, a pitch angular velocity, and a linear speed of the two-wheeled robot.
[0041] The first feedback gain is used for representing a relationship between a motion state and a control matrix of the two-wheeled robot in a balance system. For example, in the balance system, the control matrix of the two-wheeled robot ?=?K.sub.0?+?. K.sub.0 is the first feedback gain, ? is a state variable, and ? is used for representing a variation of the two-wheeled robot in motion. ? can represent a time-related variable ?(t), t?[t.sub.0, t.sub.s], and t.sub.0<t.sub.s. The first state variable is any state variable in a time period [t.sub.0, t.sub.s].
[0042] The optimal feedback gain is used for representing a relationship between a motion state and a control matrix of the stationary two-wheeled robot in a balance system.
[0043] The uncertainty is used for compensating an error of the two-wheeled robot in a motion process.
[0044] Process 304: Calculate an angle deviation matrix and a noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and a second state variable of the two-wheeled robot.
[0045] The second state variable is used for representing a state of the two-wheeled robot in a second time period. In some embodiments, the second state variable includes at least one of the pitch angle, the pitch angular velocity, and the linear speed of the two-wheeled robot.
[0046] The angle deviation matrix is used for representing a difference between an actual pitch angle and a measured pitch angle of the two-wheeled robot.
[0047] The noise deviation matrix represents an ambient noise of the two-wheeled robot.
[0048] In some embodiments, in response to that the first state variable is any state variable in the time period [t.sub.0, t.sub.s], the second state variable is any state variable in a second time period in (t.sub.s, +?). In a specific example, the first state variable is any state variable in [1, 8], and the second state variable is a state variable in a second time period in (8, +?). In this case, in the embodiment of this application, a state variable in a first time period is used as prior experience to determine a control torque of the two-wheeled robot according to a state variable in a second time period, and control the two-wheeled robot in the second time period according to the control torque.
[0049] Both the first state variable and the second state variable are state variables of the same type.
[0050] Process 306: Obtain a control torque of the two-wheeled robot according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix.
[0051] In some embodiments, a system compensation value is obtained according to the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix, and the control torque of the two-wheeled robot is obtained according to the optimal feedback gain, the second state variable, and the system compensation value.
[0052] For example, the system compensation value L=K*Z+T. K* is the optimal feedback gain, Z is the angle deviation matrix, and T is the noise deviation matrix. In this case, the control torque of the two-wheeled robot is ?=?K*?+L, and ? is the second state variable.
[0053] Process 308: Control the two-wheeled robot according to the control torque.
[0054] In some implementations, as shown in
[0055] In conclusion, in the embodiments of this application, the optimal feedback gain, the optimal variable matrix, and the uncertainty are obtained according to the first state variable and the first feedback gain of the two-wheeled robot. The angle deviation matrix and the noise deviation matrix are calculated according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the second state variable of the two-wheeled robot. Then the control torque of the two-wheeled robot is obtained according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix. Finally, the two-wheeled robot is controlled according to the control torque. According to the method, the two-wheeled robot can stay in place or move within a small range, so that stability and safety of the two-wheeled robot can be improved.
[0056] In the following embodiments, the two-wheeled robot is difficult to maintain a completely stationary standing state under different operating conditions. To make the two-wheeled robot maintain stationary, a line connecting a center of mass (COM) and a center between wheels is to be perpendicular to the ground. Therefore, it is important for a controller of the two-wheeled robot to accurately estimate a position of the center of mass. However, due to uneven mass distribution and assembly errors, it is inevitable in practice that the position of the center of mass location deviates from an expected position. This is presented in a sagittal plane in
[0057] To resolve the foregoing problems, in a task of balancing the two-wheeled robot, a motor torque ? of a control wheel needs to be adjusted, so that the pitch angle of the two-wheeled robot remains unchanged, and both the pitch angular velocity and the linear speed are adjusted to 0. In this case, a system included in the two-wheeled robot may be represented by the following equation:
[0058] .sup.n?n, and B?
.sup.n?m (n=3, and m=1). Due to uncertain factors of the robot system, accurate expressions of A and B are difficult to be modeled. Therefore, the accurate expressions of A and B are not applied in the embodiments of this application.
[0059] Taking into account deviation of the center of mass, an actual pitch angle
{dot over (?)}=A?+B?+D, (2)
[0060] ?=[? {dot over (?)} {dot over (x)}].sup.T, and D=.sup.n?q (q=1). Because ?? is unknown, D is also unknown. In addition, to maintain the two-wheeled robot to be stationary in a fixed location, {dot over (x)} is selected to be an output adjusted to 0, and an error of {dot over (x)} is:
e=C{dot over (?)}=C?, (3)
C=[0 0 1].
[0061] In the embodiments of this application, the control torque of the two-wheeled robot may be represented as the following form:
?=?K?+L, (4)
[0062] L=KZ+T, Z=[?? 0 0].sup.T, K is a stable feedback gain, and K?.sup.n?1. In the foregoing equations, the first equation is used for adjusting the motion state ? of the two-wheeled robot, and the second equation is used for compensating the uncertainty. In response to that the two-wheeled robot is progressive stationary (satisfying lim.sub.t.fwdarw.?
0=AZ+BT+D, (5)
0=CZ, (6)
[0063] Because the unique underactuated dynamics of the two-wheeled robot, the foregoing adjustment equations have a unique solution. This is because for the two-wheeled robot in a stationary state, the motion state of the two-wheeled robot satisfies ?=[?? 0 0], and in this case, the control torque of the two-wheeled robot is fixed.
[0064] In the embodiments of this application, an optimal solution of the foregoing adjustment equations is represented by solving the following constrained optimization problem of state feedback control:
min ?.sub.0.sup.?(
[0065] Q?.sup.n?n is positive definite, and R?
. The optimal solution is represented by using an optimal feedback as:
K*=?R.sup.?1B.sup.TP*, (8)
[0066] P is the foregoing variable matrix.
[0067] Based on the foregoing argumentation process,
[0068] Process 501: Obtain a j.sup.th variable matrix according to a first state variable and a (j+1).sup.th feedback gain.
[0069] The first state variable is used for representing a measured state of the two-wheeled robot in a first time period. In some embodiments, the first state variable includes at least one of a pitch angle, a pitch angular velocity, and a linear speed of the two-wheeled robot.
[0070] In some embodiments, the process includes the following sub-processes: [0071] 1. Determine a first intermediate matrix, a second intermediate matrix, and a third intermediate matrix according to the first state variable.
[0072] For example, the first intermediate matrix is denoted as ?.sub.?,?, the second intermediate matrix is denoted as ?.sub.?,?, and the third intermediate matrix is denoted as ?.sub.?,?. In this case, there are following equations:
?.sub.?,?=[?.Math.?|.sub.t.sub.
?.sub.?,?=[?.sub.t.sub.
?.sub.?,?=[?.sub.t.sub.
[0073] ? represents the first state variable of the two-wheeled robot, t represents time, and ? represents a control torque of the two-wheeled robot. [0074] 2. Obtain a first polynomial of a first equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix.
[0075] For example, the first polynomial is denoted as
[0076] ?=[?.sub.?,??2 ?.sub.?,?(I.sub.n.Math.K.sub.j.sup.TR)?2 ?.sub.?,?(I.sub.n.Math.R)?2 ?.sub.?,?]. I.sub.n and R are constant matrices, and .Math. is used for representing a tensor product. [0077] 3. Obtain a second polynomial of the first equation according to the (j+1).sup.th feedback gain and the first intermediate matrix.
[0078] For example, the second polynomial is denoted as ?, and ?=??.sub.?,?vec(Q+K.sub.j.sup.TRK.sub.j). Q is a constant matrix. [0079] 4. In response to that the first polynomial is equal to the second polynomial, solve the first equation to obtain the j.sup.th variable matrix.
[0080] For example, the first equation
is solved to obtain the j.sup.th variable matrix, that is, P.sub.j in the equation.
[0081] To ensure that the first equation has a solution, a fourth intermediate matrix is determined according to the first state variable. In response to that the second intermediate matrix, the third intermediate matrix, and the fourth intermediate matrix reach full rank, sub-process 2, to be specific, obtaining a first polynomial of a first equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix, is performed.
[0082] The fourth intermediate matrix is denoted as ?.sub.?. In this case, ?.sub.?=[?.sub.t.sub.
[0083] The first intermediate matrix includes a difference between a tensor product of the first state variable and the first state variable at a first moment and a tensor product of the first state variable and the first state variable at a second moment.
[0084] The second intermediate matrix includes an integral of a tensor product of the first state variables and the first state variable between a first moment and a second moment.
[0085] The third intermediate matrix includes an integral of a tensor product of the first state variable and a torque of the two-wheeled robot between a first moment and a second moment.
[0086] The fourth intermediate matrix includes an integral of the first state variable between a first moment and a second moment.
[0087] The first moment and the second moment are two different sampling values in the first time period.
[0088] Process 502: Determine a (j+2).sup.th feedback gain according to the (j+1).sup.th feedback gain.
[0089] For example, the (j+2).sup.th feedback gain is obtained according to the first equation and the (j+1).sup.th feedback gain.
[0090] Process 503: Update j to j+1, and repeat the foregoing two processes.
[0091] For example, the foregoing two processes 501 to 502 are repeated, until a convergence condition is satisfied.
[0092] Process 504: In response to that the j.sup.th variable matrix reaches convergence, determine the j.sup.th variable matrix as an optimal variable matrix; and determine the (j+1).sup.th feedback gain as an optimal feedback gain.
[0093] For example, in response to that ?P.sub.j+1?P.sub.j?<?, and ? is any positive real number, it is determined that the j.sup.th variable matrix reaches convergence.
[0094] For example, the optimal variable matrix P*=P.sub.j, and the optimal feedback gain K*=K.sub.j+1.
[0095] Process 505: Determine uncertainty according to the optimal variable matrix, the optimal feedback gain, and the first state variable.
[0096] For example, after the optimal variable matrix P*, the optimal feedback gain K*, and the first state variable ? are determined, the uncertainty D is determined according to the first equation.
[0097] Process 506: Determine an actual state variable according to a second state variable.
[0098] The actual state variable is used for representing an actual state of the two-wheeled robot in a second time period. The second state variable is ?=[? {dot over (?)} {dot over (x)}].sup.T, and the actual state variable is
[0099] Process 507: Obtain an error linear function according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the actual state variable.
[0100] In some embodiments, the process includes the following sub-processes: [0101] 1. Determine the fifth intermediate matrix, a sixth intermediate matrix, and a seventh intermediate matrix according to the actual state variable.
[0102] For example, the fifth intermediate matrix is denoted as ?.sub.{circumflex over (?)},{circumflex over (?)}, the sixth intermediate matrix is denoted as ?.sub.{circumflex over (?)},{circumflex over (?)}, and the seventh intermediate matrix is denoted as ?.sub.{circumflex over (?)},?. In this case, there are following equations:
?.sub.{circumflex over (?)}{circumflex over (?)}=[{circumflex over (?)}.Math.{circumflex over (?)}|.sub.t.sub.
?.sub.{circumflex over (?)},{circumflex over (?)}=[?.sub.t.sub.
?.sub.{circumflex over (?)},?=[?.sub.t.sub.
[0103] {circumflex over (?)} represents the second state variable of the two-wheeled robot, t represents time, and ? represents the control torque of the two-wheeled robot. [0104] 2. Obtain a third polynomial of a second equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the fifth intermediate matrix, the sixth intermediate matrix, and the seventh intermediate matrix.
[0105] For example, the third polynomial is denoted as
[0106] {circumflex over (?)}=[?.sub.{circumflex over (?)},{circumflex over (?)}?2 ?.sub.{circumflex over (?)}, {circumflex over (?)}(I.sub.n.Math.K*.sub.j.sup.TR)?2 ?.sub.{circumflex over (?)}, ?(I.sub.n.Math.R)?2 ?.sub.{circumflex over (?)},?]. I.sub.n and R are constant matrices, and .Math. is used for representing a tensor product. [0107] 3. Obtain a fourth polynomial of the second equation according to the second state variable and the fifth intermediate matrix.
[0108] For example, the fourth polynomial is denoted as {circumflex over (?)}, and {circumflex over (?)}=??.sub.{circumflex over (?)},{circumflex over (?)}vec(Q+K*.sub.j.sup.TRK*). Q is a constant matrix. [0109] 4. In response to that the third polynomial is equal to the fourth polynomial, solve the second equation to obtain the error linear function.
[0110] For example, the second equation
is solved to obtain the error linear function, that is, S({circumflex over (Z)}) in the equation.
[0111] To ensure that the second equation has a solution, an eighth intermediate matrix is determined according to the second state variable. In response to that the sixth intermediate matrix, the seventh intermediate matrix, and the eighth intermediate matrix reach full rank, sub-process 2, to be specific, obtaining a third polynomial of a second equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the fifth intermediate matrix, the sixth intermediate matrix, and the seventh intermediate matrix, is performed.
[0112] For example, the eighth intermediate matrix is denoted as ?.sub.{circumflex over (?)}. In this case, ?.sub.{circumflex over (?)}=[?.sub.t.sub.
[0113] The fifth intermediate matrix includes a difference between a tensor product of an actual state variable and the actual state variable at a third moment and a tensor product of the actual state variable and the actual state variable at a fourth moment.
[0114] The sixth intermediate matrix includes an integral of a tensor product of the actual state variable and the actual state variable between a third moment and a fourth moment.
[0115] The seventh intermediate matrix includes an integral of a tensor product of the actual state variable and the torque of the two-wheeled robot between a third moment and a fourth moment.
[0116] The eighth intermediate matrix includes an integral of the actual state variable between a third moment and a fourth moment.
[0117] The third moment and the fourth moment are two different sampling values in the second time period. In some embodiments, the first moment and the third moment have the same sampling rule. In some embodiments, the second moment and the fourth moment have the same sampling rule.
[0118] Process 508: Obtain an angle deviation matrix and a noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the error linear function.
[0119] For example, the optimal feedback gain K*, the optimal variable matrix P*, the uncertainty D, and the error linear function S({circumflex over (Z)}) satisfy the following equation:
[0120] a is a scalar, and a satisfies Z=a{circumflex over (Z)} and the Equation (6). {circumflex over (Z)}=[1 0 0].sup.T is a basis of Z. In this case, the angle deviation matrix Z and the noise deviation matrix T are determined through the foregoing equations.
[0121] Process 509: Obtain a system compensation value according to the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix.
[0122] For example, a system compensation value L=K*Z+T is obtained according to the optimal feedback gain K*, the angle deviation matrix Z, and the noise deviation matrix T.
[0123] Process 510: Obtain the control torque of the two-wheeled robot according to the optimal feedback gain, the second state variable, and the system compensation value.
[0124] For example, the control torque ?=?K*?+L of the two-wheeled robot is obtained according to the optimal feedback gain K*, the second state variable ?, and the system compensation value L.
[0125] Process 511: Control the two-wheeled robot according to the control torque.
[0126] In some implementations, as shown in
[0127] In conclusion, in the embodiments of this application, the optimal feedback gain, the optimal variable matrix, and the uncertainty are obtained according to the first state variable and the first feedback gain of the two-wheeled robot. The angle deviation matrix and the noise deviation matrix are calculated according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the second state variable of the two-wheeled robot. Then the control torque of the two-wheeled robot is obtained according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix. Finally, the two-wheeled robot is controlled according to the control torque. According to the method, the two-wheeled robot can stay in place or move within a small range, so that stability and safety of the two-wheeled robot can be improved.
[0128] In addition, a balance controller of the robot of the foregoing type may be automatically updated online, so that the foregoing robot can implement the optimal control, and keep stay in place or move within a small range. The foregoing effects improve stability and security of the two-wheeled robot, and enable the two-wheeled robot to be used in a scenario that requires a stable chassis and a precise operation.
[0129] In the embodiments of this application, the optimal solutions (K*, P*) and (Z, T) are needed to be determined. First, for a method to determine the optimal feedback gain K*, iteratively solve an optimization problem through the collected ?(t) and ?(t). In the embodiments of this application, dependence on A is removed through the Lyapunov equation:
?K.sub.j.sup.TRK.sub.j?Q=?A.sub.j.sup.TP.sub.j+P.sub.jA.sub.j.
[0130] j is an iteration index. In addition, dependence on B is removed through the following gain iteration:
K.sub.j+1=R.sup.?1B.sup.TP.sub.j.
[0131] In each iteration process, D is set as a determined variable in each iteration, and in response to that K and P converges, convergence values are the optimal solutions K* and P*.
[0132] To determine parameters Z and T, a basis of Z is defined as {circumflex over (Z)}=[1 0 0].sup.T, so that there is a scalar a satisfying Z=a{circumflex over (Z)} and Equation (6). A Sylvester mapping S: R.sup.n.fwdarw.R.sup.n is defined to map, to make S(Z)=?AZ. In this case,
S(Z)?aS({circumflex over (Z)})=BT+D=P*K*.sup.TRT+D.
[0133] B is represented by using K* and P*, and D can be solved through the foregoing processes.
[0134] In response to that S({circumflex over (Z)}) is provided, (Z, T) can be solved through the following equation:
[0135] The control torque ? is obtained by setting L=K*Z+T and ?=?K*?+L.
[0136] In conclusion, the embodiments of this application provide a proof process of calculating the control torque ?. A complete process of calculating the control torque can be obtained through the proof process, and provides a theoretical basis for calculating the control torque.
[0137] In the following embodiments, the two-wheeled robot control method is provided in the embodiments of this application in a form of pseudocode as follows: [0138] 1. Apply initial stability control, and ?=?K.sub.0?+?, a detection noise ?(t) collecting data on [t.sub.0, t.sub.s]. [0139] 2. Calculate Equations (9), (10), (11), and (12) and Equations (13), (14), (15) and (16). [0140] 3. Determine that a full-rank condition holds:
[0153] In conclusion, in the embodiments of this application, the optimal feedback gain, the optimal variable matrix, and the uncertainty are obtained according to the first state variable and the first feedback gain of the two-wheeled robot. The angle deviation matrix and the noise deviation matrix are calculated according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the second state variable of the two-wheeled robot. Then the control torque of the two-wheeled robot is obtained according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix. Finally, the two-wheeled robot is controlled according to the control torque. According to the method, the two-wheeled robot can stay in place or move within a small range, so that stability and safety of the two-wheeled robot can be improved.
[0154] In embodiments of this application train, a controller is adjusted for optimal output driven by training data of a two-wheeled robot in four scenarios, to process uncertainties in a model and disturbance. In the related art, a two-wheeled robot can maintain balance, but cannot remain stationary, and this is a restriction in the related art. Therefore, in a first scenario and a second scenario, a stability problem which occurs in response to that a height of the robot is 0.33 m and 0.5 m is avoided. In addition, in this application, two more challenging scenarios are further provided. In a third scenario, an eccentric load of 3.5 kg is arranged at a front of a base in the robot in this application. Because a weight of a floating base is 11 kg, a heavy load significantly changes a balance point of the two-wheeled robot. In a fourth scenario, the two-wheeled robot is trained on a ramp in this application. Clearly, an additional torque is needed for the two-wheeled robot to compensate factors of a slope of a direct ramp, and this means that the balance point of the two-wheeled robot changes. Information of the load (such as quality, shape, and position) and the slope (such as gradient) are not applied during a training process, and are regarded as unknown interference.
[0155] During training, an initial gain K.sub.0=[?74 ?26 ?10] is used. In response to that the controller is in a stationary state, the two-wheeled robot can move upward/forward repeatedly according to the controller, and a detection noise ?(t)=1.6 sin(8?t)+0.8 cos(12?t) is configured to obtain more information data. Sufficient training data is collected in each experiment to easily satisfy a full-rank condition of this application. In addition, robustness of the method provided in the embodiments of this application ensures a small neighborhood converged to the optimal solution during the use of the noise data.
[0156] Finally, by setting Q=diag(900, 400, 150), R=1, and ?=10.sup.?4 in the method of this application, convergence is performed on control parameters of the foregoing four scenarios as shown in the following:
K*.sub.a=[?67.96 ?29.13 ?9.20], L.sub.a=?4.21;
K*.sub.b=[?80.92 ?27.38 ?10.79], L.sub.b=?1.78;
K*.sub.c=[?86.61 ?27.37 ?10.89], L.sub.c=?5.97;
K*.sub.d=[?61.04 ?19.86 ?7.97], L.sub.d=1.30.
[0157] The foregoing convergence values are respectively implemented in the 19.sup.th, 18.sup.th, 16.sup.th, 21.sup.st iterations. Refer to
[0158] Because a pitch angle of the two-wheeled robot is adjusted to be extensively large, a motor input of the two-wheeled robot is oscillating. A first diagonal term of Q is reduced accordingly in the embodiments of this application. In addition, according to a manual test, convergence property of the algorithm is sensitive to a third diagonal term, and a feasible range is 90 to 280. In addition, a second diagonal term is larger than 180, and the first diagonal term may be any positive value. These results indicate the robustness of the algorithm provided in the embodiments of this application to the convergence of the parameters Q and R.
[0159] By using the algorithm of this application, a trained controller may update a motion state of the two-wheeled robot online after data collection. Here, the related art (in which the initial feedback gain K.sub.0 is used to control the two-wheeled robot) is directly compared with the method provided in the embodiments of this application (also referred to as adaptive optimal output regulation (AOOR)), to avoid an impact of motion noise and exploration noise on vision during the training. In the first scenario, the height of the two-wheeled robot is 0.33 m. The related art is used first, and a remote controller is used to make the two-wheeled robot remain stationary. Then, after the remote controller is released, the robot continuously moves forward within the first two seconds, and this can be learned from the curve shown in
TABLE-US-00001 TABLE 1 Experiment results of this application and the related art Method provided in this Experiment Related art application scenario Time (s) Shift (m) Time (s) Shift (m) First scenario 2.0 0.46 5.8 0.15 Second scenario 2.9 0.56 7.1 0.15 Third scenario 2.5 1.01 5.4 0.04 Fourth scenario 2.3 0.42 2.5 0.10
[0160] The following are apparatus embodiments of this application. For details not described in the apparatus embodiments, reference is made to the foregoing method embodiments, and details are not described herein again.
[0161]
[0166] In one embodiment, the calculation module 1301 is further configured to: obtain a j.sup.th variable matrix according to the first state variable and a (j+1).sup.th feedback gain, the 1.sup.st feedback gain being the first feedback gain, j being an integer, and an initial value of j being 0; determine a (j+2).sup.th feedback gain according to the (j+1).sup.th feedback gain; update j to j+1, and repeat the foregoing two operations; in response to that the j.sup.th variable matrix reaches convergence, determine the j.sup.th variable matrix as the optimal variable matrix; determine the (j+1).sup.th feedback gain as the optimal feedback gain; and determine the uncertainty according to the optimal variable matrix, the optimal feedback gain, and the first state variable.
[0167] In one embodiment, the calculation module 1301 is further configured to: determine a first intermediate matrix, a second intermediate matrix, and a third intermediate matrix according to the first state variable; obtain a first polynomial of a first equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix; obtain a second polynomial of the first equation according to the (j+1).sup.th feedback gain and the first intermediate matrix; and in response to that the first polynomial is equal to the second polynomial, solve the first equation to obtain the j.sup.th variable matrix.
[0168] In one embodiment, the calculation module 1301 is further configured to: determine a fourth intermediate matrix according to the first state variable; and in response to that the second intermediate matrix, the third intermediate matrix, and the fourth intermediate matrix reach full rank, perform the operation of obtaining a first polynomial of a first equation according to the (j+1).sup.th feedback gain, the first intermediate matrix, the second intermediate matrix, and the third intermediate matrix.
[0169] In one embodiment, the first intermediate matrix includes a difference between a tensor product of a first state variable and the first state variable at a first moment and a tensor product of the first state variable and the first state variable at a second moment. The second intermediate matrix includes an integral of a tensor product of the first state variable and the first state variable between a first moment and a second moment. The third intermediate matrix includes an integral of a tensor product of a first state variable and a torque of the two-wheeled robot between the first moment and a second moment. The fourth intermediate matrix includes an integral of the first state variable between a first moment and a second moment.
[0170] In one embodiment, the calculation module 1301 is further configured: to determine actual state variable according to the second state variable; obtain an error linear function according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the actual state variable; and obtain the angle deviation matrix and the noise deviation matrix according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the error linear function.
[0171] In one embodiment, the calculation module 1301 is further configured to: determine a fifth intermediate matrix, a sixth intermediate matrix, and a seventh intermediate matrix according to the actual state variable; obtain a third polynomial of a second equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the fifth intermediate matrix, the sixth intermediate matrix, and the seventh intermediate matrix; obtain a fourth polynomial of the second equation according to the actual state variable and the fifth intermediate matrix; and in response to that the third polynomial is equal to the fourth polynomial, solve the second equation to obtain the error linear function.
[0172] In one embodiment, the calculation module 1301 is further configured to: determine an eighth intermediate matrix according to the actual state variable; in response to that the sixth intermediate matrix, the seventh intermediate matrix, and the eighth intermediate matrix reach full rank, perform the operation of obtaining a third polynomial of a second equation according to the optimal feedback gain, the optimal variable matrix, the uncertainty, the fifth intermediate matrix, the sixth intermediate matrix, and the seventh intermediate matrix.
[0173] In one embodiment, the fifth intermediate matrix includes a difference between a tensor product of a second state variable and the second state variable at a third moment and a tensor product of the second state variable and the second state variable at a fourth moment. The sixth intermediate matrix includes an integral of a tensor product of the second state variable and the second state variable between a third moment and a fourth moment. The seventh intermediate matrix includes an integral of a tensor product of the second state variable and the torque of the two-wheeled robot between a third moment and a fourth moment. The eighth intermediate matrix includes an integral of the second state variable between a third moment and a fourth moment.
[0174] In one embodiment, the calculation module 1301 is further configured to: obtain a system compensation value according to the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix; and obtain the control torque of the two-wheeled robot according to the optimal feedback gain, the second state variable, and the system compensation value.
[0175] In conclusion, in the embodiments of this application, the optimal feedback gain, the optimal variable matrix, and the uncertainty are obtained according to the first state variable and the first feedback gain of the two-wheeled robot. The angle deviation matrix and the noise deviation matrix are calculated according to the optimal feedback gain, the optimal variable matrix, the uncertainty, and the second state variable of the two-wheeled robot. Then the control torque of the two-wheeled robot is obtained according to the second state variable, the optimal feedback gain, the angle deviation matrix, and the noise deviation matrix. Finally, the two-wheeled robot is controlled according to the control torque. According to the method, the two-wheeled robot can stay in place or move within a small range, so that stability and safety of the two-wheeled robot can be improved.
[0176]
[0177] The basic input/output system 1406 includes a display 1408 configured to display information and an input device 1409 such as a mouse or a keyboard configured to input information by a user. The display 1408 and the input device 1409 are both connected to the central processing unit 1401 by using an input/output controller 1410 connected to the system bus 1405. The basic input/output system 1406 may further include the input/output controller 1410 to be configured to receive and process inputs from a plurality of other devices such as a keyboard, a mouse, and an electronic stylus. Similarly, the input/output controller 1410 further provides an output to a display screen, a printer, or another type of output device.
[0178] The mass storage device 1407 is connected to the central processing unit 1401 by using a mass storage controller (not shown) connected to the system bus 1405. The mass storage device 1407 and a computer device-readable medium associated with the mass storage device provide non-volatile storage to the computer device 1400. To be specific, the mass storage device 1407 may include a computer device-readable medium (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.
[0179] In general, the computer device-readable medium may include a computer device storage medium and a communication medium. The computer device storage medium includes volatile and non-volatile media, and removable and non-removable media implemented by using any method or technology used for storing information such as computer device-readable instructions, data structures, program modules, or other data. The computer device storage medium includes a RAM, a ROM, an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a CD-ROM, a digital versatile disc (DVD) or another optical storage, a magnetic cassette, a magnetic tape, a disk storage, or another magnetic storage device. Certainly, a person skilled in the art may know that the computer device storage medium is not limited to the foregoing several types. The system memory 1404 and the mass storage device 1407 may be collectively referred to as a memory.
[0180] According to the embodiments of the present disclosure, the computer device 1400 may alternatively be connected, through a network such as the Internet, to a remote computer device on the network and run. To be specific, the computer device 1400 may be connected to a network 1411 by using a network interface unit 1412 connected to the system bus 1405, or may be connected to another type of network or a remote computer device system (not shown) by using a network interface unit 1412.
[0181] The memory further includes one or more programs. The one or more programs are stored in a memory. The central processing unit 1401 implements all or some processes of the two-wheeled robot control method by executing the one or more programs.
[0182] In addition, an embodiment of this application further provides a storage medium, the storage medium being configured to store a computer program, and the computer program being used for performing the two-wheeled robot control method according to the foregoing embodiments.
[0183] An embodiment of this application further provides a computer program product including a computer program, the computer program product, when running on a computer, causing the computer to perform the two-wheeled robot control method according to the foregoing embodiments.
[0184] The sequence numbers of the foregoing embodiments of this application are merely for description purpose but do not imply the preference among the embodiments.
[0185] A person of ordinary skill in the art may understand that all or some of the processes of the foregoing embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware. The program may be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a magnetic disk, an optical disc, or the like.
[0186] Embodiments of the present disclosure are described using a two-wheeled robot as an example. The present disclosure, however, is not limited thereto, but is applicable to any suitable robot.
[0187] The foregoing descriptions are merely optional embodiments of this application, but are not intended to limit this application. Any modification, equivalent replacement, or improvement made within the spirit and principle of this application fall within the scope of this application.