Page 1 of 1
External Constant Force applied to a point
Posted: Wed Sep 22, 2010 7:02 am
by biomechanics
Hi,
Anyone could tell me how can I applied an external constant force to a body point from the API?
I tried this:
Vec3 footpoint(0,0,0);
Vec3 footforce(0,-2,0);
OpenSim::CustomForce::applyForceToPoint(*foot, footpoint, footforce);
And I got the followimg error message:
error C2660: 'OpenSim::CustomForce::applyForceToPoint' : function does not take 3 arguments
RE: External Constant Force applied to a point
Posted: Wed Sep 22, 2010 11:52 am
by aymanh
Hi Margarida,
The method you're referring to is "protected", that is it has to be called from a class that is a CustomForce (or a class that inherits from it) is that the correct context? If not you'll have to either use one of the OpenSim existing classes that inherits from CustomForce or write your own.
Cheers,
-Ayman
RE: External Constant Force applied to a point
Posted: Wed Sep 22, 2010 12:07 pm
by biomechanics
Hi Ayman,
So, what is the best way to apply an external constant force to a body center of mass, in order to run a dynamic analysis? Can I do it at the GUI or should I do it from API?
Thanks,
Margarida
RE: External Constant Force applied to a point
Posted: Wed Sep 22, 2010 12:18 pm
by aymanh
Hi Margarida,
If you want the force to always be in your model then you should add it to the model file (under the heading <ForceSet>). The forum thread at:
https://simtk.org/forum/message.php?msg_id=4725
shows the XML snippet you need to insert in order to apply a force in the X direction to the center of mass of the tibia_r body. Please try that & adjust for your needs and let me know if you run into problems. You should use either version 2.2 beta or 2.1 Beta (OpenSim-2.1.0_b6-win32VC8.exe) as we fixed some bugs to get this to work.
Please let me know how that goes,
-Ayman
RE: External Constant Force applied to a point
Posted: Mon Sep 27, 2010 11:25 am
by biomechanics
Hi Ayman,
That works fine.
Thanks,
Margarida