The equations of motion for a robot manipulator and their relationship to the Euler-Lagrange equation are well known in the field of robotics, and yet I was unable to find a single source that provides the derivation. I suppose it’s one of those “the solution is trivial and is left as an exercise to the reader” situations. As such, I’m providing one here for dummies like me who need it spelled out step-by-step.
Let’s start with the Euler-Lagrange equation.
$$ \begin{equation} \frac{d}{dt}\biggl[\frac{\partial L}{\partial\dot{q}}\biggr] - \frac{\partial L}{\partial q} = 0 \end{equation} $$
Now we add a non-conservative generalized force $\tau$, which can represent damping or input torque.
$$ \begin{equation} \frac{d}{dt}\biggl[\frac{\partial L}{\partial\dot{q}}\biggr] - \frac{\partial L}{\partial q} = \tau \end{equation} $$
Recall that the Lagrangian $L$ is a function of the vector of generalized coordinates $q(t)$, its time derivative $\dot{q}(t)$, and time $t$. We typically hide this function notation to keep the equations pretty, but it’s important to recognize so that we can perform differential calculus on it.
$$ \begin{equation} L = L(q(t), \dot{q}(t), t) \end{equation} $$
Recall also that the Lagrangian is equal to the sum of the kinetic and potential energy terms.
$$ \begin{equation} L = T - U \end{equation} $$
Taking the partial derivative of that with respect to $q$, we get:
$$ \begin{equation} \frac{\partial L}{\partial q} = \frac{\partial T}{\partial q} - \frac{\partial U}{\partial q} \end{equation} $$
This we can plug back into equation 2:
$$ \begin{equation} \frac{d}{dt}\biggl[\frac{\partial L}{\partial\dot{q}}\biggr] - \frac{\partial T}{\partial q} + \frac{\partial U}{\partial q} = \tau \end{equation} $$
As for the first term, we can use the chain rule to expand it:
$$ \begin{equation} \frac{d}{dt}\biggl[\frac{\partial L}{\partial\dot{q}}\biggr] = \biggl[\frac{\partial^2 L}{\partial\dot{q}^2}\biggr] \ddot{q} + \biggl[\frac{\partial^2 L}{\partial q \partial\dot{q}}\biggr]\dot{q} + \frac{\partial}{\partial t} \biggl[\frac{\partial L}{\partial \dot{q}}\biggr] \end{equation} $$Plugging equation 7 back into equation 6, we get:
$$ \begin{equation} \underbrace{\biggl[\frac{\partial^2 L}{\partial\dot{q}^2}\biggr]}_{M} \ddot{q} + \underbrace{\biggl[\frac{\partial^2 L}{\partial q \partial\dot{q}}\biggr]\dot{q} - \frac{\partial T}{\partial q}}_C + \underbrace{\frac{\partial U}{\partial q}}_G + \underbrace{\frac{\partial}{\partial t} \biggl[\frac{\partial L}{\partial \dot{q}}\biggr]}_{\text{time-varying term}}= \tau \end{equation} $$We can ignore the time derivative term for a time-invariant system (a safe assumption for most robotic manipulators).
$$ \begin{equation} \underbrace{\biggl[\frac{\partial^2 L}{\partial\dot{q}^2}\biggr]}_{M} \ddot{q} + \underbrace{\biggl[\frac{\partial^2 L}{\partial q \partial\dot{q}}\biggr]\dot{q} - \frac{\partial T}{\partial q}}_C + \underbrace{\frac{\partial U}{\partial q}}_G = \tau \end{equation} $$ $$ \begin{equation} M(q)\ddot{q} + C(q, \dot{q}) + G(q) = \tau \end{equation} $$