Applying ExternalForces during Static Optimization

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ryan Novotny
Posts: 5
Joined: Tue Jun 22, 2021 1:49 pm

Applying ExternalForces during Static Optimization

Post by Ryan Novotny » Thu Jan 25, 2024 11:24 am

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.

Tags:

User avatar
Thomas Uchida
Posts: 1777
Joined: Wed May 16, 2012 11:40 am

Re: Applying ExternalForces during Static Optimization

Post by Thomas Uchida » Fri Jan 26, 2024 4:10 pm

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);

User avatar
Ryan Novotny
Posts: 5
Joined: Tue Jun 22, 2021 1:49 pm

Re: Applying ExternalForces during Static Optimization

Post by Ryan Novotny » Mon Jan 29, 2024 12:09 pm

And just like that, my problem has been fixed! Thank you very much for your input, Thomas, it's greatly appreciated :D

POST REPLY