Algorithm Search⌘K

Techniqueintro

Euler-Lagrange dynamics of a manipulator

Also called Lagrangian dynamics of manipulators.

Derives the manipulator equation from energy. Write the kinetic energy (1/2) q'^T M(q) q' and the potential P(q), then the Euler-Lagrange equations give M, the Coriolis matrix C and gravity g.

Euler-Lagrange manipulator dynamics is the method that derives the equation of motion of a robot arm from its energy. You write the kinetic energy of the links as 12q˙TM(q)q˙\tfrac12 \dot q^T M(q)\dot q and their potential energy P(q)P(q), and you apply the Euler-Lagrange equation to each joint. The result is the manipulator equation M(q)q¨+C(q,q˙)q˙+g(q)=τM(q)\ddot q + C(q, \dot q)\dot q + g(q) = \tau, with CC built from the derivatives of MM and gg the gradient of PP. The method needs no internal forces between the links, which is how it differs from the Newton-Euler equations used link by link.

In plain words

A robot arm stores energy in two ways. Moving links have kinetic energy, and links that are lifted have potential energy. If you can write both as functions of the joint angles and their rates, one fixed recipe turns them into the torque that each motor must give. The recipe takes derivatives only. You never need the forces that one link puts on the next, because those forces do no net work. The price is algebra: for an arm with many joints, the expressions become long, so the method is best for small arms, for symbolic models and for proofs about the structure of the equations.

When it applies

  • The robot is a set of rigid bodies joined by joints, in a serial chain or a tree, so that the joint variables q∈Rnq \in \mathbb{R}^n are independent generalized coordinates. Closed chains and contacts need extra constraints (see Variations).
  • The reference frame {s}\{s\} is inertial. Gravity is g=(0,0,−9.81)g = (0, 0, -9.81) m/s2^2 in {s}\{s\}, with zz up.
  • The applied forces are gravity, which has a potential, and other forces that enter as generalized forces: the joint torques τ\tau, external wrenches through J(q)TFextJ(q)^T F_{\text{ext}}, and friction.
  • It is the method of choice when you want the equation in closed form, for a control proof such as skew symmetry or linearity in the parameters, or for an arm with two or three joints. For numerical work on long chains, the recursive Newton-Euler algorithm is faster.

The template

  1. Choose the joint variables q=(q1,…,qn)q = (q_1, \dots, q_n) and the forward kinematics of each link: the center of mass pci(q)p_{ci}(q) in {s}\{s\} and the orientation Ri(q)R_i(q) of a frame {i}\{i\} at the center of mass.
  2. Compute the Jacobians Jvi(q)J_{vi}(q) with p˙ci=Jviq˙\dot p_{ci} = J_{vi}\dot q and Jωi(q)J_{\omega i}(q) with ωi=Jωiq˙\omega_i = J_{\omega i}\dot q, the angular velocity in {i}\{i\} coordinates.
  3. Form the joint-space inertia matrix M(q)=∑i(miJviTJvi+JωiTIiJωi)M(q) = \sum_i \big(m_i J_{vi}^T J_{vi} + J_{\omega i}^T \mathcal{I}_i J_{\omega i}\big), so that K=12q˙TM(q)q˙K = \tfrac12 \dot q^T M(q)\dot q.
  4. Form the potential energy P(q)=∑imi 9.81 zci(q)P(q) = \sum_i m_i\, 9.81\, z_{ci}(q), where zciz_{ci} is the height of the center of mass.
  5. Write the Lagrangian L=K−P\mathcal{L} = K - P and the equations ddt∂L∂q˙k−∂L∂qk=τk\frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot q_k} - \frac{\partial \mathcal{L}}{\partial q_k} = \tau_k for k=1,…,nk = 1, \dots, n.
  6. Expand them into M(q)q¨+C(q,q˙)q˙+g(q)=τM(q)\ddot q + C(q, \dot q)\dot q + g(q) = \tau with
cijk(q)=12(∂Mkj∂qi+∂Mki∂qj−∂Mij∂qk),Ckj(q,q˙)=∑i=1ncijk(q) q˙i,gk(q)=∂P∂qk.c_{ijk}(q) = \frac12\left(\frac{\partial M_{kj}}{\partial q_i} + \frac{\partial M_{ki}}{\partial q_j} - \frac{\partial M_{ij}}{\partial q_k}\right),\qquad C_{kj}(q, \dot q) = \sum_{i=1}^n c_{ijk}(q)\,\dot q_i,\qquad g_k(q) = \frac{\partial P}{\partial q_k}.

The numbers cijkc_{ijk} are the Christoffel symbols of the first kind. Lynch and Park write them as Γkij\Gamma_{kij} with the row index first (Section 8.1.2); the values are the same.

