# Joint torques and Jacobian transpose

Some concepts, when you learn them, seem to connect with what you already know and build new objects that make sense, that is, with the approval of your reason. This is the ideal scenario. It is likely that things flow nicely because the intellectual path has been "polished" by previous travelers. (Sometimes the fruit of centuries of effort and heated debates, such as the conciliation of Euclidean and analytical geometry in mathematics.) And then, there are the unpolished ones, those ideas and techniques that are still rough around the edges. Papers and code seem to take for granted, so most likely they work, yet there's no consensual explanation easy to find in the literature.

At the time I was a graduate student, the following equation was one of these rough edges for me. Every once in a while I would run into a paper on humanoid robots that would compute the joint torques cause by contact forces using the transpose of the contact Jacobian:

with \(\bftau_c\) the vector of joint torques caused by contact forces, \(\bfJ_c\) the Jacobian of the contact constraint (for instance foot contacts with the ground for a biped), \(\bfq\) the configuration vector of joint angles and floating-base coordinates, and \(\bff\) the vector of contact forces applied by the environment onto the robot. Papers would mention it derives from the principle of virtual work, sometimes with no reference, sometimes with a reference to a textbook on fixed-base manipulators (humanoids are floating-base robots).

This equation is correct, yet I've been on the lookout for years before finding
a proof that did not cost me a leap of faith. (Are the assumptions clear? Is
every step of the demonstration correct?) Part of this is due to the evolution
of the literature from manipulators to floating-base robots: while the
confusion was not a big deal with the former, with the latter we should bear in
mind that \(\bftau_c\) is not the vector of actuated joint torques of the
robot, but only the *contribution* to these torques caused by contact forces.
As of today, the clearest demonstration I could find is the derivation from
the principle of least constraint.
It leads us to the constrained equation of motion, where we can see other
contributions from gravity, the centripetal and Coriolis effects:

Enough with the history! Here is a bonus question to see if you understand these concepts better from today's literature: did you know that the vector of joint torques caused by gravity can in fact be written as follows?

Here \(\bfg\) is the three-dimensional acceleration due to gravity, \(m\) is the total mass of the robot and \(\bfJ_{\mathrm{CoM}}\) is the Jacobian of the center-of-mass position. Hint: the answer derives from the principle of least action. It is also written down somewhere linked from this website ;-)