Set Muscle Excitation through Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Zhenwei Liu
Posts: 6
Joined: Sat Sep 15, 2018 7:03 pm

Set Muscle Excitation through Matlab

Post by Zhenwei Liu » Sat Feb 16, 2019 11:51 pm

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!

Tags:

User avatar
Aaron Fox
Posts: 292
Joined: Sun Aug 06, 2017 10:54 pm

Re: Set Muscle Excitation through Matlab

Post by Aaron Fox » Sun Feb 17, 2019 3:29 pm

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

User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: Set Muscle Excitation through Matlab

Post by Dimitar Stanev » Mon Feb 18, 2019 1:11 am

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

POST REPLY