Page 1 of 1

Movement caused by Muscle

Posted: Tue Jan 10, 2017 3:05 am
by steidlr
Dear Community,

I do have (in my opinion) a simple problem, but I can't find a solution! I do have an external muscle model (created in MatLab), where I can get a force-time-curve generated by a muscle! Now, I have the same muscle implemented in OpenSim, attached to a bony element!
The only thing I want, is to add the simulated force-time-curve to the Muscle in OpenSim to get a contraction! How do I have to do this?

Hope you can help me - greetings from Vienna,
Robert

Re: Movement caused by Muscle

Posted: Tue Jan 10, 2017 11:50 am
by tkuchida
If you know the force generated by the muscle as a function of time, you might consider simply applying the force to your model using a PointToPointActuator (https://simtk.org/api_docs/opensim/api_ ... uator.html) that is controlled by a PrescribedController (https://simtk.org/api_docs/opensim/api_ ... oller.html).

Re: Movement caused by Muscle

Posted: Fri Jan 27, 2017 3:24 am
by steidlr
Thank you Tom Uchida for this advice.

I tried to add a PointToPointActuator to my model in the same way it is done in the APIExamples/CustomActuatorExample.

everything works fine, until a want to add the actuator to the model with 'Model.addforce(actuator)' .
During compling the '.cpp' now error occurs.
When i want to execute the .exe file, the file will be executet till the line of the command addforce. Afterward the execution get canncelled, without warning or error and no .osim file will be generated.

I looked into to err.log for a reason of the termination, but this file is empty

Do someone know the reason for this problem?

greetings from Vienna
Robert

Re: Movement caused by Muscle

Posted: Sat Jan 28, 2017 2:42 pm
by tkuchida
What error do you get when compiling?
There may be some useful example code in testActuators.cpp: https://github.com/opensim-org/opensim- ... uators.cpp

Re: Movement caused by Muscle

Posted: Mon Jan 30, 2017 6:16 am
by steidlr
Thank you for the link..

sorry it was an typing error.. no error or warning occure during compiling.

I compared my file with your example and I adapted it. But nothing has changed.
I noticed one difference. the command Model.addJoint(*joint) doesn't exist in the API Version 3.3
could this be a reason? but when I open the Model in the GUI of OpenSim the joint exist.

thank you for your help

Re: Movement caused by Muscle

Posted: Wed Feb 01, 2017 2:33 am
by tkuchida
Sorry, I should have mentioned that the examples on GitHub will be using the 4.0 API, which may be slightly different than 3.3. It sounds like there might be a few things going on here. I recommend simplifying the model down to something that works and focusing on one issue at a time. One approach could be to first try adding a PointToPointActuator and controller (e.g., PrescribedController) by editing the XML file directly (you can copy and paste from the XML Browser—see the "Help" menu in the GUI). I believe your original objective was to apply forces that are stored in a file, so perhaps first take a direct approach to get that working and sort out any scripting issues in a second step.

Re: Movement caused by Muscle

Posted: Wed Feb 22, 2017 2:25 am
by uschulz
Thanks Tom for your advice.
I tired to implement a PointToPoint Actuator into to XML file and it worked out fine. in my next Step i wanted to implement the force over time with a .mot file, like it is possible in the API example CustomActuator ... As i run the example the error occure, that the .mot file (actuator_forces.mot) "Could not associate motion to current model".
my question is now how has a .mot file to look, that the force can be applied?

I haven't found another example, where an pointActuator was used and a could compare it to the toyleg example

i would be thankful for any help

Re: Movement caused by Muscle

Posted: Tue Feb 28, 2017 4:57 am
by uschulz
isn't there any working example to controll the actuator with force over time. The toyleg.osim isn't working, always the failer "Could not associate motion to current model" occure.

or is there anywhere a ".xsd" file, where I can figure out how the ".mot" file for the actuator has to look like?

Re: Movement caused by Muscle

Posted: Tue Feb 28, 2017 10:05 am
by jimmy
"Could not associate motion to current model" errors are due to the column names in the .mot not matching the model. You must be careful that all strings in the .mot file match the corresponding components in the model.