## calculateMassMatrix question

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

### calculateMassMatrix question

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?

-Jeff

Update:

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 http://users.cecs.anu.edu.au/~roy/papers/sparse.pdf

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.
{"ft_lang_label":"__label__en","ft_lang_prob":0.94696945,"math_prob":0.83982265,"size":2336,"snap":"2021-21-2021-25","text_gpt3_token_len":508,"char_repetition_ratio":0.09691252,"word_repetition_ratio":0.005235602,"special_character_ratio":0.2041952,"punctuation_ratio":0.11868132,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9508044,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-06-14T03:56:12Z\",\"WARC-Record-ID\":\"<urn:uuid:02417ac8-5ea3-4192-8f23-705d45b1620e>\",\"Content-Length\":\"22684\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:6565315b-3384-4c12-9202-7510204fd0bc>\",\"WARC-Concurrent-To\":\"<urn:uuid:5555ef28-b7f5-4bbf-b08c-357b00ce7c5c>\",\"WARC-IP-Address\":\"173.230.148.26\",\"WARC-Target-URI\":\"https://pybullet.org/Bullet/phpBB3/viewtopic.php?f=24&t=12519&p=41665&sid=60c01238bf517b1023e544b33b81e110\",\"WARC-Payload-Digest\":\"sha1:PY2TJUIUEG6TE32MIRVVY2MGGND4RYOK\",\"WARC-Block-Digest\":\"sha1:NHKXF4MHJETWGDHXESYOOKL337AHLGZ2\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-25/CC-MAIN-2021-25_segments_1623487611320.18_warc_CC-MAIN-20210614013350-20210614043350-00294.warc.gz\"}"}