In MATLAB, osimModel.realizeAcceleration with no effect (OpenSim 4.0)

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Jack Zhao
Posts: 94
Joined: Thu Jul 24, 2014 7:15 am

Re: In MATLAB, osimModel.realizeAcceleration with no effect (OpenSim 4.0)

Post by Jack Zhao » Fri Feb 09, 2018 2:18 am

chrisdembia wrote:I just wasn't sure how much you edited your model, etc. Can you try using a states file that already comes with OpenSim?
Dear Christopher:
I just now tried a sto file inherently comes with the sample model from a database in SimTK. However, the "nan" error is the same. If I use getY(), the MATLAB output is:

ans =

~[nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan nan 0.603414 -0.43729 -0.0422073 -0.0462229 -0.494808 -0.026408 -0.764801 0.799066 -1.07962 3.05327 -0.821262 -0.829631 -1.02234 0.753126 0.830352 -1.3234 -10.1698 1.43657 -0.457106 0.310528 0.19911 -0.0384213 0.624586 -0.451564 2.14733 0.115194 -2.32635 0 0 -0.262659 1.61937 0 0 0 0 0 0 0.05 0.051946 0.05 0.096066 0.05 0.0805671 0.05 0.0716978 0.05 0.0638928 0.05 0.0452284 0.05 0.0848419 0.05 0.252265 0.05 0.128603 0.05 0.182227 0.05 0.477578 0.05 0.0879367 0.05 0.111796 0.05 0.0602146 0.05 0.088819 0.05 0.124466 0.05 0.0940827 0.05 0.0571106 0.05 0.343923 0.05 0.106136 0.05 0.117703 0.05 0.132714 0.05 0.0855182 0.05 0.0790304 0.05 0.0517466 0.05 0.0296238 0.05 0.0310662 0.05 0.0908179 0.05 0.0600455 0.05 0.0595027 0.05 0.0558672 0.05 0.0657648 0.05 0.0705514 0.05 0.0506272 0.05 0.0367676 0.05 0.033452 0.05 0.041985 0.05 0.087119 0.05 0.0541573 0.05 0.0540775 0.05 0.0875746 0.05 0.104585 0.05 0.113609 0.05 0.0477341 0.05 0.0829823 0.05 0.0635078 0.05 0.0730255 0.05 0.0616296 0.05 0.038564 0.05 0.029872 0.05 0.179942 0.05 0.0666015 0.05 0.155969 0.05 0.496769 0.05 0.110901 0.05 0.119398 0.05 0.0563596 0.05 0.0763316 0.05 0.0983471 0.05 0.126356 0.05 0.0724645 0.05 0.310056 0.05 0.0807489 0.05 0.0879139 0.05 0.0945016 0.05 0.108548 0.05 0.102008 0.05 0.0436153 0.05 0.0247052 0.05 0.0215981 0.05 0.156241 0.05 0.0977912 0.05 0.106256 0.05 0.094285 0.05 0.0367199 0.05 0.039164 0.05 0.0400447 0.05 0.0333583 0.05 0.0298938 0.05 0.0371946 0.05 0.0990592 0.05 0.0525291 0.05 0.0510564 0.05 0.094727 0.05 0.11595 0.05 0.125326 0.05 0.115936 0.05 0.120991 0.05 0.0940012 0.05 0.110362 0.05 0.13473 0.05 0.142117]


You can see the former 37 values are nan, while the rest ones are normal in the model.
Why is this happening?

Regards
Jack

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: In MATLAB, osimModel.realizeAcceleration with no effect (OpenSim 4.0)

Post by Christopher Dembia » Fri Feb 09, 2018 11:07 am

Which commit of opensim-core are you using?

User avatar
Jack Zhao
Posts: 94
Joined: Thu Jul 24, 2014 7:15 am

Re: In MATLAB, osimModel.realizeAcceleration with no effect (OpenSim 4.0)

Post by Jack Zhao » Fri Feb 09, 2018 10:46 pm

chrisdembia wrote:I just wasn't sure how much you edited your model, etc. Can you try using a states file that already comes with OpenSim?
Hi Christopher:
Yes, it is with the model. However, even after I use setQ to set manually the Qs (then the Qs are normal. too) , realizeAcceleration still generates nan accelerations values.

Regards

User avatar
Christopher Dembia
Posts: 506
Joined: Fri Oct 12, 2012 4:09 pm

Re: In MATLAB, osimModel.realizeAcceleration with no effect (OpenSim 4.0)

Post by Christopher Dembia » Mon Feb 12, 2018 6:04 pm

Using subject01_simbody.osim and ResultsCMC/subject01_walk1_states.sto from the Gait2392_Simbody/OutputReference folder, I do not see any NaNs for Q when using StatesTrajectory.createFromStatesStorage().

User avatar
Jack Zhao
Posts: 94
Joined: Thu Jul 24, 2014 7:15 am

Re: In MATLAB, osimModel.realizeAcceleration with no effect (OpenSim 4.0)

Post by Jack Zhao » Tue Feb 13, 2018 12:43 am

chrisdembia wrote:Using subject01_simbody.osim and ResultsCMC/subject01_walk1_states.sto from the Gait2392_Simbody/OutputReference folder, I do not see any NaNs for Q when using StatesTrajectory.createFromStatesStorage().
Dear Christopher:
Thanks so much for the tracking! I am not sure the reason why here my two files (osim and sto) cannot match and produce normal Qs. Afterwards, I tried to use StatesReport in OpenSim 3.3 version to generate the .sto file, and also use the storage API class in the same version 3.3, the Qs get normal. Therefore, I'm somewhat confusing about the problem maybe caused by 4.0 API createFromStatesStorage. Of course, the sto file, when tried with the createFromStatesStorage API, was also generated from the StatesReport Tool panel in OpenSim 3.3 GUI.

Best regards
Jack

POST REPLY