Create Plugin for new component

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Vinh Nguyen
Posts: 21
Joined: Fri Sep 26, 2014 8:53 pm

Create Plugin for new component

Post by Vinh Nguyen » Fri Nov 04, 2016 10:57 am

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

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

Re: Create Plugin for new component

Post by Dimitar Stanev » Sun Nov 06, 2016 11:29 am

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.

User avatar
Vinh Nguyen
Posts: 21
Joined: Fri Sep 26, 2014 8:53 pm

Re: Create Plugin for new component

Post by Vinh Nguyen » Mon Nov 07, 2016 9:52 am

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)
Attachments
ErrorLoadingModel.PNG
ErrorLoadingModel.PNG (10.7 KiB) Viewed 224 times

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

Re: Create Plugin for new component

Post by Dimitar Stanev » Tue Nov 08, 2016 12:54 am

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_*.

User avatar
Vinh Nguyen
Posts: 21
Joined: Fri Sep 26, 2014 8:53 pm

Re: Create Plugin for new component

Post by Vinh Nguyen » Wed Nov 09, 2016 10:36 am

Thank you very much, it works with GUI now. I am trying to test with Matlab.

Best,
Vinh

POST REPLY