Segment orientations

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Frank Wouda
Posts: 3
Joined: Tue Jul 18, 2017 4:48 am

Segment orientations

Post by Frank Wouda » Wed Aug 23, 2017 6:43 am

I was planning to do a comparison between IMUs and optical systems for measuring of segment orientations.
However, I am struggling a bit to get proper segment orientations from the OpenSim GUI.

Here is what I have done so far:
Analyze-> BodyKinematics: Which give me segment orientations in x-y-z euler orientations. However if I try to plot these, two directions are rotating a lot, whereas this is not the case if you play the motion in the GUI.

Am I making a thinking error here?

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Segment orientations

Post by Dimitar Stanev » Wed Aug 23, 2017 9:27 am

Body kinematics reports the local frame (position and orientation) of each body as measured in the ground frame.

User avatar
Frank Wouda
Posts: 3
Joined: Tue Jul 18, 2017 4:48 am

Re: Segment orientations

Post by Frank Wouda » Thu Aug 24, 2017 12:23 am

mitkof6 wrote:Body kinematics reports the local frame (position and orientation) of each body as measured in the ground frame.
Thanks for your reply. And yes that is what it should give me indeed. However, if I look at the Euler angles of the pelvis they vary hugely, whereas looking in the GUI the pelvis is more or less stable (treadmill running, so it does make sense).

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Segment orientations

Post by Dimitar Stanev » Thu Aug 24, 2017 1:54 am

Could you post the figures?

User avatar
Frank Wouda
Posts: 3
Joined: Tue Jul 18, 2017 4:48 am

Re: Segment orientations

Post by Frank Wouda » Thu Aug 24, 2017 2:59 am

mitkof6 wrote:Could you post the figures?
Of course, below I posted the figure. Where x (blue) and z (yellow) euler angles appear to alternate.

http://imgur.com/a/giIEK

User avatar
Pagnon David
Posts: 82
Joined: Mon Jan 06, 2014 3:13 am

Re: Segment orientations

Post by Pagnon David » Fri Sep 29, 2023 9:34 am

This is the post I was looking for!
(this one also brings up the issue, as well as this one maybe).

Did anyone figure out why it behaves this way, and how to solve it?

If anyone wants to check it out, I'm attaching the model and the mot file used for BodyKinematics.
The model is just walking on a thin beam, and his pelvis is definitely not rotating this much.

Surprisingly, it randomly works sometimes, maybe when the person is walking towards the x axis? The output from the "Gait10dof18musc" example works fine, for example.

Thanks in advance!
Attachments
Capture d'écran 2023-09-29 182758.png
Capture d'écran 2023-09-29 182758.png (47.77 KiB) Viewed 223 times
0.Model_scaled.osim
(474.73 KiB) Downloaded 4 times
0.Balancing.mot
(105.8 KiB) Downloaded 4 times
Last edited by Pagnon David on Sat Sep 30, 2023 1:23 pm, edited 1 time in total.

User avatar
Pagnon David
Posts: 82
Joined: Mon Jan 06, 2014 3:13 am

Re: Segment orientations

Post by Pagnon David » Fri Sep 29, 2023 3:08 pm

Potentially related, although I don't think multiplying my orientations by pi/180 solves it.
Radian/degrees confusion in BodyKinematics: https://github.com/opensim-org/opensim-core/issues/2208
(by the way, I use OpenSim 4.4, although I also tried with 4.3 which gives the same results)

User avatar
Pagnon David
Posts: 82
Joined: Mon Jan 06, 2014 3:13 am

Re: Segment orientations

Post by Pagnon David » Wed Oct 18, 2023 10:04 am

Just in case anyone else comes across this issue, I wrote a utility script for obtaining segment locations and orientations from a model and a mot file: https://github.com/perfanalytics/pose2s ... ot_osim.py

It is mostly equivalent to OpenSim Analysis -> BodyKinematics, but without the bugs in orientations (probably due to their use of Euler angles instead of homography matrices).

It builds a .csv file that I can then import in Blender via my Sim2Blend addon. Beware that it transforms to Blender's Z-up convention unless you specify direction='yup' in the script.



Usage:

Code: Select all

from Pose2Sim.Utilities import csv_from_mot_osim
csv_from_mot_osim.csv_from_mot_osim_func(r'<input_mot_file>', r'<output_osim_file>', r'<output_csv_file>')
OR

Code: Select all

python -m csv_from_mot_osim -m input_mot_file -o input_osim_file
OR

Code: Select all

python -m csv_from_mot_osim -m input_mot_file -o input_osim_file -c output_csv_file

POST REPLY