### The Inverted Pendulum - Part 2

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

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.

While this is conceptually straight forward, the angular acceleration is difficult to control. As you will see in the PID tutorial,
avoiding derivitives 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 velocity is not to be confused with angular velocity **ω**.

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.