Page 1 of 1

New Matlab controller

Posted: Thu Mar 01, 2018 8:31 am
by biotn_mpg
Hi all,

I am trying to create my own controller. How can I script with Matlab a new class inherited from the OpenSim Controller class as shown in the developer's guide (https://simtk-confluence.stanford.edu/d ... r+Part+One) ?

Any advice or example code would be of great help!

Thanks
Marina

Re: New Matlab controller

Posted: Thu Mar 01, 2018 10:37 am
by chrisdembia
It is not currently possible to create new components in Matlab. If you want to create a custom controller class, you must do this in C++.

Re: New Matlab controller

Posted: Fri Mar 02, 2018 2:15 am
by biotn_mpg
Thank you for your reply.
Is it then possible to add a custom controller class built in C++ into the opensim Matlab library ? Do you have any advice on how to do that?
Thanks again for your help
Marina

Re: New Matlab controller

Posted: Sun Mar 04, 2018 11:45 pm
by chrisdembia
You can load OSIM files in Matlab that contain your custom controller. Make sure to load the library containing your custom controller in Matlab; the line is something like `org.opensim.modeling.Model.LoadOpenSimLibrary(<path-to-library>)`. If using 3.3, leave off the extension (e.g., ".dll").

You can not create or access your custom controller using Matlab code.

Re: New Matlab controller

Posted: Mon Mar 05, 2018 2:38 am
by biotn_mpg
Thanks. That's clear for me now.
I will try to create my custom controller and load the library in Matlab.
I will certainly get back to you :)
Marina

Re: New Matlab controller

Posted: Mon May 14, 2018 4:59 am
by biotn_mpg
Hello,

Since my last post, I currently develop my own controller using the platform OpenSim/Matlab.

I would like to calculate the moment (muscle force * moment arm) of each muscle seperately to provide a torque feedback to my controller. I don't know exactely which method I should use to get a muscle total force and moment arm for a given state. I found a quite similar question on the forum called "Problem with muscle analysis" but the links to the matlab example (provided by James Dunne) are unfortunately no more available.

Can anybody help me ?

Thanks
Marina