Linear Inverted Pendulumn Model for Humanoid Robot CoM Trajectory Control

Can you model a man as a point?

One of our (Tsinghua Hephaestus Team) humanoid robots in RoboCup

Introduction

In his book Introduction to Humanoid Robotics (Springer), Kajita proposed a Linear Inverted Pendulumn model for humanoid robotic walking pattern generation.

The basic idea is to model a humanoid robot with a single mass point(located at the center of mass, CoM of the robot) plus two weightless rods which, under the reaction of gravity and with an initial velocity, swing in certain pattern. With this model, we are able to derive a beautiful expression for controlling the center of mass trajectory for the robot. Though seemingly much too simplified at first sight, nevertheless, the model has proven feasible and robust in practice.

This articles discusses some details of the actual implementation of LIP. Code for this project can be found on my github. Details of the algorithm can be found in the book, Chapter 3 and Chapter 4. A Chinese version of .pdf code report file is also uploaded to the repository, illustrating all the necessary details in the course of realizing this algorithm with MATLAB code.

Model

As all methematical derivations are listed in the book, here I will only roughly go over the model.

A schematic illustration of LIP model

There are three basic assumptions for this model:

  • that during single-support phase, the robot can be seen as a single mass point linked to the ground through a straight rod(leg).
  • that the length of the leg can change arbitrarily such that the height of the CoM remains constant.
  • that the net force acting upon CoM is always along the leg itself.
  • that in walking, at one time, only one leg is in touch with the ground.

With these assumptions made, we could easily obtain these conclusions of a 3-D linear inverted pendulumn:

The trajectory of CoM in its plane(which is parallel to the ground) is a hyperbola, with the function $$\frac{g}{2z_cE_x}x^2 + \frac{g}{2z_cE_y}y^2 + 1 = 0$$ where $z_c$ is the height of CoM, $E_x, E_y$ are the trajectory energy along $x$ and $y$ axis, respectively. Note that the following analysis are based on a single direction, say, $x$ direction. $y$ direction can be solved in the same way. With the funciton above, we can further derive that for each step, the final velocity $v_x$ euqals $\bar{x}(C + 1)/(T_cS)$, where $$ T_c = \sqrt{\frac{z_c}{g}},
C = \cosh\frac{T_{sup}}{T_c}, S = \sinh\frac{T_{sup}}{T_c}$$
and $\bar{x}$ represents the final corrdinate of CoM viewed from the corrdinate system with the supporting foot being the origin.

This model also requires the input for foot position at each time step. This can either be designed by user or by a program, since each step of the robot is designed to be the same. During implementation, the actual position of foot may be slightly different, but the robot will try to step on the given point. In order to minimize the cost function $a(x_d - x_f)^2 + b(\dot{x_d} - \dot{x_f})^2$ so that the robot’s final state is close to the ideal state, we shall be able to calculate the actual foot location $p^*_x$ for our robot at the end of each step, which is
$$ p_x^* = -\frac{a(C - 1)}{D}(x_d - Cx_i - T_cS\dot{x_i}) - \frac{bS}{T_cD}(\dot{x_d} - \frac{S}{T_c}x_i - Cx_i)$$
where
$$D = a(C - 1)^2 + b(S/T_c)^2$$
With all these formulae combined together and carried out for each step, the complete algorithm is formed.

Details of Implementation

Some of the assumptions made for LIP model are not practical in real life. For example, in practice the robot will almost always have a double-support phase in walking, refuting the fourth assumption. These problems are minor and could be solved by slightly modifying our original model.

However, the book did not mention the starting and stopping process of the robot. Giving it a little thought, there are two maor ways of starting:

  • give the robot an initial velocity
  • give the robot an initial inclination

In my implementation case I used the second way as it is easier and does not need a special modification.

For stopping, we also have to add an aditional step, otherwise the robot’s CoM will not land on top of its foot, which will generate further motion. See my code for detailed reference.

Simulation Result

Results show that with this algorithm, the robot is able to follow different trajectories. In reality, when we plan a robot’s trajectory, we actually plan its foot placement, as the trajectory of CoM under this model is hyperbolic and is the result of calculation instead of planning. For example, if we want the robot to walk along a straight line, its foot placement should be along two seprate but parallel straight lines, while its CoM moves along an occilating curve.

Simulation result of an LIP moving along a straight line

Here we offer several examples of getting the provided code running. Note that in these figures, ‘x’ indicates the planned foot placement, while ‘o’ indicates the actual foot placement.

In MATLAB command window, type

1
2
3
sx = [0.0, 0.3, 0.3, 0.3, 0];
sy = [0.2, 0.2, 0.2, 0.2, 0.2];
LIP(0.8, 0.8, sx, sy, 0, 0, 0, 0, 0, 0, 10, 1);

and we will get
A straight line example

To do diagonal walk, type

1
2
3
sx = [0.0, 0.3, 0.3, 0.3, 0];
sy = [0.2, 0.3, 0.1, 0.3, 0.2];
LIP(0.8, 0.8, sx, sy, 0, 0, 0, 0, 0, 0, 10, 1);

and we will get
Walk along a diagonal line while facing the front

Alternatively, we can assign the angle that the robot should turn at each step. As an example, with

1
2
3
4
sx = [0.0, 0.25, 0.25, 0.25, 0];
sy = [0.2, 0.3, 0.2, 0.2, 0.2];
theta = [0 20 40 60 60];
LIP(0.8, 0.8, sx, sy, 0, 0, 0, 0, 0, 0, 10, 1, theta);

we shall get
Walk while turning 20 degrees at each step

We can even get some fancy results such as a circle:

1
2
3
4
5
x = linspace(0.3, 0.3, 18);
sx = [0, sx, 0];
sy=linspace(0.2, 0.2, 20);
theta = 0:20:360;
theta = [theta, 360];

and we get
Circling with 20 degrees' turn per step

Conclusion

With linear inverted pendulumn model, we can achieve active control of the robot. This method stands in contrast to the “passive” walking, where the robot is considered to be walking on a virtual slope under the influence of gravity. Relatively speaking, the active control method brings more flexibility to the robot, while consuming more energy.

Reference

[1]Shuuji Kajita, Hirohisa Hirukawa, Kensuke Harada, and Kazuhito Yokoi. 2014. Introduction to Humanoid Robotics. Springer Publishing Company, Incorporated.

Share