Motion control method, method for generating trajectory of motion, and electronic device
View Patent ↗The present disclosure provides a motion control method and apparatus, and a method and apparatus for generating a trajectory of a motion. The motion control method is applied to a robot, and includes: generating, according to a type of a desired motion, at least one motion phase of a motion process and a time for each motion phase; determining, according to the at least one motion phase and the time of each motion phase, a desired pose of the robot at least one node during the motion process; inputting the desired pose as a reference value into a cost function model to obtain a trajectory of the desired motion, where the trajectory includes a pose and a control parameter of the robot at each sampling point during the motion process; and controlling the robot to move according to the trajectory of the desired motion.
1 . A motion control method, applied to a robot, the method comprising:
generating, according to a type of a desired motion, at least one motion phase of a motion process and a time for each motion phase of the at least one motion phase;
determining, according to the at least one motion phase and the time of each motion phase of the at least one motion phase, a desired pose of the robot at at least one node during the motion process;
inputting the desired pose at the at least one node as a reference value into a cost function model to obtain a trajectory of the desired motion, wherein the trajectory comprises a pose and a control parameter of the robot at each of a plurality of sampling points during the motion process; and
controlling the robot to move according to the trajectory of the desired motion;
wherein determining, according to the at least one motion phase and the time of each motion phase of the at least one motion phase, the desired pose of the robot at the at least one node during the motion process, comprises:
determining, according to the at least one motion phase, the time of each motion phase of the at least one motion phase, and relative relationships between desired poses of the robot at different nodes, the desired poses of the robot at a plurality of nodes during the motion process; and
wherein determining the relative relationships between the desired poses of the robot at different nodes, comprises:
determining that any two nodes belong to a same motion phase, and determining a relative relationship between the desired poses of the robot at the two nodes according to positions of the two nodes in the motion phase and a preset motion function relationship between the two nodes.
2 . The method of claim 1 , wherein the cost function model comprises the following to-be-optimized terms:
at least one of a difference between a to-be-optimized pose at each of the plurality of sampling points and the desired pose at the at least one node, and a difference between a to-be-optimized pose at the at least one node and the desired pose at the at least one node; and
at least one of a to-be-optimized control parameter at each of the plurality of sampling points, and a difference between the to-be-optimized control parameter at each of the plurality of sampling points and a to-be-optimized control parameter at a previous sampling point.
3 . The method of claim 2 , wherein the cost function model further comprises the following to-be-optimized term:
a difference between a rate of change of the to-be-optimized pose at each of the plurality of sampling points and a rate of change of the to-be-optimized pose at a previous sampling point.
4 . The method of claim 2 , wherein each to-be-optimized term in the cost function model is provided with a corresponding weight.
5 . The method of claim 2 , wherein constraint conditions of the cost function model comprise at least one of the following conditions:
the to-be-optimized poses at different sampling points meet a preset dynamics equation;
the to-be-optimized control parameters at different sampling points meet the preset dynamics equation;
the to-be-optimized pose at each of the plurality of sampling points meets a preset empirical range; or
the to-be-optimized control parameter at each of the plurality of sampling points meets the preset empirical range.
6 . The method of claim 1 , wherein
the desired pose comprises at least one of: a body displacement, a body attitude angle, and a joint angular displacement, and the pose comprises at least one of: a body displacement, a body attitude angle, and a joint angular displacement; or
the control parameter comprises a joint torque.
7 . The method of claim 1 , wherein the desired motion comprises at least one of: a front somersault, a back somersault, and a jump.
8 . The method of claim 1 , wherein controlling the robot to move according to the trajectory of the desired motion comprises:
updating, before the robot moves to any sampling point of the trajectory, a control parameter of the sampling point according to a pose of the sampling point and a current pose of the robot; and
controlling the robot to move according to an updated control parameter.
9 . An electronic device, applied to a robot, the electronic device comprising a memory and a processor, wherein
the memory is configured to store computer instructions executable by the processor; and
the processor is configured to implement, when executing the computer instructions, acts comprising:
generating, according to a type of a desired motion, at least one motion phase of a motion process and a time for each motion phase of the at least one motion phase;
determining, according to the at least one motion phase and the time of each motion phase of the at least one motion phase, a desired pose of the robot at at least one node during the motion process;
inputting the desired pose at the at least one node as a reference value into a cost function model to obtain a trajectory of the desired motion, wherein the trajectory comprises a pose and a control parameter of the robot at each of a plurality of sampling points during the motion process;
controlling the robot to move according to the trajectory of the desired motion;
determining, according to the at least one motion phase, the time of each motion phase of the at least one motion phase, and relative relationships between desired poses of the robot at different nodes, the desired poses of the robot at a plurality of nodes during the motion process; and
determining that any two nodes belong to a same motion phase, and determine a relative relationship between the desired poses of the robot at the two nodes according to positions of the two nodes in the motion phase and a preset motion function relationship between the two nodes.
10 . The electronic device of claim 9 , wherein the cost function model comprises following to-be-optimized terms:
at least one of a difference between a to-be-optimized pose at each of the plurality of sampling points and the desired pose at the at least one node, and a difference between a to-be-optimized pose at the at least one node and the desired pose at the at least one node; and
at least one of a to-be-optimized control parameter at each of the plurality of sampling points, and a difference between the to-be-optimized control parameter at each of the plurality of sampling points and a to-be-optimized control parameter at a previous sampling point.
11 . The electronic device of claim 10 , wherein the cost function model further comprises the following to-be-optimized term:
a difference between a rate of change of the to-be-optimized pose at each of the plurality of sampling points and a rate of change of the to-be-optimized pose at a previous sampling point.
12 . The electronic device of claim 10 , wherein each to-be-optimized term in the cost function model is provided with a corresponding weight.
13 . The electronic device of claim 10 , wherein constraint conditions of the cost function model comprise at least one of the following conditions:
the to-be-optimized poses at different sampling points meet a preset dynamics equation;
the to-be-optimized control parameters at different sampling points meet the preset dynamics equation;
the to-be-optimized pose at each of the plurality of sampling points meets a preset empirical range; or
the to-be-optimized control parameter at each of the plurality of sampling points meets the preset empirical range.
14 . The electronic device of claim 9 , wherein
the desired pose comprises at least one of: a body displacement, a body attitude angle, and a joint angular displacement, and the pose comprises at least one of: a body displacement, a body attitude angle, and a joint angular displacement; or
the control parameter comprises a joint torque.
15 . The electronic device of claim 9 , wherein the desired motion comprises at least one of: a front somersault, a back somersault, and a jump.
16 . The electronic device of claim 9 , wherein controlling the robot to move according to the trajectory of the desired motion comprises:
updating, before the robot moves to any sampling point of the trajectory, a control parameter of the sampling point according to a pose of the sampling point and a current pose of the robot; and
controlling the robot to move according to an updated control parameter.
17 . A non-transitory computer-readable storage medium having stored thereon a computer program, the program, when executed by one or more processors of a robot, causing the robot to perform operations comprising:
generating, according to a type of a desired motion, at least one motion phase of a motion process and a time for each motion phase of the at least one motion phase;
determining, according to the at least one motion phase and the time of each motion phase of the at least one motion phase, a desired pose of the robot at at least one node during the motion process;
inputting the desired pose at the at least one node as a reference value into a cost function model to obtain a trajectory of the desired motion, wherein the trajectory comprises a pose and a control parameter of the robot at each of a plurality of sampling points during the motion process; and
controlling the robot to move according to the trajectory of the desired motion;
wherein determining, according to the at least one motion phase and the time of each motion phase of the at least one motion phase, the desired pose of the robot at the at least one node during the motion process, comprises:
determining, according to the at least one motion phase, the time of each motion phase of the at least one motion phase, and relative relationships between desired poses of the robot at different nodes, the desired poses of the robot at a plurality of nodes during the motion process; and
wherein determining the relative relationships between the desired poses of the robot at different nodes, comprises:
determining that any two nodes belong to a same motion phase, and determining a relative relationship between the desired poses of the robot at the two nodes according to positions of the two nodes in the motion phase and a preset motion function relationship between the two nodes.
18 . The non-transitory computer-readable storage medium of claim 17 , wherein the cost function model comprises the following to-be-optimized terms:
at least one of a difference between a to-be-optimized pose at each of the plurality of sampling points and the desired pose at the at least one node, and a difference between a to-be-optimized pose at the at least one node and the desired pose at the at least one node; and
at least one of a to-be-optimized control parameter at each of the plurality of sampling points, and a difference between the to-be-optimized control parameter at each of the plurality of sampling points and a to-be-optimized control parameter at a previous sampling point.
19 . The non-transitory computer-readable storage medium of claim 18 , wherein the cost function model further comprises the following to-be-optimized term:
a difference between a rate of change of the to-be-optimized pose at each of the plurality of sampling points and a rate of change of the to-be-optimized pose at a previous sampling point.
20 . The non-transitory computer-readable storage medium of claim 18 , wherein each to-be-optimized term in the cost function model is provided with a corresponding weight.