Page 1 of 1

Creating Custom Controller in Matlab

Posted: Wed Apr 08, 2020 2:43 am
by danielfng
Hi,

I was wondering if it's possible in OpenSim 4.1 to create a custom controller component in Matlab (e.g. in a similar manner to as is done in the TugOfWar Controller example in the C++ files).

I know this wasn't possible in OpenSim 3.3 but just wanted to check. I have a work-around involving the Manager and a PrescribedController which is updated at short time-scales, if not.

Cheers

Re: Creating Custom Controller in Matlab

Posted: Wed Apr 08, 2020 10:00 am
by ongcf
I looked through the TugOfWar code from 4.1, and I see the controls section between L260 and L275. It looks like it's also using a PrescribedController as you are using with a linear function. Is this what you're referring to? If so, I think it should be doable. LinearFunction should be available in MATLAB, and Array<double> should be ArrayDouble in MATLAB.

Re: Creating Custom Controller in Matlab

Posted: Thu Aug 20, 2020 8:17 pm
by carlosoleto
Hello Carmichael, I am starting my research on custom controllers for OpenSim.

Do you know if there is an example in Python?

Best regards.

Re: Creating Custom Controller in Matlab

Posted: Fri Aug 21, 2020 1:11 am
by mitkof6
Hi Carlos,

Just to compliment Carmichael's answer, you can find an example code of a custom controller in C++ below:

https://github.com/mitkof6/OpenSim_API_ ... controller

If you want to create controllers in Python, keep in mind that they are not tightly integrated as would be in C++. One approach is to set the muscle excitation and integrate the system as with the osim-rl project. Please also, consider the following discussion:

viewtopicPhpbb.php?f=91&t=12337&p=0&sta ... 4086ef55f8