Page 1 of 1

AnalyzeTool Error

Posted: Fri Oct 25, 2019 3:13 am
by alik
Dear Opensim Experts,
I am trying to run analyzetool using Matlab. In some cases, I am encountering the following error which I could not figure out its reason.
According to the message, states.sto file is not matching with the model states but I did not make any changes on the state files.
It would be great if you could explain the reason for this error.

Code: Select all

Java exception occurred:
java.io.IOException: AnalyzeTool.verifyControlsStates: ERROR- Number of states in
D:/Ali.K.M.Bonab/LoadedWalking_ExoSimulations/subject07/loaded1/loadedwalking_subject07_adjusted_loaded_cycle1_states.sto
doesn't match number of states in model loadedwalking_subject07_adjusted_loaded.

	at org.opensim.modeling.opensimActuatorsAnalysesToolsJNI.AnalyzeTool_run__SWIG_0(Native Method)

	at org.opensim.modeling.AnalyzeTool.run(AnalyzeTool.java:154)

Re: AnalyzeTool Error

Posted: Tue Nov 05, 2019 3:04 pm
by justinemmerich
I had the same problem.

try this:

analyzeTool = AnalyzeTool();
model = Model(OsimModelFilePath)
model.initSystem();
motion = Storage(MotorStoFilePath)
state = model.initSystem()
analyzeTool.setStatesFromMotion(state, motion, true)

Re: AnalyzeTool Error

Posted: Sat Nov 09, 2019 5:58 pm
by jimmy
The AnalysisTool builds a set of states, internally, when the tool is constructed from file. If you make a default tool, then set all the properties, the internal state won't have been constructed. This is more of an OpenSim tool side bug since, at run(), the tool should build the states from the properties it has. The quick-and-dirty workaround is to build your AnalysisTool in Matlab, write to file, then read it back in again (at = AnalysisTool('myAnalysisTool.xml') ), this will construct the internal states.