How to add prescribed force

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
John Rogers
Posts: 45
Joined: Fri Feb 24, 2012 11:47 am

How to add prescribed force

Post by John Rogers » Thu Jun 25, 2015 2:05 pm

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

User avatar
Nithin Kurup
Posts: 149
Joined: Sat Jan 18, 2014 5:13 am

Re: How to add prescribed force

Post by Nithin Kurup » Thu Jun 25, 2015 2:35 pm

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

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: How to add prescribed force

Post by jimmy d » Fri Jul 03, 2015 11:26 am

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

POST REPLY