Hi all,
I am using gait2354.osim to run Inverse Dynamics (ID) and Static Optimization (SO) with Matlab using API 3.3. But when I compare the joint moment (read from ID) with moment (summation of moment arm multiply muscle force read from SO), they don't match, especially for 'pelvis_tilt_moment','pelvis_ty_force'.
The moment arm seems the same compared with moment arm-joint figure which could be plotted in OpenSim.
Here is code reading moment arm:
MA=MomentArmSolver(model);
muscle=model.getMuscles().get(i);
musclegeopath=muscle.getGeometryPath();
MAvalue(j+1,i+1)=MA.solve(state, model.getCoordinateSet().get(j), musclegeopath); %% j is joint, i is muscle
Does anyone know what's wrong?
Chaofei
Moment and muscle force don't match
- Thomas Uchida
- Posts: 1780
- Joined: Wed May 16, 2012 11:40 am
Re: Moment and muscle force don't match
Please see Sherman, Seth, Delp (2013) "What is a moment arm? Calculating muscle effectiveness in biomechanical models using generalized coordinates". https://www.researchgate.net/profile/Mi ... inates.pdf
- Chaofei Zhang
- Posts: 26
- Joined: Tue Oct 03, 2017 11:03 am
Re: Moment and muscle force don't match
Hi Tom,
Thanks for your reply.
I have read the paper you suggested, it seems to introduce details how to compute moment arm in opensim.
I just read the computed result from opensim via API in Matlab.
Except for the previous posted method to read moment arm, I also tried another method which comes from a simple optimization example (OpenSim 3.3\Scripts\Matlab\simpleOptimizerObjectiveFunction.m). And I get the same moment arm.
So do you have any other suggestions for that?
Thanks,
Chaofei
Thanks for your reply.
I have read the paper you suggested, it seems to introduce details how to compute moment arm in opensim.
I just read the computed result from opensim via API in Matlab.
Except for the previous posted method to read moment arm, I also tried another method which comes from a simple optimization example (OpenSim 3.3\Scripts\Matlab\simpleOptimizerObjectiveFunction.m). And I get the same moment arm.
So do you have any other suggestions for that?
Thanks,
Chaofei
- Thomas Uchida
- Posts: 1780
- Joined: Wed May 16, 2012 11:40 am
Re: Moment and muscle force don't match
It's difficult to determine the problem without seeing the rest of your code. Here are a couple things that come to mind:
1. How are you setting the state prior to the code snippet in your first post? Note that Static Optimization uses the length and velocity of the muscle path, so be sure you are setting the u's in addition to the q's.
2. Be sure you are adding in the contribution of the reserve actuators and external forces, if there are any.
1. How are you setting the state prior to the code snippet in your first post? Note that Static Optimization uses the length and velocity of the muscle path, so be sure you are setting the u's in addition to the q's.
2. Be sure you are adding in the contribution of the reserve actuators and external forces, if there are any.
- Chaofei Zhang
- Posts: 26
- Joined: Tue Oct 03, 2017 11:03 am
Re: Moment and muscle force don't match
Hi Tom,
Thanks very much for your suggestion. I have double checked my code and inputs.
I find that the coordinate is usually indegree in motion file , while it's radian in API 3.3. that's the main reason I get the incorrect result.
I also added some reserve actuator to the pelvis coordinate which is connected to ground to make sure that static optimization run successfully.
Much Appreciate,
Chaofei
Thanks very much for your suggestion. I have double checked my code and inputs.
I find that the coordinate is usually indegree in motion file , while it's radian in API 3.3. that's the main reason I get the incorrect result.
I also added some reserve actuator to the pelvis coordinate which is connected to ground to make sure that static optimization run successfully.
Much Appreciate,
Chaofei