ⓘ Inverted Pendulum PID Control Dynamics
The translational force u(t) is applied to the cart. Under feedback control, a PID controller is connected to the pendulum angle:
u(t) = − ( Kp·e(t) + Ki·∫e(t)dt + Kd·de(t)/dt ), where the angle error is e(t) = θ* − θ(t).
For the pendulum to remain stable upright, the controller must push the cart in the direction of the fall. This translates to positive gains Kp, Ki, Kd > 0 in this feedback structure.
Note that Kp must be greater than the gravity effect (M+m)·g (approx. 11.8 N/rad for default masses) to overcome the falling torque. Because the cart's position is uncontrolled in this single-loop angle PID structure, the cart may drift left or right while maintaining the pendulum upright!