Transformation for simGetShapeMassAndInertia

Typically: "How do I... ", "How can I... " questions
me1
Posts: 1
Joined: 07 Sep 2017, 11:51

Transformation for simGetShapeMassAndInertia

Postby me1 » 07 Sep 2017, 12:07

Hi,
I was using simGetShapeMassAndInertia to verify if the inertia using simSetShapeMassAndInertia is correctly set. The shape hexa is at 0,0,1 in the absolute frame.

This is what I entered,

Code: Select all

simSetShapeMassAndInertia(hexa, 6.047, {0.04533008, 0.0, 0.0, 0.0, 0.04166828, 0.0, 0.0, 0.0, 0.05198795},simGetObjectPosition(hexa,-1),nil)

M,I,COM = simGetShapeMassAndInertia(hexa,nil)
print("Inertia Row 1",I[1], I[2], I[3])
print("Inertia Row 2", I[4], I[5], I[6])
print("Inertia Row 3", I[7], I[8], I[9])


However, this time I get a different value as output, which seems to be transformed:
Inertia Row 1 6,0923295021057 5,3287121893827e-13 4,980077461525e-11
Inertia Row 2 5,3287121893827e-13 6,088668346405 -1,5287369981021e-10
Inertia Row 3 4,980077461525e-11 -1,5287369981021e-10 0,051987878978252


Shouldn't it return the same value that I set, given that the transformation I am specifying is nil, or relative to absolute frame for both cases? Did I miss something?
How to specify inertia relative to Centre of Mass and in body frame?

Thanks a lot,
mon

coppelia
Site Admin
Posts: 6066
Joined: 14 Dec 2012, 00:25

Re: Transformation for simGetShapeMassAndInertia

Postby coppelia » 10 Sep 2017, 13:22

Hello,

The inertia that is returned to you is seen from the origin. You should rather do following to retrieve the same data:

Code: Select all

simSetShapeMassAndInertia(hexa, 6.047, {0.04533008, 0.0, 0.0, 0.0, 0.04166828, 0.0, 0.0, 0.0, 0.05198795},simGetObjectPosition(hexa,-1),nil)
local m=simBuildMatrix(simGetObjectPosition(hexa,-1),{0,0,0})
M,I,COM = simGetShapeMassAndInertia(hexa,m)


Cheers


Return to “General questions”

Who is online

Users browsing this forum: No registered users and 23 guests