Custom Static Optimization: Inverse Dynamics correct?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Nicole Strah
Posts: 9
Joined: Mon Aug 29, 2016 2:40 pm

Custom Static Optimization: Inverse Dynamics correct?

Post by Nicole Strah » Thu Dec 01, 2022 10:19 pm

(I wanted to use an OpenSim 4.4 tag but I cannot create one)

Hi all,

I'm working on the Custom Static Optimization advanced example https://simtk-confluence.stanford.edu:8 ... +in+MATLAB with the provided skeleton code and data. My generalized forces for the lumbar, knee angle beta forces, arms, elbows, pronation/supination, MTPs, and wrists are plotting properly, but the genForces for the pelvis, hips, knee angle moments, ankles, and subtalars are not (my plotted graphs are attached). This is my attempt at importing the provided files and the Part 1 Inverse Dynamics API commands; does anything about the Inverse Dynamics look glaringly wrong to you?

Code: Select all

modelFile = 'subject_walk_adjusted.osim';
coordinatesFile = 'coordinates.mot';

Code: Select all

     idtool.setModel(model);
     idtool.setModelFileName(modelFile);
     idtool.setCoordinatesFileName(coordinatesFile);
     idtool.setStartTime(0);
     idtool.setEndTime(2.37);
     idtool.setOutputGenForceFileName(genForcesFile);
 
Attachments
Custom SO 2.png
Custom SO 2.png (265.09 KiB) Viewed 419 times

Tags:

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: Custom Static Optimization: Inverse Dynamics correct?

Post by Thomas Uchida » Fri Dec 02, 2022 2:51 am

Are you applying ground reaction forces (idtool.setExternalLoadsFileName(...))? Also, the line idtool.setModel() seems to be unnecessary if you're also calling idtool.setModelFileName().

User avatar
Nicole Strah
Posts: 9
Joined: Mon Aug 29, 2016 2:40 pm

Re: Custom Static Optimization: Inverse Dynamics correct?

Post by Nicole Strah » Tue Dec 06, 2022 8:41 pm

Thank you so much, I had completely forgotten the external forces!! I also cut out setModel but I still have the same graphing issues. I'll keep picking it apart and let you know if I formulate any other questions.

User avatar
Nicole Strah
Posts: 9
Joined: Mon Aug 29, 2016 2:40 pm

Re: Custom Static Optimization: Inverse Dynamics correct?

Post by Nicole Strah » Wed Feb 08, 2023 6:00 pm

Dr. Uchida,

Thank you so much for your help!! Once I remembered to erase my previously generated files, it calculated perfectly!

Thank you again,
Nicole

POST REPLY