Page 1 of 1

Applying ExternalForces during Static Optimization

Posted: Thu Jan 25, 2024 11:24 am
by novot
I am attempting to apply an ExternalForce to an OpenSim model during Static Optimization. I am currently using the arm26.osim model as a simplified starting point. The end goal is to use this knowledge to aid in performing isometric force production simulations. I am using OpenSim 3.2 and Matlab R2015B.

So far, I have positioned the model with 90 degrees of elbow flexion. I also have a modified motion file which holds this pose for a one-second duration. I would now like to apply a 10N downward ExternalForce to the 'r_ulna_radius_hand' body within the model to see how the force production of the biceps changes.

I have created a source file (.mot) for the forces which includes a time column for the one second duration, along with three columns for the force application (r_ulna_radius_hand.x, etc.) with the value of -10 being given for the y-direction column.

My problem is twofold:
1) When trying to add the source file to the ExternalForces object in Matlab using

Code: Select all

externalForce.setDataSource('arm26_static_force.mot');
I am met with the following error -

Code: Select all

No method 'setDataSource' with matching signature found for class 'org.opensim.modeling.ExternalForce'.
2) Is the column header given for the x, y, and z directions in the source file correct for this model?

Thanks in advance, and I can provide more information if needed.

Re: Applying ExternalForces during Static Optimization

Posted: Fri Jan 26, 2024 4:10 pm
by tkuchida
No method 'setDataSource' with matching signature found for class 'org.opensim.modeling.ExternalForce'.
The argument passed to the ExternalForce::setDataSource() method must be of type Storage (see the OpenSim 3.2 doxygen documentation here: https://simtk.org/api_docs/opensim/api_ ... f79a63ad47). I think you would need to do something like this:

Code: Select all

myStorage = osim.Storage('arm26_static_force.mot');
externalForce.setDataSource(myStorage);

Re: Applying ExternalForces during Static Optimization

Posted: Mon Jan 29, 2024 12:09 pm
by novot
And just like that, my problem has been fixed! Thank you very much for your input, Thomas, it's greatly appreciated :D