Free joint makes state.getNY() return extra state!

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Hao Lee
Posts: 32
Joined: Sun Jun 12, 2016 11:52 pm

Free joint makes state.getNY() return extra state!

Post by Hao Lee » Wed Jul 12, 2017 8:26 pm

I am currently modified the model in "DynamicWalkingStarter", I replace the joint between pelvis and floor with a free joint. (original is 2 slider joints, which limits the DOF)
The model I modified is this provided in the link below
https://drive.google.com/file/d/0B4Av76 ... sp=sharing
And it is clear it only has 12 coordinates
http://imgur.com/a/oOigN
p.s. I set some range to 0 since I want to lock them, but I also called the "setLocked(osimState, true);" in my matlab code.

However, when I use

Code: Select all

osimModel = Model('../Model/selfDefined/osimModel_pelvis_act.osim');
osimState = osimModel.initSystem();
numVar = osimState.getY().size();
It returns me 25, which is one extra of what I expected.

Nevertheless, when I use

Code: Select all

osimModel.getStateVariableNames().getitem(index)
It gave me 24 values, which seems correct.
In other words, the model I provided have 12 different state variables, but initSystem() create the state that has an extra one, why is that?

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Free joint makes state.getNY() return extra state!

Post by Thomas Uchida » Wed Jul 12, 2017 10:44 pm

the model I provided have 12 different state variables, but initSystem() create the state that has an extra one, why is that?
The underlying Simbody System represents the FreeJoint's orientation using quaternions to avoid singularities (see https://simtk.org/api_docs/simbody/3.5/ ... ml#details), but the OpenSim interface works with the corresponding Euler angles (of which there are 3, not 4).

User avatar
Hao Lee
Posts: 32
Joined: Sun Jun 12, 2016 11:52 pm

Re: Free joint makes state.getNY() return extra state!

Post by Hao Lee » Thu Jul 13, 2017 10:59 am

Dear Tom
I am confused about the 4th component. I understand euler angle will face singularity such as Gimbal lock, and the common way to solve it is changing the order of euler sequence. So what is the 4th coordinate doing here? Does that mean an extra rotation? Like x->y->z->x (which solves Gimbal lock), but how could I match these data to the coordinate in my model? I only have 3 rotation (rx, ry, rz)

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Free joint makes state.getNY() return extra state!

Post by Thomas Uchida » Thu Jul 13, 2017 12:22 pm

I am confused about the 4th component. I understand euler angle will face singularity such as Gimbal lock, and the common way to solve it is changing the order of euler sequence. So what is the 4th coordinate doing here? Does that mean an extra rotation? Like x->y->z->x (which solves Gimbal lock), but how could I match these data to the coordinate in my model? I only have 3 rotation (rx, ry, rz)
Simbody uses quaternions (https://en.wikipedia.org/wiki/Quaternion). There are methods in the SimbodyEngine class (https://simtk.org/api_docs/opensim/api_ ... ngine.html) for converting between representations of orientation (e.g., convertQuaternionsToDirectionCosines(), https://simtk.org/api_docs/opensim/api_ ... d6e437fe5a).

POST REPLY