Page 1 of 2
Access EOM/ ODE to perform FWD outside Opensim
Posted: Wed Jan 23, 2019 11:52 am
by lsboers
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
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Sat Jan 26, 2019 8:53 am
by mitkof6
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=
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Tue Feb 19, 2019 9:13 pm
by lsboers
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
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Wed Feb 20, 2019 1:39 am
by mitkof6
Make sure to include
Code: Select all
include <OpenSim/Actuators/CoordinateActuator.h>
The actual name of the object is
CoordinateActuator
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Sat Feb 23, 2019 3:51 pm
by lsboers
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
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Sat Feb 23, 2019 4:30 pm
by lsboers
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
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Sat Feb 23, 2019 8:14 pm
by lsboers
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!
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Sun Feb 24, 2019 10:35 am
by mitkof6
For some reason CoordinateActuator is not register. Try this:
Code: Select all
Object::registerType( CoordinateActuator());
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
include_directories(${OpenSim_INCLUDE_DIRS})
link_directories(${OpenSim_LIB_DIR})
target_link_libraries(target ${OpenSim_LIBRARIES})
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Sun Feb 24, 2019 11:29 am
by lsboers
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
Re: Access EOM/ ODE to perform FWD outside Opensim
Posted: Sun Feb 24, 2019 11:45 am
by lsboers
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