Using the InverseDynamicsSolver function for an OpenSim model with muscles on MATLAB

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Filippo Maceratesi
Posts: 1
Joined: Fri Mar 25, 2022 2:07 am

Using the InverseDynamicsSolver function for an OpenSim model with muscles on MATLAB

Post by Filippo Maceratesi » Tue Jul 19, 2022 3:48 am

Dear OpenSim experts,

I am currently using GPOPS on MATLAB to solve an optimization problem to predict a squatting motion. I am using a simple double pendulum model with five muscles on OpenSim 3.3 to represent the lower limbs. The only reason why I include the muscles in the OpenSim model is to measure the musculotendon lengths and moment arms during motion. Then, I enter these measurements in the MATLAB code to compute the contraction dynamics of the muscles.

The program on MATLAB calls a Cpp mex function, that uses the OpenSim InverseDynamicsSolver class to run an inverse dynamics analysis of the double pendulum. The mex function works perfectly when the model doesn't include muscles. However, when I include muscles in the model, the mex file does not work and, MATLAB crashes. Please find attached the Cpp code I am referring to.

So far, I have solved the issue by using the OpenSim model without muscles to run the ID analysis and the one with muscles for everything else. However, I was wondering if there was a way to use this Cpp mex function with the model with muscles as well. Maybe, is this functionality available in later versions of OpenSim?

Thank you very much in advance for your help.

Kind regards,
Filippo
Attachments
ID_Solver.cpp
(4.4 KiB) Downloaded 10 times

Tags:

User avatar
Carmichael Ong
Posts: 393
Joined: Fri Feb 24, 2012 11:50 am

Re: Using the InverseDynamicsSolver function for an OpenSim model with muscles on MATLAB

Post by Carmichael Ong » Wed Jul 20, 2022 12:31 pm

If muscles are indeed an issue, I'm wondering if you can work around the issue by using `setAppliesForce()` to turn off the force from the muscles. https://simtk.org/api_docs/opensim/api_ ... 2b06b990ee

POST REPLY