Access EOM/ ODE to perform FWD outside Opensim
- Lars Boers
- Posts: 14
- Joined: Thu Sep 06, 2018 2:23 am
Access EOM/ ODE to perform FWD outside Opensim
Hi Guys,
I want to perform FWD within Matlab and change performance criteria/ constraints. Is it possible to do this and access EOM of .osim models through Matlab?
Thanks in advance,
Lars Boers
I want to perform FWD within Matlab and change performance criteria/ constraints. Is it possible to do this and access EOM of .osim models through Matlab?
Thanks in advance,
Lars Boers
Tags:
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Access EOM/ ODE to perform FWD outside Opensim
It depends on the variables that you need to access; some quantities cannot be accessed using the Matlab API.
viewtopicPhpbb.php?f=91&t=9804&p=27088&start=0&view=
viewtopicPhpbb.php?f=91&t=9804&p=27088&start=0&view=
- Lars Boers
- Posts: 14
- Joined: Thu Sep 06, 2018 2:23 am
Re: Access EOM/ ODE to perform FWD outside Opensim
Hi Dimitar,
(using your instructions in the other post) I have succeeded in making a MEX wrapper for my project, however, during the setup of my .osim model it is stated that the object: Coordinateactuator is not recognized. Is this a problem of the simbody installation progress or an issue somewhere else?
Thanks!
Lars Boers
(using your instructions in the other post) I have succeeded in making a MEX wrapper for my project, however, during the setup of my .osim model it is stated that the object: Coordinateactuator is not recognized. Is this a problem of the simbody installation progress or an issue somewhere else?
Thanks!
Lars Boers
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Access EOM/ ODE to perform FWD outside Opensim
Make sure to include
The actual name of the object is CoordinateActuator
Code: Select all
include <OpenSim/Actuators/CoordinateActuator.h>
- Lars Boers
- Posts: 14
- Joined: Thu Sep 06, 2018 2:23 am
Re: Access EOM/ ODE to perform FWD outside Opensim
Hi Dimitar,
Thanks for the tips, however after adding the given code (with a # is presumed), I still get the following error:
Object::newInstanceOfType(): object type 'CoordinateActuator' is not a registered Object!
Object type CoordinateActuator not recognized
I was unable to find the answer for this problem online, so do you have any more information on the error code?
Regards,
Lars Boers
Thanks for the tips, however after adding the given code (with a # is presumed), I still get the following error:
Object::newInstanceOfType(): object type 'CoordinateActuator' is not a registered Object!
Object type CoordinateActuator not recognized
I was unable to find the answer for this problem online, so do you have any more information on the error code?
Regards,
Lars Boers
- Lars Boers
- Posts: 14
- Joined: Thu Sep 06, 2018 2:23 am
Re: Access EOM/ ODE to perform FWD outside Opensim
After trying a few tries, I tried reconstructing the mex file in CMake. I got the following errors after trying (your) base CmakeList:
CMake Error at C:/Simbody/cmake/SimbodyConfig.cmake:104 (add_library):
add_library cannot create imported target "blas" because another target
with the same name already exists.
Call Stack (most recent call first):
C:/OpenSim 4.0/cmake/OpenSimConfig.cmake:102 (find_package)
CMakeLists.txt:50 (FIND_PACKAGE)
I was (again) unable to find information on this error online, so could you explain what this means?
Regards,
Lars Boers
CMake Error at C:/Simbody/cmake/SimbodyConfig.cmake:104 (add_library):
add_library cannot create imported target "blas" because another target
with the same name already exists.
Call Stack (most recent call first):
C:/OpenSim 4.0/cmake/OpenSimConfig.cmake:102 (find_package)
CMakeLists.txt:50 (FIND_PACKAGE)
I was (again) unable to find information on this error online, so could you explain what this means?
Regards,
Lars Boers
- Lars Boers
- Posts: 14
- Joined: Thu Sep 06, 2018 2:23 am
Re: Access EOM/ ODE to perform FWD outside Opensim
One last question,
How do I add the OpenSIm Include directory to the CmakeList. I tried using the link_direcotry/Include_directory command but this doesnt work
Thanks!
How do I add the OpenSIm Include directory to the CmakeList. I tried using the link_direcotry/Include_directory command but this doesnt work
Thanks!
- Dimitar Stanev
- Posts: 1096
- Joined: Fri Jan 31, 2014 5:14 am
Re: Access EOM/ ODE to perform FWD outside Opensim
For some reason CoordinateActuator is not register. Try this:
This version will probably not work with v4.0. Try modifying your CMake according to the sample provided by the developers:
https://github.com/opensim-org/opensim- ... eLists.txt
After finding the OpenSim library
OpenSim_* variables are defined for the include directory, library directory and libraries:
Code: Select all
Object::registerType( CoordinateActuator());
https://github.com/opensim-org/opensim- ... eLists.txt
After finding the OpenSim library
Code: Select all
find_package(OpenSim)
Code: Select all
include_directories(${OpenSim_INCLUDE_DIRS})
link_directories(${OpenSim_LIB_DIR})
target_link_libraries(target ${OpenSim_LIBRARIES})
- Lars Boers
- Posts: 14
- Joined: Thu Sep 06, 2018 2:23 am
Re: Access EOM/ ODE to perform FWD outside Opensim
Hi Dimitar,
Thanks for the tips, I will try this out!
What exactly do you mean with:
This version will probably not work with v4.0. Try modifying your CMake according to the sample provided by the developers:
Do I modify the OpenSim CMake file or do I modify the CMake file that I am using for the MEX wrapper? I'm guessing the prior because the target_include_drectories now gives the following error:
CMake Error at CMakeLists.txt:16 (target_link_libraries):
Cannot specify link libraries for target "target" which is not built by
this project.
Also, do I need to pass the same statements for mexplus which I am now passing for OpenSim (find/locate etc.)?
Again, many thanks!
Regards,
Lars Boers
Thanks for the tips, I will try this out!
What exactly do you mean with:
This version will probably not work with v4.0. Try modifying your CMake according to the sample provided by the developers:
Do I modify the OpenSim CMake file or do I modify the CMake file that I am using for the MEX wrapper? I'm guessing the prior because the target_include_drectories now gives the following error:
CMake Error at CMakeLists.txt:16 (target_link_libraries):
Cannot specify link libraries for target "target" which is not built by
this project.
Also, do I need to pass the same statements for mexplus which I am now passing for OpenSim (find/locate etc.)?
Again, many thanks!
Regards,
Lars Boers
- Lars Boers
- Posts: 14
- Joined: Thu Sep 06, 2018 2:23 am
Re: Access EOM/ ODE to perform FWD outside Opensim
Hi Dimitar,
Another question (since I am a C++ rookie), where do I place the object registration code for the CoordinateActuator? In the .h/.cpp file or in the CMake file?
Regards,
Lars Boers
Another question (since I am a C++ rookie), where do I place the object registration code for the CoordinateActuator? In the .h/.cpp file or in the CMake file?
Regards,
Lars Boers