How to register new Controller class type written in OpenSim API

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Kenechukwu Mbanisi
Posts: 51
Joined: Fri Feb 10, 2017 2:50 pm

Re: How to register new Controller class type written in OpenSim API

Post by Kenechukwu Mbanisi » Fri Jun 23, 2017 10:09 am

Hello Tom,

Thank you for your suggestion. I had it tried out and here's the result:

Code: Select all

>> import org.opensim.modeling.*;
>> opensimCommon.LoadOpenSimLibrary('C:/OpenSim 3.3/plugins/PDControl');

Undefined variable "opensimCommon" or class "opensimCommon.LoadOpenSimLibrary".
It's apparently not recognizing "opensimCommon" and I am not sure what "opensimCommon" actually is. Any help here, please?

Kenechukwu

P.S. I don't know if this is useful info: MATLAB version: R2017a (9.2.0.556344)

User avatar
Thomas Uchida
Posts: 1780
Joined: Wed May 16, 2012 11:40 am

Re: How to register new Controller class type written in OpenSim API

Post by Thomas Uchida » Fri Jun 23, 2017 10:53 am

I did not suggest replacing osimModel with opensimCommon, just removing ".dll". Please also note the Issues listed at the bottom of the "Creating Plugins" page in the Confluence documentation (http://simtk-confluence.stanford.edu:80 ... ng+Plugins). The "Using Plugins" page (http://simtk-confluence.stanford.edu:80 ... ng+Plugins) lists instructions for MATLAB. I would make sure you're using the correct version of Visual Studio, and try the following code:

Code: Select all

import org.opensim.modeling.*;
Model.LoadOpenSimLibrary('C:/OpenSim 3.3/plugins/PDControl');

User avatar
Kenechukwu Mbanisi
Posts: 51
Joined: Fri Feb 10, 2017 2:50 pm

Re: How to register new Controller class type written in OpenSim API

Post by Kenechukwu Mbanisi » Fri Jun 23, 2017 6:50 pm

Hello Tom,

Thank you so much for your help so far, I really appreciate it. Thanks for the references, I've looked into them.

Here's what I am doing:

Code: Select all

>> model = Model("Two_Link_Arm.osim");
>> model.LoadOpenSimLibrary('C:/OpenSim 3.3/plugins/PDControl');
>> control = PDController();
Result is "Undefined function or variable 'PDController'."

My Visual Studio version is 14.0.25431.01 (2015, win64)
However, with Christopher's help, I created the plugin with the the VC2015 (win64) version of OpenSim 3.3.

Any thoughts on what may be going wrong here?

Kenechukwu

User avatar
Thomas Uchida
Posts: 1780
Joined: Wed May 16, 2012 11:40 am

Re: How to register new Controller class type written in OpenSim API

Post by Thomas Uchida » Fri Jun 23, 2017 9:45 pm

Any thoughts on what may be going wrong here?
Ah, the problem is that you cannot create a new instance of PDController ("control = PDController();") in scripting. The LoadOpenSimLibrary() method will allow you to open and interpret a model file that contains a PDController object, but you cannot create such an object in MATLAB (the interface between MATLAB and C++ hasn't been defined for your new object). Ayman provided some additional information here: viewtopicPhpbb.php?f=91&t=5974.

User avatar
Kenechukwu Mbanisi
Posts: 51
Joined: Fri Feb 10, 2017 2:50 pm

Re: How to register new Controller class type written in OpenSim API

Post by Kenechukwu Mbanisi » Mon Jun 26, 2017 9:00 am

Hello Tom,

Thank you very much. I am all set!

Great support! Thank you again!!!

Kenechukwu

POST REPLY