Page 1 of 1

Problem with muscle analysis

Posted: Thu Nov 06, 2014 12:35 pm
by kevin_tanghe
Hello,

I'm having a problem with the Analyze tool to do a muscle analysis. I want to compute the joint moments, given a certain motion. I am using the gait2392 model, which is in the Models folder in the directory of OpenSim. The model is provided with a motion normal.mot which is located in the tutorial folder of the gait2392 model. I'm using this motion for my analysis.

In the attachment, you can see the html setup file I've created for the analysis. Also attached is the text of the message window, when the Analyze tool is executed. Now, when I use the plot tool to visualize the output, for example the moment by the knee extensors, I see strange things: the moment on the knee reaches a value of almost 6000 Nm!

The strange thing is that values look much better if I don't use the Analyze tool, but instead the plot tool with
Y-quantity: moment --> knee_angle_r
muscle : R_knee_extensors group
X-quantity: normal_giat(Deg.)
In this way, I get maximal moments of 190 Nm.
I would think that both methods should calculate the same result. Could there be a bug in the Analyze tool?

I want to use the Matlab-OpenSim interface, so I have to use the Analyze tool and can't make use of the alternative with the Plot function.

Re: Problem with muscle analysis

Posted: Thu Nov 06, 2014 8:26 pm
by jimmy
Hi Kevin,

It looks like you are missing some inputs to the muscle analysis. The muscles require states to compute muscle properties with. If you haven't input the states, then muscle forces are getting computed using states that may be zero, causing weird behavior. Also does not seem like you have included any external loads, which is also probably an issue.

The gait2354 model folder has the setup files to go through scale->IK->RRA->CMC->Analysis. (with muscle analysis). I would suggest working through that example data and seeing what the setup file and inputs are.

Let us know how it goes,
-James

Re: Problem with muscle analysis

Posted: Fri Nov 07, 2014 6:46 am
by kevin_tanghe
Thanks for your reply.

Maybe I didn't describe my problem accurate enough. I want to compute the maximal joint moment that a person can develop, given a certain motion. With the muscle analysis, I want to evaluate the contribution of each muscle to that maximal moment. I think ground reaction forces are not needed for this problem. Also, if I'm correct, the scale-IK-RRA-CMC-Analysis approach you suggest wants to compute the actual joint moments for a given motion and not the maximal moments.

Maybe I can try to give the muscle controls as an input? For instance, I can set the activation of knee extensors to 0.95 and all the rest to 0.05. In this way, I can evaluate the maximal extension moment for the given motion. Then I can repeat this for the other muscle groups.

Do you think this is a good solution? Or do you suggest a different approach?

Re: Problem with muscle analysis

Posted: Mon Nov 24, 2014 5:40 am
by kevin_tanghe
In the meantime I have added a controls file. You can see it in the attachement. All the hip flexors have a control value of 1; the other muscles have a value of 0.05.

The muscle analysis file is also included in the attachment. I still get some strange results when I run it. The results are included in the attachment (I've changed the .sto into .txt otherwise I couldn't upload it). You can see that the moment of the knee reaches very high values at time instances 0.84 - 0.9. This is mainly due to the vasti muscle group.

Is this a bug in the OpenSim routine?

Re: Problem with muscle analysis

Posted: Mon Nov 24, 2014 9:09 am
by jimmy
Hi Kevin,

Sorry, I don't think I was clear enough. Most likely, you won't be successful in answering your research question using the Analyze tool this way. It was specifically designed to take the results of a simulation and probe that system for more information. It is a flaw in the design of the tool that allows you to use it in the way you are describing.

To address your question, I would use the scripting API to set the coordinates of the model at each time point, then calculate the actuator force and moment arm.

There is some example matlab code for this found here; https://github.com/jimmyDunne/stackJimm ... VfromMot.m

This script will update the coordinates of the model, set the muscle activation to 1, and get muscle force properties of all the muscles.

An example of calculating the moment arm can be found here;https://github.com/jimmyDunne/stackJimm ... ord4Musc.m

Using that information you can calculate muscle contributions to the total joint moment.

Hope that helps,
-james

Re: Problem with muscle analysis

Posted: Tue Nov 25, 2014 3:10 am
by kevin_tanghe
Thanks for the help.

If I understand your code correct, then you loop over the muscles. For the first muscle, you set the activation equal to 1 for each frame and you compute the muscle force. Then you go to the second muscle and again you set the activation equal to 1 for each frame to compute the muscle force. However, shouldn't you deactivate the first muscle again? Otherwise, antagonists can counteract each other.

Re: Problem with muscle analysis

Posted: Tue Nov 25, 2014 11:38 am
by jimmy
Being a static pose analysis, not a simulation, other forces don't matter. Computationally, the force being produced from one muscle doesn't effect the force production of another.

The is nothing to counteract since putting the model in a pose and switching on all the muscles means you are really just (i) setting a muscle length, (ii) getting the muscle force at that length (iii) getting the moment arm (iv) calculating the moment (muscle force*moment arm).

Hope that makes sense,
-james

Re: Problem with muscle analysis

Posted: Fri Nov 28, 2014 12:48 pm
by kevin_tanghe
Thank you very much for your help and your code. It seems to work very well. The routine now computes reasonable joint moments.

There is however a difference between the computed joint moments from your Matlab code and the joint moments of the plot function of OpenSim. The moment arms are the same in Matlab and in the plotter, but the computed tendon forces are different. Would anyone know the reason for this?

(I did the test for the gait2392_simbody model, with the normal.mot motion file which is available in the tutorial of the model.)

Re: Problem with muscle analysis

Posted: Mon May 07, 2018 3:32 am
by biotn_mpg
Hello,

I currently develop my own controller using the platform OpenSim/Matlab. I would like to calculate the moment (muscle force * moment arm) of each muscle separately to provide a torque feedback to my controller. I am looking for the methods to get a muscle total force and moment arm for a given state. Its sounds close to the request of your discussion. Unfortunately, the links to the Matlab examples are no more available. Is it possible to reactivate the links? And more precisely, is there a direct method able to get the total torque for a group of muscles (agonist / antagonist torques)?

Thanks
Marina