Angular velocity in global or body local frame

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Yanran Jiang
Posts: 10
Joined: Sun Feb 09, 2020 11:48 pm

Angular velocity in global or body local frame

Post by Yanran Jiang » Tue Jul 21, 2020 2:30 am

Hi there,

In the Analyse tool, the setup file of Body kinematics shows we can decide to express the result in global or body local frame. But when I found at the top of result file, it always write"Angular velocities and accelerations are given about the body-local axes." whether at global file or bodylocal file. I want to confirm does angular velocity expressed in global coordinates when I choose to express results in global frame?
<BodyKinematics name="BodyKinematics">
<!--Flag (true or false) specifying whether on. True by default.-->
<on>true</on>
<!--Start time.-->
<start_time>0</start_time>
<!--End time.-->
<end_time>248.34</end_time>
<!--Specifies how often to store results during a simulation. More specifically, the interval (a positive integer) specifies how many successful integration steps should be taken before results are recorded again.-->
<step_interval>1</step_interval>
<!--Flag (true or false) indicating whether the results are in degrees or not.-->
<in_degrees>false</in_degrees>
<!--Names of bodies to record kinematics for. Use 'all' to record all bodies. The special name 'center_of_mass' refers to the combined center of mass.-->
<bodies> all</bodies>
<!--Flag (true or false) indicating whether to express results in the global frame or local-frames of the bodies. Body positions and center of mass results are always given in the global frame. This flag is set to false by default.-->
<express_results_in_body_local_frame>true</express_results_in_body_local_frame>
</BodyKinematics>
Attachments
MU00166960.png
MU00166960.png (227.16 KiB) Viewed 1101 times

Tags:

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

Re: Angular velocity in global or body local frame

Post by Carmichael Ong » Wed Jul 22, 2020 10:10 am

I believe that the result should be in global coordinates when chosen to express in the global frame. The code in BodyKinematics relevant to this can be found here (L501-505): https://github.com/opensim-org/opensim- ... s.cpp#L501

Looks like the code first calculates in the global (ground) frame, and then converts to the local frame if the property "express_results_in_body_local_frame" is True.

User avatar
Yanran Jiang
Posts: 10
Joined: Sun Feb 09, 2020 11:48 pm

Re: Angular velocity in global or body local frame

Post by Yanran Jiang » Sun Jul 26, 2020 7:25 am

Hi carmichael,

Thank you so much for your answer. Do you know how opensim convert global angular velocity/acceleration to local angular velocity/acceleration? I didn't find the exact formula and code there.w(in local)=R*w(global) and obtain R from the the orientation of the segment with respect to the global frame. Is it the right way?

Much thanks,
Yanran
Attachments
Euler+Angles+to+Matrix+Conversion.jpg
Euler+Angles+to+Matrix+Conversion.jpg (65.47 KiB) Viewed 984 times

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

Re: Angular velocity in global or body local frame

Post by Carmichael Ong » Mon Jul 27, 2020 10:11 am

The calls to reexpress in different frames are found in the Frame class (https://github.com/opensim-org/opensim- ... el/Frame.h and https://github.com/opensim-org/opensim- ... /Frame.cpp). Many of these calls rely on the dynamics engine underneath called Simbody (https://github.com/simbody/simbody)

User avatar
Yanran Jiang
Posts: 10
Joined: Sun Feb 09, 2020 11:48 pm

Re: Angular velocity in global or body local frame

Post by Yanran Jiang » Tue Jul 28, 2020 5:30 am

Hi Carmichael,

Thank you so much! That's what I want and really helpful. In the Analyze tool, orientation of body segment in BodyKinmatic is with respect to the global frame and it represents the orientation of COM of each body segment. Since I want to convert IMU data in Xsens MVN file to be expressed in OpenSim coordinates. Do you know could we have orientation of origin (not COM) of body segment wrt to the global frame?

Any help will be appreciated.

Thanks,
Yanran

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

Re: Angular velocity in global or body local frame

Post by Carmichael Ong » Mon Aug 03, 2020 10:18 am

To the best of my knowledge, Simbody and OpenSim do not attribute an "orientation" to a Point. Orientations should only be attributed to Frame's or Body's, so I'm not sure what the difference between an orientation of two different points should be.

User avatar
Junwei Sun
Posts: 12
Joined: Mon Mar 14, 2022 11:05 am

Re: Angular velocity in global or body local frame

Post by Junwei Sun » Thu Jun 16, 2022 12:39 pm

Can someone please confirm if the w(in local)=R*w(global) solution is correct?

yanran wrote:
Sun Jul 26, 2020 7:25 am
Hi carmichael,

Thank you so much for your answer. Do you know how opensim convert global angular velocity/acceleration to local angular velocity/acceleration? I didn't find the exact formula and code there.w(in local)=R*w(global) and obtain R from the the orientation of the segment with respect to the global frame. Is it the right way?

Much thanks,
Yanran

POST REPLY