a time shift or a differnce in the values Moment arm

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Jum Wld
Posts: 15
Joined: Tue Jan 31, 2017 10:14 am

a time shift or a differnce in the values Moment arm

Post by Jum Wld » Tue Mar 14, 2017 9:43 am

Hello all,
I am trying to calculate moment arm using MATLAB interface. To check the interface I compared calculated moment arm from OpenSim (uing plotter, then data export) with the calculated in MATLAB script.

I got either a time shift or a differnce in the values as in the attached fig as an example.

after I set the angles using :

Code: Select all

Coord.setValue(state, deg2rad(q(c)) )
I calculated moment arm:

Code: Select all

muscle.computeMomentArm(state,  Coord)
Other details:
Model: 'arm26.osim'
motion file:'arm26_states_degrees.mot';
DOF: Elbow flexion, shoulder_elev
Plot in openSim; X: moment arm_Elbow_flexion, Y: arm26_states_degrees



Anyone can help?
I really appreciate your time and advice
Attachments
error.jpg
error.jpg (39.27 KiB) Viewed 1301 times

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

Re: a time shift or a differnce in the values Moment arm

Post by Thomas Uchida » Tue Mar 14, 2017 10:29 am

One possible explanation is that the data points are not spaced equally in time and you have accidentally plotted one curve with respect to time and the other with respect to index.

User avatar
Jum Wld
Posts: 15
Joined: Tue Jan 31, 2017 10:14 am

Re: a time shift or a differnce in the values Moment arm

Post by Jum Wld » Tue Mar 14, 2017 12:48 pm

I checked the number of frames in the saved data file and found it 348 while the original motion file and Matlab processed data 350..what could be the reason to get 348 in OpenSim not the same number of frames?

PS in the plot,I plotted each data with its corresponding time points

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

Re: a time shift or a differnce in the values Moment arm

Post by Thomas Uchida » Tue Mar 14, 2017 6:12 pm

A second possible explanation is that the muscle crosses more than one degree of freedom and one or more of these other angles differ between the two models.

A third possible explanation is that there are kinematic constraints in the model, in which case Coord.setValue(state, value) will cause the assembler to project the state onto the constraint manifold after setting each coordinate (which could change the coordinates you've already set). To determine whether this is occurring, you can call Coord.getValue(state) and compare the returned value to the value you set. Regardless, you should call Coord.setValue(state, value, false) for all but the last coordinate to avoid projecting intermediate configurations.

User avatar
Shushu Ma
Posts: 2
Joined: Thu Jul 14, 2016 1:42 am

Re: a time shift or a differnce in the values Moment arm

Post by Shushu Ma » Fri May 12, 2017 4:45 am

A second possible explanation is that the muscle crosses more than one degree of freedom and one or more of these other angles differ between the two models.
The osim model is "MoBL_ARMS_module2_4_allmuscles.osim". I sampled 60 times in both 'elv_angle' and 'elbow_flexion' ranges. The testing muscle is BIClong which I use 2 DoF. However, when I use different coordinates in computerMomentArm, the results are different. Whould you please explain it or give any related info? Thank you so much.

The result is shown in the fig. The code is down below.
BIClongResult1.jpg
BIClongResult1.jpg (18.43 KiB) Viewed 1219 times

Code: Select all

import org.opensim.modeling.*

model = Model('TestData/MoBL_ARMS_module2_4_allmuscles.osim');
state = model.initSystem();

dis = 60; 

shoulderFlexCoord = model.updCoordinateSet().get('elv_angle'); % 'hip_flexion_r'
shoulderFlexCoord.setValue(state, 1.0);

minSh = -90;
maxSh = 130;
QSh = generateQ(minSh, maxSh,dis);

elbowFlexCoord = model.updCoordinateSet().get('elbow_flexion'); % 'knee_angle_r'
elbowFlexCoord.setValue(state, 1.0);

minEl = 0;
maxEl = 130;
QEl = generateQ(minEl, maxEl,dis);

bicBi = model.getMuscles().get('BIClong');

[maBIC_Sh, maBIC_El] = deal(zeros(dis,1));
for i=1:dis
    elbowFlexCoord.setValue(state,QEl(i));
    shoulderFlexCoord.setValue(state,QSh(i));  

    maBIC_Sh(i)=bicBi.computeMomentArm(state,shoulderFlexCoord);
    maBIC_El(i)=bicBi.computeMomentArm(state,elbowFlexCoord);
end 

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

Re: a time shift or a differnce in the values Moment arm

Post by Thomas Uchida » Fri May 12, 2017 2:40 pm

when I use different coordinates in computerMomentArm, the results are different.
The "BIClong" muscle crosses two joints in the model; it generates a moment about both joints and, thus, there are two moment arms you can compute for this muscle. The second argument to the computeMomentArm() method indicates which of these two moment arms is to be computed. In general, the n moment arms associated with a muscle that crosses n degrees of freedom will all be different.

User avatar
Shushu Ma
Posts: 2
Joined: Thu Jul 14, 2016 1:42 am

Re: a time shift or a differnce in the values Moment arm

Post by Shushu Ma » Mon May 15, 2017 6:00 am

I previously thought for a muscle cross 2 DOF or more, one DOF's changing would affect the other DOF's moment arm. For example, take muscle "rect_fem_r" in 3DGaitModel2354.osim, Y-Quantity is "hip_flexion_r moment arm", X-Quantity is "knee_angle_r", there is slight change in moment arm with the change in knee angle.
Capture1.JPG
Capture1.JPG (55.39 KiB) Viewed 1193 times
However, the shoulder moment arm stays the same whenever the elbow changes. Would you please give some hint about the differences between upper and lower body?

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

Re: a time shift or a differnce in the values Moment arm

Post by Thomas Uchida » Mon May 15, 2017 10:03 am

Would you please give some hint about the differences between upper and lower body?
The difference you're seeing is not due to the location of the muscle in the body but, rather, how the muscle's path has been defined. For example, if a muscle wrapped around a sphere centered at a joint, the moment arm at that joint would be the radius of the sphere regardless of pose. Muscle paths are discussed on the "Muscle Editor" page in the Confluence documentation (http://simtk-confluence.stanford.edu:80 ... cle+Editor).

POST REPLY