Page 1 of 1

How to add prescribed force

Posted: Thu Jun 25, 2015 2:05 pm
by resodad
Hello,
How do I add a prescribed torque to a model?
I know the function of time I want.
I know the bodies to apply the force to.
I see the xml code for <PrescribedForce>,
I see a place for <FunctionSet name="torqueFunctions">,
but how do I enter the time-torque pairs?

I found the Doxygen documentation, but I do not know how to proceed.
I should be able to do this without programming in c++.

I have dug through tutorials and the forum and I cant find anything.

Thanks,
John

Re: How to add prescribed force

Posted: Thu Jun 25, 2015 2:35 pm
by ex10192
Hi John,

You could perhaps try this, not sure though. I know that you need to make a prescribed function using linearpiecewise function or simmspline etc. But not sure if the <prescribed>true </prescribed> tag need here.

Code: Select all

       <ForceSet>
       <PrescribedForce name="armForce">
         <isDisabled> false </isDisabled>
         <body> arm </body>
         <pointIsGlobal> false </pointIsGlobal>
         <forceIsGlobal> true </forceIsGlobal>
         //<FunctionSet name="forceFunctions"> //  not sure exactly
        <SimmSpline>
       <x>   0  1    </x> //  time
       <y>  0  1     </y>     // force value
       </SimmSpline>
        </FunctionSet>
         <prescribed>true </prescribed>
       </ForceSet>
Hope it gives some idea,

Nithin

Re: How to add prescribed force

Posted: Fri Jul 03, 2015 11:26 am
by jimmy
Hi John,

Looking at the PrescribedForce class (https://simtk.org/api_docs/opensim/api_ ... Force.html), it looks like you are the setTorqueFunction. I haven't played with it myself, but it looks like this is what you will need.

Cheers,
-james