External Constant Force applied to a point

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Margarida Machado
Posts: 16
Joined: Mon Apr 12, 2010 7:56 am

External Constant Force applied to a point

Post by Margarida Machado » Wed Sep 22, 2010 7:02 am

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


User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

RE: External Constant Force applied to a point

Post by Ayman Habib » Wed Sep 22, 2010 11:52 am

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

User avatar
Margarida Machado
Posts: 16
Joined: Mon Apr 12, 2010 7:56 am

RE: External Constant Force applied to a point

Post by Margarida Machado » Wed Sep 22, 2010 12:07 pm

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

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

RE: External Constant Force applied to a point

Post by Ayman Habib » Wed Sep 22, 2010 12:18 pm

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


User avatar
Margarida Machado
Posts: 16
Joined: Mon Apr 12, 2010 7:56 am

RE: External Constant Force applied to a point

Post by Margarida Machado » Mon Sep 27, 2010 11:25 am

Hi Ayman,

That works fine.

Thanks,
Margarida

POST REPLY