calculateMassMatrix question

Official Python bindings with a focus on reinforcement learning and robotics.
Post Reply
Posts: 8
Joined: Fri Nov 10, 2017 7:05 pm

calculateMassMatrix question

Post by elkmug »

I've been doing some experiments that require the mass matrix.

Pybullet has a calculateMassMatrix method, but it's output is not what I expected.
I expected that all values, except on the diagonal, would be zero and they're not.

I assume this output is correct and I'm just not understanding things properly,
because that is my default stance when it comes to physics, but could anybody
tell me what's going on here?



TL;DR- The values in this matrix are joint acceleration and force vectors

Long-winded version:

Mass matrices are used in so many different fields in so many different ways that the subject is pretty wide and darned deep. Which makes research kind of confusing. There are consistent mass matrices & lump mass matrices, and Wikipedia only gives a passing nod to that fact, even though it seems like a pretty big deal.

On top of that, I'm not sure whether that distinction even applies to calculateMassMatrix, because what people working with multibody simulation & robotics commonly refer to as the mass matrix is often actually the joint space inertia matrix. This also goes by other names. Like the ungainly 'mass inertia matrix in joint space'; which just adds to the 'fun' of researching it.

There is probably very authoritative information about the joint space inertia matrix in these two books, available from Amazon or from their publisher, Springer.

Efficient Dynamic Simulation of Robotic Mechanisms, by Kathryn Lilly
Rigid Body Dynamics Algorithms, by Roy Featherstone

I say probably because these are quite pricey, even as ebooks, so I can't really check. Though Springer will 'generously' sell you single chapters, ala-carte, for $29.95 a pop.(Just FYI; the Los Angeles County Public Library, which is fricking huge, has neither book)

But, persistance and a lot of free time paid off. I found this old pre-print paper by Featherstone at

On page 4 we get an overview of what the values of a joint space inertia matrix represent:
The joint acceleration and force vectors for the whole system will be n-dimensional vectors, and the JSIM will be an n x n matrix.
(Note: n is the total number of degrees of freedom in the multibody)

Though, which values are acceleration and which values are force isn't really explained and is unclear to me at the moment, but I now have, at least, a rough idea of what's what.
Post Reply