Page 1 of 1

PrescribedForce

Posted: Tue Mar 09, 2021 5:47 am
by amini_opensim
Hi guys

I was wondering if how I could use PrescribedForce in matlab to apply a force into calcn_r or other points.
in C++ :
PrescribedForce("prescribedForce", *block)
but it's not work in matlab

Thanks for guiding me

Re: PrescribedForce

Posted: Tue Mar 09, 2021 7:08 am
by amini_opensim
Hi again

as I mentioned about Prescribedforce, I use this cod:


prescribedForce = PrescribedForce();
prescribedForce.setFrameName('calcn_r')
yy = Constant(10000);
pp = Constant(0);
prescribedForce.setForceFunctions(yy,pp,pp)
prescribedForce.setPointFunctions (pp,pp,pp)
HGait.addForce(prescribedForce)

but it's not work and the following error is occurred:


Java exception occurred:
java.io.IOException: Failed to connect Socket 'frame' of type PhysicalFrame (details: Component 'prescribedforce' could not find 'calcn_r' of
type PhysicalFrame. Make sure a component exists at this path and that it is of the correct type.
Thrown at Component.h:764 in getComponent().).
In Object 'prescribedforce' of type PrescribedForce.
Thrown at Component.cpp:314 in finalizeConnections().

at org.opensim.modeling.opensimSimulationJNI.Model_initSystem(Native Method)

at org.opensim.modeling.Model.initSystem(Model.java:848)

Re: PrescribedForce

Posted: Tue Mar 09, 2021 10:40 am
by aymanh
Hello,

You'll likely need a full component path rather than just a body name, so something along the lines of '/bodyset/calcn_r'. You should be able to see the full component path for your specific model in the application by hovering over the corresponding node in the navigator panel.

Hope this helps,
-Ayman