Why step 6 is right. From K=12∑i,jMijq˙iq˙jK = \tfrac12 \sum_{i,j} M_{ij}\dot q_i\dot q_j we get ∂L/∂q˙k=∑jMkjq˙j\partial \mathcal{L}/\partial \dot q_k = \sum_j M_{kj}\dot q_j, so

ddt∂L∂q˙k=∑jMkjq¨j+∑i,j∂Mkj∂qiq˙iq˙j,∂L∂qk=12∑i,j∂Mij∂qkq˙iq˙j−∂P∂qk.\frac{d}{dt}\frac{\partial \mathcal{L}}{\partial \dot q_k} = \sum_j M_{kj}\ddot q_j + \sum_{i,j}\frac{\partial M_{kj}}{\partial q_i}\dot q_i\dot q_j,\qquad \frac{\partial \mathcal{L}}{\partial q_k} = \frac12\sum_{i,j}\frac{\partial M_{ij}}{\partial q_k}\dot q_i\dot q_j - \frac{\partial P}{\partial q_k}.

The sum ∑i,j∂Mkj∂qiq˙iq˙j\sum_{i,j}\frac{\partial M_{kj}}{\partial q_i}\dot q_i\dot q_j does not change if ii and jj swap, so it equals 12∑i,j(∂Mkj∂qi+∂Mki∂qj)q˙iq˙j\frac12\sum_{i,j}\big(\frac{\partial M_{kj}}{\partial q_i} + \frac{\partial M_{ki}}{\partial q_j}\big)\dot q_i\dot q_j. Subtracting gives ∑jMkjq¨j+∑i,jcijkq˙iq˙j+∂P/∂qk=τk\sum_j M_{kj}\ddot q_j + \sum_{i,j} c_{ijk}\dot q_i\dot q_j + \partial P/\partial q_k = \tau_k, which is the claimed form.

Terms with i=ji = j in ∑i,jcijkq˙iq˙j\sum_{i,j} c_{ijk}\dot q_i\dot q_j are centripetal terms, and terms with i≠ji \ne j are Coriolis terms.

Classic examples

A single link. One revolute joint, a link of mass mm with its center of mass at distance rr and inertia II about it, in a vertical plane, with qq measured from the horizontal. Then K=12(I+mr2)q˙2K = \tfrac12 (I + m r^2)\dot q^2 and P=m 9.81 rsin⁡qP = m\, 9.81\, r\sin q, so τ=(I+mr2)q¨+9.81 mrcos⁡q\tau = (I + m r^2)\ddot q + 9.81\, m r\cos q. There is no velocity term, because MM is constant.

The planar 2R arm with point masses. Take L1=L2=1L_1 = L_2 = 1 m, point masses of 1 kg at the link ends, in a vertical plane with heights measured upward and q1q_1 from the horizontal. Write s2=sin⁡q2s_2 = \sin q_2, c2=cos⁡q2c_2 = \cos q_2, c1=cos⁡q1c_1 = \cos q_1 and c12=cos⁡(q1+q2)c_{12} = \cos(q_1 + q_2).

Steps 1 to 3. The masses are at p1=(c1,sin⁡q1)p_1 = (c_1, \sin q_1) and p2=p1+(c12,sin⁡(q1+q2))p_2 = p_1 + (c_{12}, \sin(q_1 + q_2)). Their speeds are ∥p˙1∥2=q˙12\|\dot p_1\|^2 = \dot q_1^2 and ∥p˙2∥2=q˙12+(q˙1+q˙2)2+2c2 q˙1(q˙1+q˙2)\|\dot p_2\|^2 = \dot q_1^2 + (\dot q_1 + \dot q_2)^2 + 2c_2\,\dot q_1(\dot q_1 + \dot q_2). Collecting the terms of K=12∥p˙1∥2+12∥p˙2∥2K = \tfrac12\|\dot p_1\|^2 + \tfrac12\|\dot p_2\|^2:

M(q)=[3+2c21+c21+c21].M(q) = \begin{bmatrix} 3 + 2c_2 & 1 + c_2 \\ 1 + c_2 & 1\end{bmatrix}.

Step 4. P=9.81 (2sin⁡q1+sin⁡(q1+q2))P = 9.81\,(2\sin q_1 + \sin(q_1 + q_2)).

Step 6. Only M11M_{11} and M12M_{12} depend on q2q_2, with ∂M11/∂q2=−2s2\partial M_{11}/\partial q_2 = -2s_2 and ∂M12/∂q2=−s2\partial M_{12}/\partial q_2 = -s_2. The nonzero symbols are c121=c211=c221=−s2c_{121} = c_{211} = c_{221} = -s_2 and c112=s2c_{112} = s_2. So

