Hi,
I agree that the applications that can be run under the OpenSim framework are very useful but would be somewhat difficult to develop in this environment from scratch. In my experience, Matlab is the best tool to play around and experiment with various algorithms (such as CMC or NMT) and once they do the job, then they could potentially be coded in c++ as opensim applications.
In particular, I'm looking at a few contact algorithms between the tibia and femur, where I need to isolate parts of the EoM. Is there any way to 'export' or use the opensim models in a matlab environment.
Let me give an example: with skeletal dynamics models (created in sdfast), the resulting model is output as a dll file which can then be used in matlab and simulink through a simple s-function which allows you to configure the inputs, operations and outputs. So if we wanted to return say the mass matrix at any given time for example, we would create an s function with generalised coords, and velocities as the input, then call a function within SDFAST to return the mass matrix, and direct the result to the s function output. This way, we can not only get internal parameters, but also use these models in Simulink which is much easier to experiment with algorithms.
Since openSim uses Simbody (and not SDFAST), i was wondering if such a feature exists for either skeletal dynamics, muscular dynamics, or both?
Cheers,
Tim
exporting models for use in matlab
- Ayman Habib
- Posts: 2252
- Joined: Fri Apr 01, 2005 12:24 pm
RE: exporting models for use in matlab
Dear Tim,
This item (wrapping an OpenSim model to be callable from Matlab) is definitely on our short list of projects that we plan to deliver later this summer. The only reason we haven't started is that we're migrating to a new architecture that's consistent with simtk that will cause our APIs to change significantly.
OpenSim models are serialized to/from an XML file (.osim) so you can create one dll for all Simbody based models that links the required libraries from OpenSim (e.g. osimSimbodyEngine.dll and its dependents) and exposes the APIs you need to interface with the model from MATLAB. On initialization you pass in the file name for the model, the model is constructed by the dll and then you can query it or change it as needed by making the calls from MATLAB.
If you would like to start this on your own you're more than welcome and I'll be happy to help you in any way I can, just be aware of the potential (significant) changes to existing OpenSim APIs.
Cheers,
-Ayman
This item (wrapping an OpenSim model to be callable from Matlab) is definitely on our short list of projects that we plan to deliver later this summer. The only reason we haven't started is that we're migrating to a new architecture that's consistent with simtk that will cause our APIs to change significantly.
OpenSim models are serialized to/from an XML file (.osim) so you can create one dll for all Simbody based models that links the required libraries from OpenSim (e.g. osimSimbodyEngine.dll and its dependents) and exposes the APIs you need to interface with the model from MATLAB. On initialization you pass in the file name for the model, the model is constructed by the dll and then you can query it or change it as needed by making the calls from MATLAB.
If you would like to start this on your own you're more than welcome and I'll be happy to help you in any way I can, just be aware of the potential (significant) changes to existing OpenSim APIs.
Cheers,
-Ayman