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
Movement caused by Muscle
- Thomas Uchida
- Posts: 1798
- Joined: Wed May 16, 2012 11:40 am
Re: Movement caused by Muscle
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).
- Robert Steidl
- Posts: 16
- Joined: Tue Nov 24, 2015 3:03 am
Re: Movement caused by Muscle
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
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
- Thomas Uchida
- Posts: 1798
- Joined: Wed May 16, 2012 11:40 am
Re: Movement caused by Muscle
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
There may be some useful example code in testActuators.cpp: https://github.com/opensim-org/opensim- ... uators.cpp
- Robert Steidl
- Posts: 16
- Joined: Tue Nov 24, 2015 3:03 am
Re: Movement caused by Muscle
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
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
- Thomas Uchida
- Posts: 1798
- Joined: Wed May 16, 2012 11:40 am
Re: Movement caused by Muscle
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.
- Ursula Schulz
- Posts: 4
- Joined: Fri Mar 22, 2013 4:12 am
Re: Movement caused by Muscle
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
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
- Ursula Schulz
- Posts: 4
- Joined: Fri Mar 22, 2013 4:12 am
Re: Movement caused by Muscle
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?
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
"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.