computeFiberEquilibrium is undenfined

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Tom Driessen
Posts: 5
Joined: Mon Mar 16, 2020 7:45 am

computeFiberEquilibrium is undenfined

Post by Tom Driessen » Thu May 14, 2020 12:34 pm

Dear users / admin,

I am trying to use Matlab and the model of the Scapulothoracic Joint to look at tendon strain for different positions of the arm and how tendon strain is influenced by the velocity of the arm.
I tried to use computeFiberEquilibrium to make sure the velocity of the muscle was taken into account when the equilibrium was computed, but this returned the error that it was not defined, see below for the code and error message.

Code: Select all

for h = 1:3
    for i = 1:length(theta)
        for j = 1:length(phi)
        
        model.realizeVelocity(state);
        
        PlaneElev.setValue(state,theta(i));
        ShoulderElev.setValue(state,phi(j));
        PlaneElev.setSpeedValue(state, ((h-2)*3));
        ShoulderElev.setSpeedValue(state, ((h-2)*10)); 
        
        teresminor.setActivation(state, ((h-1)*0.5));
        
        model.realizeVelocity(state);
        teresminor.computeFiberEquilibrium(state,true);
        model.equilibrateMuscles(state);
error:
Undefined function or variable 'computeFiberEquilibrium'.

Error in surfaceplot (line 63)
teresminor.computeFiberEquilibrium(state,true);


I checked that all muscles I want to use are Millard2012EquilibriumMuscles, which they are. I tried to use safeDownCast to see if that would help but it also resulted in an error:

>> teresminor = Millard2012EquilibriumMuscle.safeDownCast(teresminor)
Undefined variable "Millard2012EquilibriumMuscle" or class
"Millard2012EquilibriumMuscle.safeDownCast".


Any comments on why this is happening and how to resolve the issue will be much appreciated!

Kind regards,
Tom

Tags:

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: computeFiberEquilibrium is undenfined

Post by Christopher Dembia » Thu May 14, 2020 1:11 pm

Can you show the start of your script? Do you have a line `import org.opensim.modeling.*;`?

Try constructing a `Millard2012EquilibriumMuscle()` before using any other classes in OpenSim. This might be necessary for loading the OpenSim Actuators library.

User avatar
Tom Driessen
Posts: 5
Joined: Mon Mar 16, 2020 7:45 am

Re: computeFiberEquilibrium is undenfined

Post by Tom Driessen » Thu May 14, 2020 3:16 pm

Dear Mr Dembia,
Thank you for your response, the start of the script looks like this:

Code: Select all

import org.opensim.modeling.*
opensimCommon.LoadOpenSimLibrary("...\ScapulothoracicJointPlugin40_WinX64")
model = Model('...\ThoracoscapularShoulderModelSubject.osim');
state = model.initSystem();
Could you please elaborate on how to use the 'Millard2012EquilibriumMuscle()' to load the OpenSim Actuators library?

Thanks in advance!

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: computeFiberEquilibrium is undenfined

Post by Christopher Dembia » Thu May 14, 2020 3:26 pm

Try:

Code: Select all

import org.opensim.modeling.*
tmp = Millard2012EquilibriumMuscle();
opensimCommon.LoadOpenSimLibrary("...\ScapulothoracicJointPlugin40_WinX64")
model = Model('...\ThoracoscapularShoulderModelSubject.osim');
state = model.initSystem();
EDIT:

Based on this code snippet:

Code: Select all

>> teresminor = Millard2012EquilibriumMuscle.safeDownCast(teresminor)
You ran this line in the Command Window. Did you first run `import org.opensim.modeling.*` in the Command Window?

User avatar
Tom Driessen
Posts: 5
Joined: Mon Mar 16, 2020 7:45 am

Re: computeFiberEquilibrium is undenfined

Post by Tom Driessen » Thu May 14, 2020 3:37 pm

I tried and it gave the following error:

Undefined function 'computeFiberEquilibrium' for input
arguments of type 'org.opensim.modeling.Muscle'.

Error in surfaceplot (line 64)
teresminor.computeFiberEquilibrium(state,true);


in case it helps, this is how I called the muscle

Code: Select all

teresminor = model.getMuscles().get('TeresMinor');

User avatar
Tom Driessen
Posts: 5
Joined: Mon Mar 16, 2020 7:45 am

Re: computeFiberEquilibrium is undenfined

Post by Tom Driessen » Thu May 14, 2020 3:47 pm

I just saw your edit, I tried it in script and there are no longer any error messages. Thank you :D

POST REPLY