OpenSim API: problem of muscle force velocity function with Millard muscle type
- kaci chahrazed
- Posts: 3
- Joined: Wed Feb 02, 2022 3:06 am
OpenSim API: problem of muscle force velocity function with Millard muscle type
Hello Everyone,
I am trying to compute the muscle active force and passive force for one muscle for different velocities of elbow flexion on a model with Millard muscles type, and i noticed that the force remains the same what ever the velocity is. (this problem does not occur with Thelen muscles type)
Here are the velocities i got:
To notice: The getForceVelocityCurve() function retrieves the default parameters of the function representing the force velocity relationship of the muscle:
[ 0.0, 0.25, 5.0, 0.15, 1.4, 0.6, 0.9]
Opensim version: 4.1
Python version : 3.7 ( 64bits)
Opensim model :MoBL-ARMS_upper_extremity
Is there any one who knows how to solve this problem?
Thank you in advance for any ideas
Chahrazed
I am trying to compute the muscle active force and passive force for one muscle for different velocities of elbow flexion on a model with Millard muscles type, and i noticed that the force remains the same what ever the velocity is. (this problem does not occur with Thelen muscles type)
Here are the velocities i got:
To notice: The getForceVelocityCurve() function retrieves the default parameters of the function representing the force velocity relationship of the muscle:
[ 0.0, 0.25, 5.0, 0.15, 1.4, 0.6, 0.9]
Opensim version: 4.1
Python version : 3.7 ( 64bits)
Opensim model :MoBL-ARMS_upper_extremity
Is there any one who knows how to solve this problem?
Thank you in advance for any ideas
Chahrazed
Tags:
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
I was unable to reproduce this issue with the arm26 model. Perhaps you could try this on your end to confirm that the issue is model-specific. You could then try in a different pose in case this is a non-typical situation caused by path points and/or muscle wrapping.
- kaci chahrazed
- Posts: 3
- Joined: Wed Feb 02, 2022 3:06 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
Hello,
Thank you for your answer, i tried different positions on OpenSim and in fact the active force of the muscle changes for different values of elbow flexion. But that's because we change the length of the fiber by the different positions . Actually my concern is to change elbow flexion velocity and plot the corresponding changes in active fiber force . But when we change the velocity the force remains always the same for MoBL model.
For arm26 model, this problem does not occur that's why i supposed that the problem might come from the type of the muscle Thelen or Millard.
In the script below , i plotted the graphs of the active force depending on elbow velocity values even with varying values of "shoulder elevation angle "
as you can see , with arm 26 model (Thelen muscle typle) the curve is decreasing while it is flat with MoBL model( Millard muscle type)
graphs with MoBL:
graphs with arm26:
Thank you
Thank you for your answer, i tried different positions on OpenSim and in fact the active force of the muscle changes for different values of elbow flexion. But that's because we change the length of the fiber by the different positions . Actually my concern is to change elbow flexion velocity and plot the corresponding changes in active fiber force . But when we change the velocity the force remains always the same for MoBL model.
For arm26 model, this problem does not occur that's why i supposed that the problem might come from the type of the muscle Thelen or Millard.
In the script below , i plotted the graphs of the active force depending on elbow velocity values even with varying values of "shoulder elevation angle "
as you can see , with arm 26 model (Thelen muscle typle) the curve is decreasing while it is flat with MoBL model( Millard muscle type)
graphs with MoBL:
graphs with arm26:
Thank you
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
The Model::equilibrateMuscles() method (https://github.com/opensim-org/opensim- ... .cpp#L1181) calls Muscle::computeEquilibrium() (https://github.com/opensim-org/opensim- ... cle.h#L336) which is used for initialization. Perhaps try replacing model.equilibrateMuscles(state) with model.realizeDynamics(state) (https://simtk.org/api_docs/opensim/api_ ... 96e8844fe7).
- Jacob J. Banks
- Posts: 97
- Joined: Tue Jul 15, 2014 5:17 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
Similar to Kaci, I can't seem to make sense of/match extracted Millard muscle force parameters using an API. However, I am looking at things a bit differently, as I am writing a custom SOpt API...
If one runs the SOpt tool on a trial/frame and then takes the SOpt_force and divides them by the SOpt_activations, you get the 'Optimal Force in that state', correct? However, when I input states via an API (similarly to how Kaci does above) I cannot match the aforementioned 'Optimal Force in that state' no matter the combination of Optimal Force by FL,FV, & pennation angle multiplier I use (and I should use them all). I have a feeling it is related to the FV multiplier, as the other values tend to fluctuate as expected while the FV multiplier doesn't.
Though I haven't gone back and looked in awhile, I pretty sure when I have used Thelen muscles (in a different model) these 2 numbers/methods aligned.
Any insights, investigation into this would be appreciated. I can also expand on this a bit more if need be (but feel Kaci demoed things as well I can/could, albeit in a different manner).
Jake Banks
If one runs the SOpt tool on a trial/frame and then takes the SOpt_force and divides them by the SOpt_activations, you get the 'Optimal Force in that state', correct? However, when I input states via an API (similarly to how Kaci does above) I cannot match the aforementioned 'Optimal Force in that state' no matter the combination of Optimal Force by FL,FV, & pennation angle multiplier I use (and I should use them all). I have a feeling it is related to the FV multiplier, as the other values tend to fluctuate as expected while the FV multiplier doesn't.
Though I haven't gone back and looked in awhile, I pretty sure when I have used Thelen muscles (in a different model) these 2 numbers/methods aligned.
Any insights, investigation into this would be appreciated. I can also expand on this a bit more if need be (but feel Kaci demoed things as well I can/could, albeit in a different manner).
Jake Banks
- Jonathan SAVIN
- Posts: 11
- Joined: Wed Feb 10, 2021 12:52 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
Thank you very much Mr. Uchida for this advice, replacing "equilibrateMuscles" with "realizeDynamics". Unfortunately, after implementing this change, the plot active_force vs joint_velocity remains flat. I've tried with "realizeVelocity" as well, the result is the same. This strange behaviour is also observed in Matlab scripting. Very strange indeed, as the force-velocity relation is a primary feature of muscle model.
- Jacob J. Banks
- Posts: 97
- Joined: Tue Jul 15, 2014 5:17 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
As a quick follow-up to some of my initial concerns (admittedly I didn't start this post, but I did mention them above), I found that one needs to disable (i.e., 'set_ignore_...' to true (1)) the tendon and activation properties for the Millard muscles (see IV part 4):
https://simtk-confluence.stanford.edu:8 ... +in+MATLAB
This has allowed me to better align optimal forces for my custom SOpt function to what the OpenSim Tool produces. It may perhaps help you get better FV properties too.
Note: I still am having some issues with the first few frames, but may save that for a another post (quickly, seems that OpenSim doesn't use the velocity state calculated for the first frame, but rather and average from the proceeding frames?).
Jake Banks
https://simtk-confluence.stanford.edu:8 ... +in+MATLAB
This has allowed me to better align optimal forces for my custom SOpt function to what the OpenSim Tool produces. It may perhaps help you get better FV properties too.
Note: I still am having some issues with the first few frames, but may save that for a another post (quickly, seems that OpenSim doesn't use the velocity state calculated for the first frame, but rather and average from the proceeding frames?).
Jake Banks
- kaci chahrazed
- Posts: 3
- Joined: Wed Feb 02, 2022 3:06 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
Hello,
Thank you Jacob J.Banks, i will try this.
Thank you Jacob J.Banks, i will try this.
- Glen Lichtwark
- Posts: 30
- Joined: Mon Nov 19, 2007 10:02 pm
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
I believe this is a problem with the implementation via Millard muscle type.
After setting the states in the model I have been calling the following -
When I do this, the I get force calculations, but the fibre velocity is essentially staying zero, hence I suspect its velocity is not be being calculated and therefore velocity effects are essentially ignored in the force calculations (not ideal).
When I undertake the exact same process with the Thelen muscle model, it works perfectly.
Any advice on what could be done to get the Millard model calculations would be greatly appreciated.
After setting the states in the model I have been calling the following -
Code: Select all
Mod.realizePosition(state);
Mod.realizeVelocity(state);
Mod.equilibrateMuscles(state);
When I undertake the exact same process with the Thelen muscle model, it works perfectly.
Any advice on what could be done to get the Millard model calculations would be greatly appreciated.
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: OpenSim API: problem of muscle force velocity function with Millard muscle type
I think you can use Millard2012EquilibriumMuscle::getFiberVelocityInfo() (https://simtk.org/api_docs/opensim/api_ ... 39cda225cb). Here's a description of the information contained in the FiberVelocityInfo struct: https://simtk.org/api_docs/opensim/api_ ... ml#details. (IIRC, the data in this struct is what's used internally.)