Hello,
I was trying to run Static optimization in API. I also used same settings and files to run Static optimization in OpenSim 4.2 GUI. Although all the time points are not solved yet, I was expecting that the results would be same as both of them are the most up-to-date versions.
GUI results:
API results:
All the files can be found in this link: https://drive.google.com/file/d/1Ls5c23 ... sp=sharing
Can anybody help me to find out the reasons behind these differences?
Different SO results from OpenSim 4.2 GUI and API
- Rahid Zaman
- Posts: 31
- Joined: Fri Apr 21, 2017 3:43 am
- Ayman Habib
- Posts: 2255
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Different SO results from OpenSim 4.2 GUI and API
Hi Rahid,
Both the GUI and API execute the same code so should lead to same results. The likely culprits are:
- External files (e.g. Actuators, reserves, external forces) that were resolved differently which could happen due to differences in working directory where you're running from. Check log messages/window for clues or to compare the two workflows.
- Differences in how the model is initialized. The GUI uses the current model/state from the live application while the API may use either a live model or a model loaded from a file (the model file gets ignored by the GUI since it operates on the current model).
Hope this helps,
-Ayman
Both the GUI and API execute the same code so should lead to same results. The likely culprits are:
- External files (e.g. Actuators, reserves, external forces) that were resolved differently which could happen due to differences in working directory where you're running from. Check log messages/window for clues or to compare the two workflows.
- Differences in how the model is initialized. The GUI uses the current model/state from the live application while the API may use either a live model or a model loaded from a file (the model file gets ignored by the GUI since it operates on the current model).
Hope this helps,
-Ayman
- Rahid Zaman
- Posts: 31
- Joined: Fri Apr 21, 2017 3:43 am
Re: Different SO results from OpenSim 4.2 GUI and API
Thank you, Dr. Ayman. The problem is solved. There were some dissimilarities between the static optimization setting files.
Another things is, in the GUI version, there is a "Message" window, where I can see at which time points the static optimization fails to solve. How can I do that in Matlab for OpenSim API? Any suggestions how I can know whether the static optimization is failing or not?
Thanks,
Rahid
Another things is, in the GUI version, there is a "Message" window, where I can see at which time points the static optimization fails to solve. How can I do that in Matlab for OpenSim API? Any suggestions how I can know whether the static optimization is failing or not?
Thanks,
Rahid
- Mike Spahr
- Posts: 14
- Joined: Mon May 04, 2020 7:59 am
Re: Different SO results from OpenSim 4.2 GUI and API
Hello Rahid,
thanks for sharing your code it solved a similar problem with my Static Optimization code.
In my Matlab API it generates a opensim.log file in the folder, from which I run the first OpenSim matlab script. This log file is then used, even if you execute another matlab OpenSim script located elsewhere. (All logs are added at the end of the opensim.log file) Only when you restart your Matlab session, a new opensim.log can be generated if you choose another folder.
I hope this helps.
Best,
Mike
thanks for sharing your code it solved a similar problem with my Static Optimization code.
In my Matlab API it generates a opensim.log file in the folder, from which I run the first OpenSim matlab script. This log file is then used, even if you execute another matlab OpenSim script located elsewhere. (All logs are added at the end of the opensim.log file) Only when you restart your Matlab session, a new opensim.log can be generated if you choose another folder.
I hope this helps.
Best,
Mike