Add prescribed force - reference axis
Posted: Wed Mar 15, 2017 4:44 am
Hello,
I want to add an external force to a body with these settings:
The point of application should be in body frame, so that when the body moves, the force to 'follow' it.
But the direction of the force should be constant in x-direction of global frame.
Can someone help me how to do that using the API? I think I am doing it right, but I am not sure, because the visualization in the GUI is a bit tricky!
Here is my code now:
When I export the force with ForceReporter, and load it in the OpenSim GUI, it seems like the point of application is right, but when the tibia rotates, rotates the force as well, as if the direction of the force is set in x-direction of body frame (not global).
I want to add an external force to a body with these settings:
The point of application should be in body frame, so that when the body moves, the force to 'follow' it.
But the direction of the force should be constant in x-direction of global frame.
Can someone help me how to do that using the API? I think I am doing it right, but I am not sure, because the visualization in the GUI is a bit tricky!
Here is my code now:
Code: Select all
PrescribedForce *prescribedForce = new PrescribedForce(&model.updBodySet().get("tibia_r"));
prescribedForce->setForceFunctions(new Constant(-110.0), new Constant(0.0), new Constant(0.0));
prescribedForce->setPointFunctions(new Constant(0.0), new Constant(-0.3), new Constant(0.0));
prescribedForce->setForceIsInGlobalFrame(true);
prescribedForce->setPointIsInGlobalFrame(false);
model.addForce(prescribedForce);