prescribed force
- Anne Schmitz
- Posts: 76
- Joined: Thu May 31, 2007 7:44 am
prescribed force
Does anyone have an example of how to add a prescribed force to my .osim model? I tried looking at the online documentation but I get an OpenSim message that says 'illegal tag body_name.'
- Nur Adila Faruk Senan
- Posts: 75
- Joined: Tue Apr 06, 2010 8:20 pm
RE: prescribed force
Hey Anne,
I don't know if this is the easiest way, but I used it a while ago and it works so i'm just passign it along. Just ad this piece of code in the middle of the
<ForceSet>
<Objects>
...
</Objects>
<ForceSet> section of the .osim file.
<PrescribedForce name= "prescribedF">
<body>lumbar1</body>
<pointIsGlobal>true</pointIsGlobal>
<forceIsGlobal>true</forceIsGlobal>
<forceFunctions>
<function>
<Constant name="Fx">
<value> 100.00000000000000000000 </value>
</Constant>
</function>
<function>
...repeat for Fy, Fz
</forceFunctions>
<pointFunctions>
<function>
<Constant name="Px">
<value> 0.00000000000000000000 </value>
</Constant>
</function>
...repeat for Py, Pz
</pointFunctions>
<torqueFunctions>
<function>
<Constant name="Mx">
<value> 0.00000000000000000000 </value>
</Constant>
</function>
...repeat for My, Mz
</torqueFunctions>
</PrescribedForce>
and change the numbers/parameters as fit (i.e. if the force is local, that is, it changes its direction as the lumbar1 body changes orientation, then
set "forceIsGlobal" to false, etc. The "body" is the body you want the force/moment applied to.
i haven't figured out how to write a separate .xml file that'll do it though, since this way, you have to keep changing the .osim file every time you want to change the force, but it gets the job done.
adila
I don't know if this is the easiest way, but I used it a while ago and it works so i'm just passign it along. Just ad this piece of code in the middle of the
<ForceSet>
<Objects>
...
</Objects>
<ForceSet> section of the .osim file.
<PrescribedForce name= "prescribedF">
<body>lumbar1</body>
<pointIsGlobal>true</pointIsGlobal>
<forceIsGlobal>true</forceIsGlobal>
<forceFunctions>
<function>
<Constant name="Fx">
<value> 100.00000000000000000000 </value>
</Constant>
</function>
<function>
...repeat for Fy, Fz
</forceFunctions>
<pointFunctions>
<function>
<Constant name="Px">
<value> 0.00000000000000000000 </value>
</Constant>
</function>
...repeat for Py, Pz
</pointFunctions>
<torqueFunctions>
<function>
<Constant name="Mx">
<value> 0.00000000000000000000 </value>
</Constant>
</function>
...repeat for My, Mz
</torqueFunctions>
</PrescribedForce>
and change the numbers/parameters as fit (i.e. if the force is local, that is, it changes its direction as the lumbar1 body changes orientation, then
set "forceIsGlobal" to false, etc. The "body" is the body you want the force/moment applied to.
i haven't figured out how to write a separate .xml file that'll do it though, since this way, you have to keep changing the .osim file every time you want to change the force, but it gets the job done.
adila
- Anne Schmitz
- Posts: 76
- Joined: Thu May 31, 2007 7:44 am
RE: prescribed force
I tried that syntax and it didn't work. Here is a snippet that runs on the newest version of OpenSim.
<PrescribedForce name= "prescribedF">
<body>tibia_r</body>
<pointIsGlobal>true</pointIsGlobal>
<forceIsGlobal>false</forceIsGlobal>
<FunctionSet name="forceFunctions">
<objects>
<NaturalCubicSpline name="Fx">
<x> 0.0 1 </x>
<y> 0.00000000 100 </y>
</NaturalCubicSpline>
<Constant name="Fy">
<value> 0.00000000000000000000 </value>
</Constant>
<Constant name="Fz">
<value> 0.00000000000000000000 </value>
</Constant>
</objects>
</FunctionSet>
</PrescribedForce>
<PrescribedForce name= "prescribedF">
<body>tibia_r</body>
<pointIsGlobal>true</pointIsGlobal>
<forceIsGlobal>false</forceIsGlobal>
<FunctionSet name="forceFunctions">
<objects>
<NaturalCubicSpline name="Fx">
<x> 0.0 1 </x>
<y> 0.00000000 100 </y>
</NaturalCubicSpline>
<Constant name="Fy">
<value> 0.00000000000000000000 </value>
</Constant>
<Constant name="Fz">
<value> 0.00000000000000000000 </value>
</Constant>
</objects>
</FunctionSet>
</PrescribedForce>