I've seen this equation for calculating the dynamics of a robotic arm a bunch:

$\boldsymbol{\tau} = \boldsymbol{M}(\boldsymbol{q})\ddot{\boldsymbol{q}} + \boldsymbol{C}(\boldsymbol{q},\dot{\boldsymbol{q}})\dot{\boldsymbol{q}} + \boldsymbol{G}(\boldsymbol{q})$

Now, I believe I have the ${M}$ and ${G}$ terms calculated properly (though not through single matrices, which perhaps is an error in itself) as well as a reasonably good PID controller, so I've been researching how to get ${C}$, which represents both centrifugal and Coriolis effects. My robot is pretty unstable without it, but I cannot figure out how to compute it. I don't have access to MATLAB; I'm using C++ with ROS and MoveIt!, so I can easily get the Jacobians and many other features of my robot.

Can anyone help me out? Everyone seems to just be saying along the lines of "Now calculate ${C}$..."

  • $\begingroup$ Are you familiar with the Euler-Lagrange equation? $\endgroup$
    – fibonatic
    Jan 10, 2018 at 17:21
  • $\begingroup$ @fibonatic I can become familiar with it. Could you please walk me through exactly how it applies? $\endgroup$
    – River Tam
    Jan 10, 2018 at 17:38
  • $\begingroup$ I'm familiar with the fact that there are two methods of calculating these terms -- the Newton-Euler method and the Lagrangian approach, but I have not really heard of the Euler-Lagrange equation. $\endgroup$
    – River Tam
    Jan 10, 2018 at 17:42
  • $\begingroup$ the Euler-Lagrange equation is just another name for Lagrangian mechanics. $\endgroup$
    – fibonatic
    Jan 10, 2018 at 19:03
  • 1
    $\begingroup$ Yeah, if you don't have a symbolic representation for $M$ then the approach I cited won't help. You might want to check out Chapter 6 of Paul's book Robot Manipulators, in which he computes the Dynamics matrix $D$ using individual link masses instead of $M$. $\endgroup$
    – SteveO
    Jan 11, 2018 at 14:41

2 Answers 2


Chapter 4 of this Cal tech paper derives C based on partial derivatives of the inertia matrix M and joint velocities. I think their explanation, which is based on Lagrangian dynamics, is pretty clear.

  • $\begingroup$ I see... equations 4.29 and 4.30 are particularly enlightening to me (though I've seen 4.29 before, but not 4.30). Unfortunately, I understand extremely little of the notation in 4.30. I believe I understand how to get the twists, and I know how to transpose a matrix, but after that I'm pretty baffled. I don't understand the definition of A, I don't even see a definition for... cursive A?, and I haven't the foggiest idea what the double arrows and line subscripts are. A d keeps popping up everywhere... Do you think you could point me to a resource that would help me grok this? $\endgroup$
    – River Tam
    Jan 10, 2018 at 21:47
  • $\begingroup$ (thank you for your response, by the way; couldn't fit that into my last comment) $\endgroup$
    – River Tam
    Jan 10, 2018 at 21:50
  • $\begingroup$ @RiverTam - It looks like Equation 4.23 gives you the explicit definition for C and 4.11 gives the results of an actual example. $\endgroup$
    – Chuck
    Jan 10, 2018 at 22:15
  • $\begingroup$ @Chuck Equation 4.29 gives the same definition, and 4.11 is for a specific, relatively simple case (where they don't use the general definition). I'm not sure how I could use 4.11 to help me derive C for a 6 DOF robot in 3 dimensions... They seem to be using the "hard-coded" equations for kinetic energy in two dimensions. This is not such a simple problem for me... $\endgroup$
    – River Tam
    Jan 10, 2018 at 22:34
  • $\begingroup$ I don't have it in front of me, but I remember Paul's book walking through the entire Lagrangian dynamics formulation in general, then applying it. $\endgroup$
    – SteveO
    Jan 10, 2018 at 22:36

If you're calculating the moment of inertia for each link relative to each joint, then that's M! The only "tricky" thing to be aware of is that the moments of inertia compound - you must take into account the subsequent joints.

Consider your arm.

  1. You have a hand, which has some moment of inertia. Your wrist joint must accelerate your hand to get motion from your hand. Use the parallel axis theorem to translate the moment of inertia from your hand center of mass to the wrist joint.
  2. You have a forearm, which also has some moment of inertia. Your elbow must accelerate your forearm, BUT IT MUST ALSO ACCELERATE YOUR HAND. Your hand is attached to the forearm by the wrist. Now you need the parallel axis theorem to translate the moment of inertia of your forearm to your elbow, AND you need the parallel axis theorem to translate the moment of inertia from your hand to your elbow.

In step 1, the distance you used for the parallel axis theorem was the distance from its center of mass to the wrist, but in step 2 you need the distance from the hand to the elbow, which is a function of the wrist angle.

Everything compounds again when you go to the shoulder - upper arm is easy, center of mass to the shoulder, but now forearm (relative to shoulder) is a function of elbow angle and hand (relative to shoulder) is a function of wrist angle AND elbow angle.

The shoulder has to accelerate the upper arm AND the forearm AND the hand. The effective moment of inertia for the shoulder joint must include the transformed moments of inertia for all subsequent joints.

  • $\begingroup$ Thanks for your help by the way. Yes, I'm including the moments of inertia for each subsequent joint. I suppose what I have does look like a matrix with all zeroes on one side of it -- it didn't occur to me that that is M (I'm representing it in C++ as a std::vector<std::vector<double>> where the inner vectors are of length 6 - i). I suppose, then, I do have M, but I don't have an equation for M. I'm using MoveIt! to get the distances and using an iterative process to calculate these terms, so I'm not sure how I could efficiently compute a partial derivative of this process. $\endgroup$
    – River Tam
    Jan 11, 2018 at 14:57

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.