C(q,q˙)=[−s2q˙2−s2(q˙1+q˙2)s2q˙10],g(q)=9.81[2c1+c12c12].C(q, \dot q) = \begin{bmatrix} -s_2\dot q_2 & -s_2(\dot q_1 + \dot q_2) \\ s_2\dot q_1 & 0\end{bmatrix},\qquad g(q) = 9.81\begin{bmatrix} 2c_1 + c_{12} \\ c_{12}\end{bmatrix}.

The torques are

τ1=(3+2c2)q¨1+(1+c2)q¨2−s2(2q˙1q˙2+q˙22)+9.81(2c1+c12),\tau_1 = (3 + 2c_2)\ddot q_1 + (1 + c_2)\ddot q_2 - s_2(2\dot q_1\dot q_2 + \dot q_2^2) + 9.81(2c_1 + c_{12}),
τ2=(1+c2)q¨1+q¨2+s2q˙12+9.81 c12.\tau_2 = (1 + c_2)\ddot q_1 + \ddot q_2 + s_2\dot q_1^2 + 9.81\,c_{12}.

Numbers. At q=(0,π/2)q = (0, \pi/2), q˙=(1,1)\dot q = (1, 1) rad/s and q¨=0\ddot q = 0, without gravity, Cq˙=(−1−2,1)=(−3,1)C\dot q = (-1 - 2, 1) = (-3, 1), so τ=(−3,1)\tau = (-3, 1) N m. The arm needs these torques just to keep its joint rates constant. With gravity, g(q)=(19.62,0)g(q) = (19.62, 0) and τ=(16.62,1)\tau = (16.62, 1) N m. At rest in the stretched horizontal pose q=(0,0)q = (0, 0), τ=g(q)=(29.43,9.81)\tau = g(q) = (29.43, 9.81) N m: the holding torques are 9.819.81 N times the horizontal lever arms, 1+2=31 + 2 = 3 m for joint 1 and 11 m for joint 2.

The 2R arm with general links. With center-of-mass distances r1r_1, r2r_2 and inertias I1I_1, I2I_2, the same steps give MM with the entries a1+a2+2a3c2a_1 + a_2 + 2a_3c_2, a2+a3c2a_2 + a_3c_2 and a2a_2, where a1=I1+m1r12+m2L12a_1 = I_1 + m_1r_1^2 + m_2L_1^2, a2=I2+m2r22a_2 = I_2 + m_2r_2^2 and a3=m2L1r2a_3 = m_2L_1r_2, and CC is the matrix above with s2s_2 replaced by a3s2a_3s_2. Gravity is g(q)=(a4c1+a5c12, a5c12)g(q) = (a_4c_1 + a_5c_{12},\ a_5c_{12}) with a4=9.81(m1r1+m2L1)a_4 = 9.81(m_1r_1 + m_2L_1) and a5=9.81 m2r2a_5 = 9.81\,m_2r_2. The torque is linear in (a1,…,a5)(a_1, \dots, a_5); this is the linearity in the dynamic parameters.

A Cartesian gantry. Three prismatic joints along xx, yy and zz, each stage carrying the next. M=diag(m1+m2+m3,m2+m3,m3)M = \mathrm{diag}(m_1 + m_2 + m_3, m_2 + m_3, m_3) is constant, so C=0C = 0, and only the vertical joint feels gravity: g(q)=(0,0,9.81 m3)g(q) = (0, 0, 9.81\,m_3). Each joint is a mass driven by a force.

Variations

  • Closed form with Jacobians. Lynch and Park (Section 8.4) stack the link twists and write M(q)=ATLTGLAM(q) = \mathcal{A}^T\mathcal{L}^T\mathcal{G}\mathcal{L}\mathcal{A} and a matching expression for c(q,q˙)=Cq˙c(q, \dot q) = C\dot q, with block matrices built from the screw axes and the link inertias. This gives the same equation without symbolic differentiation.
  • Recursive Lagrangian. Hollerbach (1980) organized the Lagrangian computation recursively along the chain and showed that it can be made to grow linearly in nn, like the Newton-Euler recursion.
  • Constraints. If the robot closes a loop or touches the world, the constraints A(q)q˙=0A(q)\dot q = 0 add a force A(q)TλA(q)^T\lambda with multipliers λ\lambda: Mq¨+Cq˙+g=τ+ATλM\ddot q + C\dot q + g = \tau + A^T\lambda (Lynch and Park, Section 8.7). See Pfaffian constraint and the Gauss principle of least constraint.
  • Nonconservative forces. Friction torques and external wrenches enter on the right side as generalized forces, τ−τf(q˙)+J(q)TFext\tau - \tau_f(\dot q) + J(q)^T F_{\text{ext}}. They do not go into the Lagrangian.
  • Motor inertia. A motor with rotor inertia IrI_r and gear ratio GrG_r adds about Gr2IrG_r^2 I_r to the diagonal entry of its joint (Lynch and Park, Section 8.9).
  • Floating base. A legged robot or a humanoid adds six coordinates for the pose of its base; see floating-base dynamics.

