Page 1 of 1

Custom Static Optimization: Inverse Dynamics correct?

Posted: Thu Dec 01, 2022 10:19 pm
by nicolestrah
(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);
 

Re: Custom Static Optimization: Inverse Dynamics correct?

Posted: Fri Dec 02, 2022 2:51 am
by tkuchida
Are you applying ground reaction forces (idtool.setExternalLoadsFileName(...))? Also, the line idtool.setModel() seems to be unnecessary if you're also calling idtool.setModelFileName().

Re: Custom Static Optimization: Inverse Dynamics correct?

Posted: Tue Dec 06, 2022 8:41 pm
by nicolestrah
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.

Re: Custom Static Optimization: Inverse Dynamics correct?

Posted: Wed Feb 08, 2023 6:00 pm
by nicolestrah
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