Movement caused by Muscle

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Robert Steidl
Posts: 16
Joined: Tue Nov 24, 2015 3:03 am

Movement caused by Muscle

Post by Robert Steidl » Tue Jan 10, 2017 3:05 am

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

User avatar
Thomas Uchida
Posts: 1798
Joined: Wed May 16, 2012 11:40 am

Re: Movement caused by Muscle

Post by Thomas Uchida » Tue Jan 10, 2017 11:50 am

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).

User avatar
Robert Steidl
Posts: 16
Joined: Tue Nov 24, 2015 3:03 am

Re: Movement caused by Muscle

Post by Robert Steidl » Fri Jan 27, 2017 3:24 am

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

User avatar
Thomas Uchida
Posts: 1798
Joined: Wed May 16, 2012 11:40 am

Re: Movement caused by Muscle

Post by Thomas Uchida » Sat Jan 28, 2017 2:42 pm

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

User avatar
Robert Steidl
Posts: 16
Joined: Tue Nov 24, 2015 3:03 am

Re: Movement caused by Muscle

Post by Robert Steidl » Mon Jan 30, 2017 6:16 am

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

User avatar
Thomas Uchida
Posts: 1798
Joined: Wed May 16, 2012 11:40 am

Re: Movement caused by Muscle

Post by Thomas Uchida » Wed Feb 01, 2017 2:33 am

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.

User avatar
Ursula Schulz
Posts: 4
Joined: Fri Mar 22, 2013 4:12 am

Re: Movement caused by Muscle

Post by Ursula Schulz » Wed Feb 22, 2017 2:25 am

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

User avatar
Ursula Schulz
Posts: 4
Joined: Fri Mar 22, 2013 4:12 am

Re: Movement caused by Muscle

Post by Ursula Schulz » Tue Feb 28, 2017 4:57 am

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?

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: Movement caused by Muscle

Post by jimmy d » Tue Feb 28, 2017 10:05 am

"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.

POST REPLY