The Inverted Pendulum - Part 2

Let's remind ourselves of the equation for angular acceleration from the previous tutorial.

The Inverted Pendulum

Where α is the angular acceleration, θ is the angle of the inverted pendulum with respect to the vertical axis, 𝑙 is the length of the pendulum and g is the acceleration due to gravity.

Suppose we want to hold the inverted pendulum at a certain angle. We could exert an acceleration in the x direction to produce an angular acceleration which opposes the angular acceleration due to gravity. We will call this 𝛄. Now we want to work out the necessary acceleration 𝒂 (not to be confused with α) to achieve this.

The Inverted Pendulum

This is a simple model and is sufficient for building a PID controller. However, it can be useful to develop the model further to include more detail about the system. For example, you could account for the fact that the T-Bot motors include gearboxes which prevent the free rotation of the wheels as the T-Bot falls over. This means the pivot point, when considering the angular acceleration due to gravity, is not at the axle but at the bottom of the wheel. This means theta_c is used instead of theta along with l_c instead of l to calculate the angular acceleration. A detailed simulation, is useful for developing your own controllers. Which could take the form of PID, LQR, or neural network controllers etc.

The Inverted Pendulum

This model is demonstrated in the T-Bot Simulator

The T-Bot Simulator

While this is conceptually straight forward, the angular acceleration is difficult to control. As you will see in the PID tutorial, avoiding derivatives in noisy systems is a good idea. Controlling an output velocity is much simpler, so setting up the signal input in terms of velocity simplifies the problem. We can use the conversion of potential energy (PE) to kinetic energy (KE) to derive the equation for velocity 𝑣. As the inverted pendulum rotates away from the vertical axis, it's height decreases and some of the potentail energy is converted to kinetic energy. We can now get the velocity from the kinetic energy. Note this is the tangential velocity and is not to be confused with the angular velocity ω.

The Inverted Pendulum

There are several considerations missing from this model. For example, the calculation for velocity assumes the velocity is zero when the angle is zero. But this won’t be the case because the pendulum will always be moving as it crosses zero degrees. Furthermore, in the case of a balancing robot, disturbances from imperfections in the terrain such as the grooves between floorboards or the lumps and bumps on carpet, can't be accounted for directly. Fortunately, we don’t need to keep track of these subtleties because these will get absorbed into the PID controller which will be discussed in the PID tutorial.