Roll, Pitch and Yaw of head/neck model for the hole simulation time

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Thomas Lober
Posts: 3
Joined: Tue Apr 16, 2019 5:49 am

Roll, Pitch and Yaw of head/neck model for the hole simulation time

Post by Thomas Lober » Tue Jul 09, 2019 6:25 am

Hello everybody,

im working with the head and neck model. I want to get the orientations of the model first and calculate the rotational matrix out of it. For this I need the roll, pitch and yaw of the joints for every moment during a simulation. First I thought that I can use a reporter, but unfortunately I can not get them via the outputs of the joints.

With the fallowing code, I can access the value of the angle, but I only get one. And not all of them.

C = h.model.getCoordinateSet().get('roll1'); % roll1
v = C.getStateVariableValue(h.state,'value');

How can I get all of the angles during the hole simulation?

Thanks in advance for your help.

Thomas

Tags:

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Roll, Pitch and Yaw of head/neck model for the hole simulation time

Post by jimmy d » Tue Jul 09, 2019 11:04 am

You are dealing with General Coordinates, so they only give you values for their current state, not a global orientation value.

I think you are after the Orientations (Roll/Pitch/Yaw) of Bodies, not joints. Below is some Matlab code that shows how to get a Body Transform in Ground.

Code: Select all


import org.opensim.modeling.*

model = Model('generic_gait_model.osim');

s = model.initSystem();

pelvis = model.getBodySet().get(0);

TinG = pelvis.getTransformInGround(s);

rotation_Matrix = TinG.R();
translation_Matrix = TinG.p();

rotation_Matrix_Matlab = ...
[rotation_Matrix.get(0,0) rotation_Matrix.get(0,1) rotation_Matrix.get(0,2);...
rotation_Matrix.get(1,0) rotation_Matrix.get(1,1) rotation_Matrix.get(1,2);...
rotation_Matrix.get(2,0) rotation_Matrix.get(2,1) rotation_Matrix.get(2,2)];


User avatar
Thomas Lober
Posts: 3
Joined: Tue Apr 16, 2019 5:49 am

Re: Roll, Pitch and Yaw of head/neck model for the hole simulation time

Post by Thomas Lober » Wed Jul 10, 2019 3:23 am

Thank you James for the quick and helpful answer. You were right, that I need the orientation of the body.
With your code I get only one rotation matrix, but I need the rotation matrix of each position during the simulation.
I am using a IMU sensor in Matlab and there I need the acceleration and angular velocity of the skull, which I get from the outputs of the body.
But I need also the orientation of this body for each time step. Do you have an idea how to do this?
Thanks again for your help.

Thomas

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Roll, Pitch and Yaw of head/neck model for the hole simulation time

Post by jimmy d » Wed Jul 10, 2019 7:24 am

You will have to read in a motion and set all the coordinates at a time step, get the body transforms, and then cycle to the next time step. There is some example of someone doing this here;
viewtopicPhpbb.php?f=91&t=10624&p=0&sta ... e51eab1e07

User avatar
Thomas Lober
Posts: 3
Joined: Tue Apr 16, 2019 5:49 am

Re: Roll, Pitch and Yaw of head/neck model for the hole simulation time

Post by Thomas Lober » Thu Jul 11, 2019 12:17 am

Thank you James. I will have a look at this.

POST REPLY