Page 1 of 1

Create Plugin for new component

Posted: Fri Nov 04, 2016 10:57 am
by vinhnguyen
Hi,

I have created a new component which is a new kind of actuator. I have tested it by create new model using it in main() program with VS C++.
Now, I would like to create a plugin (.dll and .lib) files for my component. I have followed the template for analyses plugin example provided by OpenSim. I am able to build and create .dll and .lib. After I loaded my plugin into GUI, then when I tried to open a .osim model that uses my component, I am not able to open the file.
I guess there could be 2 reasons: either my project of creating plugin is not correct, or my .osim model is not correct.
For the first reason, I wonder are there any differences between creating a plugin for analysis tool and new component which is actuator?
For the second reason, could you suggest a way to use and test my component (use .dll or .lib file in Matlab or GUI)?

Thank you in advance,

Vinh

Re: Create Plugin for new component

Posted: Sun Nov 06, 2016 11:29 am
by mitkof6
What is the error that you get?

You can test if the new actuator is serialized correctly by loading the .osim model in your main, and not add the new actuator programmatically.

Re: Create Plugin for new component

Posted: Mon Nov 07, 2016 9:52 am
by vinhnguyen
What is the error that you get?
=> When I loaded model in GUI, it just kept showing "Loading model file ...".
You can test if the new actuator is serialized correctly by loading the .osim model in your main, and not add the new actuator programmatically
=>I have tried to load the .osim model in my main.Then run the .exe file. The error I got is
".. object type 'ElectricActuator' is not a registered Object!.." (attached picture)

Re: Create Plugin for new component

Posted: Tue Nov 08, 2016 12:54 am
by mitkof6
If you look into the AnalysisPluginExample, you will find the RegisterTypes_osimPlugin*. You have to register the new component so that OpenSim will know what your custom actuator type is during xml parsing. In the main file you can register it through

Code: Select all

Object::RegisterType( AnalysisPlugin_Template()) ;
before loading the model. As for the GUI plugin you need to supply the RegisterTypes_*.

Re: Create Plugin for new component

Posted: Wed Nov 09, 2016 10:36 am
by vinhnguyen
Thank you very much, it works with GUI now. I am trying to test with Matlab.

Best,
Vinh