Whole Body Angular Momentum?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Pawel Golyski
Posts: 2
Joined: Tue Jun 06, 2017 7:47 am

Whole Body Angular Momentum?

Post by Pawel Golyski » Sun Apr 11, 2021 5:17 pm

I am using a full body opensim model (Hamner 2010) and am hoping to calculate whole body angular momentum with respect to the center of mass of the whole body. I see I can get segment positions, velocities, orientations, and angular velocities from the Body Kinematics tool, but I want to make sure I am understanding the coordinate systems correctly.

Right now, I have "express_results_in_body_local_frame" unchecked in the Body Kinematics, so my translations and linear velocities of my individual segment centers of mass and the whole body center of mass are relative to the lab coordinate frame, which is great.

However, I would like to calculate the product of the moment of inertia of each body segment with its angular velocity and express that in the global coordinate frame. Is the moment of inertia of each segment given by Opensim expressed relative to the center of mass of each segment, while the angular velocity is expressed relative to the origin of the segment?

Tags:

User avatar
Carmichael Ong
Posts: 401
Joined: Fri Feb 24, 2012 11:50 am

Re: Whole Body Angular Momentum?

Post by Carmichael Ong » Mon Apr 12, 2021 3:10 pm

The moment of inertia for bodies in OpenSim are defined as about the body's center of mass. For angular velocity, if "express_results_in_body_local_frame" is unchecked, then the angular velocity of the body is given with respect to the lab (ground) frame.

User avatar
Pawel Golyski
Posts: 2
Joined: Tue Jun 06, 2017 7:47 am

Re: Whole Body Angular Momentum?

Post by Pawel Golyski » Tue Apr 13, 2021 6:07 am

Thank you! So this is the case even though the .sto file generated by Body Kinematics says: "Angular velocities and accelerations are given about the body-local axes." ?

User avatar
Carmichael Ong
Posts: 401
Joined: Fri Feb 24, 2012 11:50 am

Re: Whole Body Angular Momentum?

Post by Carmichael Ong » Tue Apr 13, 2021 3:49 pm

Ah, thanks for pointing that out. That header does not seem to update correctly. I'll look into this issue, but I think this issue only affects the header text and not the results.

The code for calculating the angular velocity is given here: https://github.com/opensim-org/opensim- ... s.cpp#L502

To be precise here, this is what the calculations seem to be doing:
1. Angular velocity is always the angular velocity of the body with respect to the ground frame.
2a. If "express_results_in_body_local_frame" is checked, then the angular velocity is re-expressed in the body's frame.
2b. If "express_results_in_body_local_frame" is not checked, then the angular velocity is expressed in the ground frame.

User avatar
Shabnam Sh
Posts: 2
Joined: Mon Nov 18, 2019 8:24 pm

Re: Whole Body Angular Momentum?

Post by Shabnam Sh » Tue Dec 05, 2023 5:23 am

Hi,

I am trying to the same. I got each segments inertia from the .osim file which apparently it's with respect to the segement's com. Do you know how can I get it with respect to whole body cenetr of mass? or in the global frame?

I really appreciate your help.

Thanks!
Shabnam

User avatar
Nicos Haralabidis
Posts: 196
Joined: Tue Aug 16, 2016 1:46 am

Re: Whole Body Angular Momentum?

Post by Nicos Haralabidis » Tue Dec 05, 2023 10:26 am

Hello Shabnam,

Do you want the whole body angular momentum expressed in the ground frame? As there are API methods to do this for you search for 'calcBodyMomentum' and you should see a few options!

If you want to calculate a body's inertia about a different point and in a different frame you can use the methods for a body's MassProperties: https://simtk.org/api_docs/molmodel/api ... ies__.html - see for example calcShiftedInertia... although now I look more I think this method would be cleaner: https://simtk.org/api_docs/molmodel/api ... eb1142b661

Thanks,

Nicos

User avatar
Mohammadreza Rezaie
Posts: 408
Joined: Fri Nov 24, 2017 12:48 am

Re: Whole Body Angular Momentum?

Post by Mohammadreza Rezaie » Wed Dec 06, 2023 6:21 am

Hi, whole body momentum (angular and linear) of a full-body model can be calculated directly via SimTK::SimbodyMatterSubsystem::calcSystemCentralMomentum:

Code: Select all

state = model.initSystem()
matter = model.getMatterSubsystem()
model.realizeVelocity(state)
momentum = matter.calcSystemCentralMomentum(state)
angularMomentum = momentum.get(0)
linearMomentum = momentum.get(1)

User avatar
Mohammadreza Rezaie
Posts: 408
Joined: Fri Nov 24, 2017 12:48 am

Re: Whole Body Angular Momentum?

Post by Mohammadreza Rezaie » Thu Dec 07, 2023 9:45 am

Since version 4.4.1, it's been exposed under Model class:

Code: Select all

model.calcAngularMomentum(state)

User avatar
Shabnam Sh
Posts: 2
Joined: Mon Nov 18, 2019 8:24 pm

Re: Whole Body Angular Momentum?

Post by Shabnam Sh » Thu Dec 07, 2023 2:28 pm

Hi Nicos,

I got the inertial tensor directly from the model osim file. I was wondering if the inertial tensor is in the lab frame or the body's local frame.

Thanks,
Shabnam

User avatar
Nicos Haralabidis
Posts: 196
Joined: Tue Aug 16, 2016 1:46 am

Re: Whole Body Angular Momentum?

Post by Nicos Haralabidis » Fri Dec 08, 2023 6:46 am

Hey Shabnam,

I believe they are expressed about a given body's center of mass and in the frame of the body. The model you are using potentially describes this information in an associated publication more than likely!

Hope that helps!

Nicos

POST REPLY