A double inverted pendulum is a dynamic system consisting of two pendulums, where the second pendulum is attached to the first pendulum. This tutorial demonstrates the optimal control swing-up and horizontal position translation of the pendulum and cart.
Source Code: https://apmonitor.com/do/index.php/Ma...
The motion of the system is governed by a set of equations derived using Lagrangian mechanics. The Lagrangian is the difference between the kinetic and potential energies of the system and is given by: L = T - V where T is the kinetic energy and V is the potential energy. For the double inverted pendulum, the kinetic energy T is given by the sum of the kinetic energies of each pendulum. The potential energy V is the sum of the gravitational potential energies of each pendulum.