Page 1 of 1

Set Muscle Excitation through Matlab

Posted: Sat Feb 16, 2019 11:51 pm
by lzhen97
Hi there,
I tried to set the muscle excitation through Matlab, and read the knee angle from Matlab as well. I went through the OpenSim API documentation, and used "Muscle.setExcitation()" and "Joint.get_coordinates ('Joint Name')" respectively. However, none of these command works. The system just told me something like "No method 'setExcitation' with matching signature found for class 'org.opensim.modeling.Muscle'.". Could anyone help me with it? Thank you so much!

Re: Set Muscle Excitation through Matlab

Posted: Sun Feb 17, 2019 3:29 pm
by aafox
Hi Zhenwei,

While not directly answering your question, I've found using the 'methods' and 'methodsview' commands in Matlab useful for troubleshooting these "No method '...' with matching signature found for class '...'" sort of problems. You could check out 'methods Muscle' or 'methodsview Muscle' and this show you a list of the available commands and their inputs/outputs. This might help you find the appropriate method for setting the muscle excitation.

Hope it helps,

Aaron

Re: Set Muscle Excitation through Matlab

Posted: Mon Feb 18, 2019 1:11 am
by mitkof6
Hi,

Controlling the muscle excitation is typically performed through a controller. Despite that there is a setExcitation method, currently it is not working as you might think (its use is different). Please look at the following example:

https://github.com/opensim-org/opensim- ... del.py#L99

where a PrescribedController is being used. If this controller is not appropriate for you task then you may need to implement your own controller through the C++ API and create a plugin that will be loaded by Matlab.

More on plugins: https://simtk-confluence.stanford.edu/d ... ng+Plugins

Example of task-based muscle controller: https://github.com/mitkof6/task-space/b ... ol.cpp#L68

Example of a Matlab controller: https://simtk.org/projects/opensimmatlab