AnalyzeTool Error

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ali Khalilianmotamed Bonab
Posts: 47
Joined: Mon Aug 13, 2018 6:28 am

AnalyzeTool Error

Post by Ali Khalilianmotamed Bonab » Fri Oct 25, 2019 3:13 am

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)

User avatar
Justin Emmerich
Posts: 1
Joined: Fri Nov 30, 2018 2:50 pm

Re: AnalyzeTool Error

Post by Justin Emmerich » Tue Nov 05, 2019 3:04 pm

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)

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: AnalyzeTool Error

Post by jimmy d » Sat Nov 09, 2019 5:58 pm

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.

POST REPLY