Page 1 of 1

Segment orientations

Posted: Wed Aug 23, 2017 6:43 am
by frankwouda
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?

Re: Segment orientations

Posted: Wed Aug 23, 2017 9:27 am
by mitkof6
Body kinematics reports the local frame (position and orientation) of each body as measured in the ground frame.

Re: Segment orientations

Posted: Thu Aug 24, 2017 12:23 am
by frankwouda
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).

Re: Segment orientations

Posted: Thu Aug 24, 2017 1:54 am
by mitkof6
Could you post the figures?

Re: Segment orientations

Posted: Thu Aug 24, 2017 2:59 am
by frankwouda
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

Re: Segment orientations

Posted: Fri Sep 29, 2023 9:34 am
by deyvidpi
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!

Re: Segment orientations

Posted: Fri Sep 29, 2023 3:08 pm
by deyvidpi
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)

Re: Segment orientations

Posted: Wed Oct 18, 2023 10:04 am
by deyvidpi
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