Error building the ForcePluginExample in OpenSim 3.0

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Moe Curtin
Posts: 43
Joined: Fri Oct 02, 2009 5:40 am

Error building the ForcePluginExample in OpenSim 3.0

Post by Moe Curtin » Wed Nov 14, 2012 10:08 am

I have been working through a couple of the sdk examples in OpenSim 3.0 and have been having trouble compiling the BodyDrag example in the ForcePluginExample folder. All of the issues seem to be coming from the Force.h file. Could anybody point me in the right direction with this one please?

C:\OpenSim 3.0\sdk\APIExamples\Plugin\ForcePluginExample\BodyDrag.cpp(99): error C2259: 'OpenSim::BodyDrag' : cannot instantiate abstract class due to following members:
'OpenSim::Force *OpenSim::Force::clone(void) const' : is abstract
C:/OpenSim 3.0/sdk/include\OpenSim/Simulation/Model/Force.h(49) : see declaration of 'OpenSim::Force::clone'
'const std::string &OpenSim::Force::getConcreteClassName(void) const' : is abstract
C:/OpenSim 3.0/sdk/include\OpenSim/Simulation/Model/Force.h(49) : see declaration of 'OpenSim::Force::getConcreteClassName'
C:\OpenSim 3.0\sdk\APIExamples\Plugin\ForcePluginExample\BodyDrag.cpp(110): error C2248: 'OpenSim::Force::copyData' : cannot access private member declared in class 'OpenSim::Force'
C:/OpenSim 3.0/sdk/include\OpenSim/Simulation/Model/Force.h(221) : see declaration of 'OpenSim::Force::copyData'
C:/OpenSim 3.0/sdk/include\OpenSim/Simulation/Model/Force.h(48) : see declaration of 'OpenSim::Force'
C:\OpenSim 3.0\sdk\APIExamples\Plugin\ForcePluginExample\BodyDrag.cpp(122): error C3861: 'setType': identifier not found
C:\OpenSim 3.0\sdk\APIExamples\Plugin\ForcePluginExample\BodyDrag.cpp(157): error C2039: 'setup' : is not a member of 'OpenSim::Force'
C:/OpenSim 3.0/sdk/include\OpenSim/Simulation/Model/Force.h(48) : see declaration of 'OpenSim::Force'
RegisterTypes_osimPlugin.cpp
C:\OpenSim 3.0\sdk\APIExamples\Plugin\ForcePluginExample\RegisterTypes_osimPlugin.cpp(42): error C2259: 'OpenSim::BodyDrag' : cannot instantiate abstract class due to following members:
'OpenSim::Force *OpenSim::Force::clone(void) const' : is abstract
C:/OpenSim 3.0/sdk/include\OpenSim/Simulation/Model/Force.h(49) : see declaration of 'OpenSim::Force::clone'
'const std::string &OpenSim::Force::getConcreteClassName(void) const' : is abstract
C:/OpenSim 3.0/sdk/include\OpenSim/Simulation/Model/Force.h(49) : see declaration of 'OpenSim::Force::getConcreteClassName'

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: Error building the ForcePluginExample in OpenSim 3.0

Post by Ayman Habib » Thu Nov 15, 2012 11:51 am

Hi Moe,

Sorry about that but this API example, packaged with the release, needs update to match the latest API changes. We'll be putting an updated set of examples on the downloads page shortly.

Best regards,
-Ayman

User avatar
Moe Curtin
Posts: 43
Joined: Fri Oct 02, 2009 5:40 am

Re: Error building the ForcePluginExample in OpenSim 3.0

Post by Moe Curtin » Thu Nov 15, 2012 1:48 pm

Thanks Ayman!

User avatar
Benjamin Johnson
Posts: 5
Joined: Thu Feb 07, 2013 3:11 pm

Re: Error building the ForcePluginExample in OpenSim 3.0

Post by Benjamin Johnson » Thu Mar 14, 2013 12:06 pm

I'm having a problem where it can't find the include files in OpenSim/Simulation/... Have new examples been posted recently? I downloaded OpenSim 3.0 in January.

Thanks
Last edited by Benjamin Johnson on Fri Mar 15, 2013 1:35 pm, edited 1 time in total.

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: Error building the ForcePluginExample in OpenSim 3.0

Post by Ayman Habib » Thu Mar 14, 2013 12:24 pm

Hi Benjamin,

We updated the examples with the source release, and they should be updated in version 3.0.1 available in beta form. Please give it a spin and let us know how it goes so we can fix any problems, if any, before the official release.

Best regards,
-Ayman

User avatar
Benjamin Johnson
Posts: 5
Joined: Thu Feb 07, 2013 3:11 pm

Re: Error building the ForcePluginExample in OpenSim 3.0

Post by Benjamin Johnson » Fri Mar 15, 2013 1:34 pm

I downloaded 3.0.1, and things mostly work. The plugin compiles and loads into the GUI without a problem. If I do the forward dynamics from the GUI things work fine and agree with the expected results. When I run from the command line, it acts like it hasn't loaded the plugin and says 'BodyDragForce' is not a registered object. From the command line execution:

C:\OpenSim 3.0.1\sdk\APIExamples\Plugin\ForcePluginExample\TestPlugin\Example1_ThreeMasses>forward -L BodyDrag -S forward.xml
Failed to load library BodyDrag
ERROR- library BodyDrag could not be loaded.

Constructing tool from setup file forward.xml.

AbstractTool Three Masses loading model 'ThreeMasses.osim'
Object::newInstanceOfType(): object type 'BodyDragForce' is not a registered Obj
ect!
Object type BodyDragForce not recognized
Object::newInstanceOfType(): object type 'BodyDragForce' is not a registered Obj
ect!
Object type BodyDragForce not recognized
Object::newInstanceOfType(): object type 'BodyDragForce' is not a registered Obj
ect!
Object type BodyDragForce not recognized
Loaded model Three Masses from file ThreeMasses.osim
-----------------------------------------------------------------------
Running tool Three Masses.
No external loads will be applied (external loads file not specified).
MODEL: Three Masses

ANALYSES (1)
...
Integrating from 0 to 20
Printing results of investigation Three Masses to ..
Forward simulation time = 100ms

User avatar
Ayman Habib
Posts: 2248
Joined: Fri Apr 01, 2005 12:24 pm

Re: Error building the ForcePluginExample in OpenSim 3.0

Post by Ayman Habib » Mon Mar 18, 2013 9:01 am

Hi Benjamin,

The problem is that the dll BodyDrag could not be located. Since the dll/shared-library is not located, the object defined in this library is not recognized and that explains the problems you reported downstream. You can work around this in two possible ways:
1. use the full path after the -L option (recommended)
2. Add the directory where the dll is located to your Path environment variable.

Thanks for testing and please let us know if that resolves your problem.

Best regards,
-Ayman

User avatar
Benjamin Johnson
Posts: 5
Joined: Thu Feb 07, 2013 3:11 pm

Re: Error building the ForcePluginExample in OpenSim 3.0

Post by Benjamin Johnson » Mon Mar 18, 2013 9:52 am

I used option 1 and it worked.
Thanks,
-Ben

POST REPLY