Lagrangian Mechanics
Lagrangian Mechanics
Lagrangian mechanics is Newton’s \(F = ma\) in disguise—but a spectacularly useful disguise. Instead of tracking forces on every particle, you write down two numbers: the total kinetic energy \(T\) (how fast things are moving) and the total potential energy \(V\) (how much stored energy there is from gravity, springs, etc.). The difference \(L = T - V\) is the Lagrangian, and from it, the equations of motion for any mechanical system fall out automatically.
The magic is that you never need to compute internal forces—forces between links of a robot arm, constraint forces at hinges, reaction forces at joints. The Lagrangian handles them all implicitly. You just write down energies, take some derivatives, and the equations of motion appear. This is why every serious robotics textbook is built on Lagrangian mechanics.
The Limitations of Newton
In the Newtonian framework (utilized powerfully by the Recursive Newton-Euler algorithm in Chapter 7, Recursive Algorithms), motion is determined by explicit forces: \(\sum F = ma\).
While Newton’s equations are spectacular for computational algorithms evaluating rigid bodies link-by-link, they suffer from a fatal flaw when deriving mathematical models by hand: Constraint Forces.
If a bead slides down a curved wire, or a pendulum swings on a rigid rod, Newton demands that you calculate the exact, microscopic physical force the wire exerts on the bead, or the tension the rod pulls on the bob, just to ensure they don’t break. For a 15-DOF mechanism, solving for 15 unknown internal constraint forces pulling against each other is mathematically agonizing.
The Principle of Least Action
Joseph-Louis Lagrange developed an alternative formulation that bypasses forces entirely, relying instead on the Principle of Stationary Action (historically called the Principle of Least Action).
The physical trajectory of a system is the one for which the action—the time integral of the difference between kinetic energy (\(T\)) and potential energy (\(V\))—is stationary (typically a minimum, though saddle points are possible in general).
Kinetic Energy (\(T\)) is the energy of motion. If you are moving fast, \(T\) is high. \[ T = \frac{1}{2}mv^2 \quad (\text{or for rotational: } \frac{1}{2}\omega^T I \omega) \]
Potential Energy (\(V\)) is stored energy. If you are high up on a cliff, gravity’s potential \(V\) to pull you down is high. \[ V = mgh \]
The Lagrangian (\(\mathcal{L}\)) and the Euler-Lagrange Equations
Lagrange defined a single, massive scalar function—the Lagrangian (\(\mathcal{L}\))—which is simply the total Kinetic Energy of the entire system minus its total Potential Energy: \[\begin{equation} \mathcal{L}(\bm{q}, \dot{\bm{q}}) = T(\bm{q}, \dot{\bm{q}}) - V(\bm{q}) \end{equation}\]
Where \(\bm{q}\) are the generalized coordinates (the motor angles) we defined back in Chapter 3.
Because the Lagrangian is built on generalized coordinates, it completely ignores the “Constraint Forces”. The equations naturally assume the metal rod cannot stretch; you never have to calculate its tension.
To extract the exact Newtonian equations of motion from this single scalar function \(\mathcal{L}\), we pass it through the magnificent Euler-Lagrange Equation: \[\begin{equation} \frac{d}{dt} \left( \frac{\partial \mathcal{L}}{\partial \dot{q}_i} \right) - \frac{\partial \mathcal{L}}{\partial q_i} = \tau_i \end{equation}\]
For every single joint coordinate \(i\), this equation operates mechanically on the energy field. The time derivative of the momentum (first term) minus the spatial gradient of the energy (second term) perfectly equals the external Torque (\(\tau_i\)) that must be applied by the motor!
Deriving the Standard Form
When you apply the Euler-Lagrange equation to the Kinetic Energy \(T = \frac{1}{2}\dot{\bm{q}}^T M(\bm{q})\dot{\bm{q}}\) of a deeply connected robotic chain, the calculus organically unpacks into three vastly distinct physical phenomena that constitute the standard equation of motion:
\[\begin{equation} M(\bm{q})\ddot{\bm{q}} + C(\bm{q}, \dot{\bm{q}})\dot{\bm{q}} + \frac{\partial V}{\partial \bm{q}} = \bm{\tau} \end{equation}\]
1. The Mass Matrix (\(M(\bm{q})\))
The strict mass/inertia of the configuration. This is exactly what the Articulated Body Algorithm avoids inverting.
2. The Coriolis and Centripetal Matrix (\(C(\bm{q}, \dot{\bm{q}})\))
This matrix \(C\) naturally “falls out” of the calculus derivative! Because the joints of a robot spin, the coordinate frames themselves are accelerating. * Centripetal Forces: Proportional to \(\dot{q}_i^2\). They pull the arm outward as a joint spins. * Coriolis Forces: Proportional to \(\dot{q}_i \dot{q}_j\), where \(i \neq j\). If your torso is spinning violently, and you attempt to punch your arm straight out, the Coriolis force violently yanks your fist to the side.
3. The Gravity Vector (\(\frac{\partial V}{\partial \bm{q}}\))
The spatial derivative of the Potential Energy naturally yields the exact vector of gravitational torques dragging down on every single joint. It is often written cleanly as \(G(\bm{q})\).
Why Both Formulations Exist
In Tangent-Space Methods, as with all advanced robotics platforms, you will see both Euler-Lagrange and Newton-Euler used routinely, depending on the computational goal.
- We use Euler-Lagrange when we are analytically designing the control law (such as Contraction Metrics in Volume I). The elegant \(M, C, G\) matrices allow us to explicitly cancel gravity conceptually or prove mathematical stability.
- We use Recursive Newton-Euler when code is executing inside the physics simulation (Volume II benchmarks). Finding the actual numerical torque pushing a 15-DOF golf club inside Python is hundreds of times faster using Newton-Euler ABA tracking than unpacking the massive \(C(\dot{\bm{q}}, \bm{q})\) matrix algebraically.