Pitfalls

  • Velocity of the wrong point. KK needs the velocity of the center of mass of each link, not of the origin of the link frame. If you use another point, you must add the cross term of the spatial inertia.
  • Frames of ω\omega and I\mathcal{I}. The rotational energy 12ωTIω\tfrac12\omega^T\mathcal{I}\omega needs both in the same frame. In body coordinates I\mathcal{I} is constant; in {s}\{s\} it is R IRTR\,\mathcal{I}R^T and changes with qq.
  • Angles. In a planar arm with relative angles, link ii turns at q˙1+⋯+q˙i\dot q_1 + \dots + \dot q_i, not at q˙i\dot q_i.
  • Many matrices CC. Any C′C' with C′q˙=Cq˙C'\dot q = C\dot q gives the same equation of motion. Only the Christoffel choice of step 6 makes M˙−2C\dot M - 2C skew-symmetric, which many control proofs need.
  • Signs of gravity. g(q)=+∂P/∂qg(q) = +\partial P/\partial q appears on the left side. A sign error here makes gravity compensation push the arm down.
  • Cost. Expanding the symbols by hand or with computer algebra grows quickly with nn. Hollerbach (1980) compared the operation counts of the formulations; the direct Lagrangian evaluation (the Uicker and Kahn form) grows as about n4n^4, and the recursive forms grow as nn. Use the closed form for analysis and a recursive algorithm for simulation and control.

Exercises

  1. A link of mass 2 kg has its center of mass at r=0.5r = 0.5 m from the joint and I=0.1I = 0.1 kg m2^2 about it. Find the torque at q=0q = 0, q˙=0\dot q = 0 and q¨=1\ddot q = 1 rad/s2^2. Answer: (0.1+0.5)⋅1+9.81⋅2⋅0.5=10.41(0.1 + 0.5) \cdot 1 + 9.81 \cdot 2 \cdot 0.5 = 10.41 N m.
  2. For the point-mass 2R arm, find τ\tau at q=(0.3,0.7)q = (0.3, 0.7) rad, q˙=(0.5,−1.2)\dot q = (0.5, -1.2) rad/s and q¨=(2,−1)\ddot q = (2, -1) rad/s2^2 with gravity. Answer: τ=(31.184,7.991)\tau = (31.184, 7.991) N m.
  3. Show that C′=[−2s2q˙2−s2q˙2s2q˙10]C' = \begin{bmatrix} -2s_2\dot q_2 & -s_2\dot q_2 \\ s_2\dot q_1 & 0\end{bmatrix} gives C′q˙=Cq˙C'\dot q = C\dot q for the 2R arm, and that M˙−2C′\dot M - 2C' is not skew-symmetric at q2=π/2q_2 = \pi/2, q˙=(1,2)\dot q = (1, 2).
  4. Show that the gantry has cijk=0c_{ijk} = 0 for all indices, and explain why a constant MM always gives C=0C = 0.
  5. Show that q˙T(τ−g(q))=ddtK\dot q^T(\tau - g(q)) = \frac{d}{dt}K for any arm. This is the energy balance that the skew symmetry property expresses.

References

  1. Kevin M. Lynch and Frank C. Park, Modern Robotics, Mechanics, Planning, and Control, Cambridge University Press, 2017, Chapter 8, Section 8.1 (Lagrangian formulation): 8.1.1 basic concepts and motivating examples, 8.1.2 general formulation (the Christoffel symbols and the Coriolis matrix), 8.1.4 Lagrangian versus Newton-Euler dynamics; Section 8.7 (constrained dynamics)
  2. Mark W. Spong, Seth Hutchinson and M. Vidyasagar, Robot Modeling and Control, second edition, Wiley, 2020, Chapter 6, Section 6.1 (the Euler-Lagrange equations), Section 6.2 (kinetic and potential energy), Section 6.3 (equations of motion) and Section 6.4 (some common configurations)
  3. Bruno Siciliano, Lorenzo Sciavicco, Luigi Villani and Giuseppe Oriolo, Robotics, Modelling, Planning and Control, Springer, 2009, Chapter 7 (the Lagrange formulation of manipulator dynamics)
  4. John M. Hollerbach, A recursive Lagrangian formulation of manipulator dynamics and a comparative study of dynamics formulation complexity, IEEE Transactions on Systems, Man, and Cybernetics 10(11), 730-736, 1980, the whole paper (the recursive Lagrangian form and the comparison of operation counts)

Where this leads

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH0 no proof
  • add a proof in proofs/ (06.5)
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • three classic examples