Page 1 of 1

set external force in matlab and opensim compute new state

Posted: Tue Oct 25, 2016 11:32 am
by robot
I want to set external force in matlab and opensim compute force and new state after this force. I compile c++ code and define a mex file. But I don’t know how define external force in opensim. I want to use external force class in opensim but it’s get information from storage file. How I can set external force in matlab and define as input in opensim "compute force" function

Re: set external force in matlab and opensim compute new state

Posted: Wed Oct 26, 2016 1:46 am
by mitkof6
Maybe you are interested in PrescribedForce:

https://simtk.org/api_docs/opensim/api_ ... Force.html

Best

Re: set external force in matlab and opensim compute new state

Posted: Thu Oct 27, 2016 1:44 am
by robot
Yes, do you say use these function of prescribedforce:
SetTorqueFunction
SetPointFunctions
I define a header file that define this class and this function and then define a source file that define function and define mex file?
After define mex file and compile it, in matlab use the function SetTorqueFunction and SetPointFunction?