Why do rigid bodies' moment of inertia values seemingly change when generating a model with 'smimport' in MATLAB R2022a?
3 views (last 30 days)
Show older comments
MathWorks Support Team
on 1 Nov 2023
Answered: MathWorks Support Team
on 2 Nov 2023
I am calling the 'smimport' command to generate a Simscape model from a 'rigidBodyTree' object in MATLAB R2022a. However, the "Moment of Inertia" values in the generated rigid body subsystems' 'Inertia' blocks differ from those defined in the 'rigidBody' objects. Why are these values changing?
Accepted Answer
MathWorks Support Team
on 1 Nov 2023
The different moment of inertia values in the Simscape 'Inertia' blocks is due to the generalized version of the parallel axis theorem being applied when generating the Simscape model from rigid bodies with an offset center of mass, with the rigid body's center of mass taken as the displacement vector. Given a 'rigidBodyTree' object 'myRigidBodyTree' whose second body has an offset center of mass, you can execute the following code within MATLAB to reproduce the body's original moment of inertia values and confirm that the transformed values are as expected:
smimport(myRigidBodyTree);
% Mass (m) and vector (r) to center of mass from rigid body tree reference
% frame
m = myRigidBodyTree.Bodies{2}.Mass;
r = -myRigidBodyTree.Bodies{2}.CenterOfMass'; % (note the transpose to make this a column vector)
% Define inertia matrix from Simscape Multibody 'Inertia' block values about the
% center of mass frame
moi = [Ixx Iyy Izz]; % moments of inertia
poi = [Iyz Ixz Ixy]; % products of inertia
Icm = [moi(1) poi(3) poi(2); poi(3) moi(2) poi(1); poi(2) poi(1) moi(3)];
% Then use the general parallel axis theorem to verify the inertia tensor
% returned from rigid body tree reference frame is a transformed version of the
% inertia tensor about the center of mass frame from Simscape Multibody
I = Icm + m*(dot(r,r)*eye(3) - r*r')
0 Comments
More Answers (0)
See Also
Categories
Find more on Bodies in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!