I had an exam yesterday, and I was asked the following question:

Why PID controller is necessary for stabilizing the inverted pendulum on a cart, why not we just use PI or PD?

Now I've seen some papers taking about using PD to stabilize the inverted pendulum, and I couldn't find any mathematical explanation, any help?


Without going into the details of the underlying equations of motion, I could argue that the D part is needed to damp out the oscillations of the pole while reaching for the (unstable) equilibrium point with no overshoots and guaranteeing at the same time a sufficient dynamics.

Now, if we consider the context where the equilibrium point is reached but the cart is still accelerating, the only term capable of counteracting the inertial forces on the pole is the integral I, which indeed is the only part delivering effort when we have 0 error. Besides this, the integral is always desirable to compensate for uncertainties in the plant.

To elaborate more, I've found this quite enlighting reference on the dynamics of the cart-pole system.

Essentially, if we linearize the system we get: $$ \ddot{\theta}=\frac{g}{L}\theta+\frac{u}{ML}, $$ where $\theta$ is the angular displacement of the pole with respect to the equilibrium, $u$ is the force applied to the cart, $M$ is the mass of the cart, $L$ is the length of the pole and $g$ the gravity acceleration.

Contrary to what I said above, for $\theta=0$ we can obtain the equilibrium $\ddot{\theta}=0$ with $u=0$, thus the integral I is not strictly required. Anyway, we ought to recap that ours is only an approximated linear model; therefore, the I term can help compensate for the unmodeled quantities.

Let's come to the PD part then.

The system is unstable because of the positive eigenvalue $+\sqrt{g/L}$. Hence, we need to find a suitable control law to stabilize it. A full state-feedback controller is proposed in the reference, which is of the form: $$ u=h_1\theta+h_2\dot{\theta}. $$ It's easy to demonstrate that for $h_1=-Mg$ and $h_2<0$, the resulting closed-loop eigenvalues are both stable $\lambda_{1,2}=0,h_2/ML$.

To conclude, $u=-Mg\theta+h_2\dot{\theta}$ is nothing but a PD.

Now, let's go back to the I part.

If we don't know precisely the value of the mass $M$ and also we measure $\theta$ with a certain level of accuracy, then $h_1\theta=-Mg\theta$ won't cancel out exactly the term $\left(g/L\right)\theta$ in the dynamics equation. The mismatch between the designed and the real parameters can be tackled by using the integral part I.

  • $\begingroup$ Ok, that part I understood, thanks! But can we prove the need of PID mathematically? $\endgroup$ – Tamim Boubou Oct 27 '19 at 12:42
  • $\begingroup$ Tamim, I've extended the answer. $\endgroup$ – Ugo Pattacini Oct 27 '19 at 13:29
  • $\begingroup$ Would nonzero friction be another reason for needing I? $\endgroup$ – SteveO Oct 28 '19 at 11:55
  • $\begingroup$ @SteveO, yes that's correct: static friction can be fought back using I. Also, the I term is needed when stabilizing around $\theta \neq 0$. $\endgroup$ – Ugo Pattacini Oct 28 '19 at 12:10
  • $\begingroup$ Thank u very much It's clearer now.... $\endgroup$ – Tamim Boubou Oct 28 '19 at 20:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.