Setting <forces_file> for batch processing of Joint contact analysis

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Jasper Kwasny
Posts: 1
Joined: Fri Mar 08, 2019 5:18 am

Setting <forces_file> for batch processing of Joint contact analysis

Post by Jasper Kwasny » Fri Jan 31, 2020 3:50 am

Hello,

I am having issues editing the Analyzer tool with Matlab to run batch processing of Joint Contact analysis. I am not able to edit the <forces_file> name under the Analysis Set section of the tool. My script works by reading in generic XML setup files and rewriting information from my model and then running the full tool.
I have been able to edit all parameters that I need for each subject, apart from the <forces_file> tag, including tags that fall over or under the Analysis Set section of the tool, and have not had problems with scaling, IK, ID, or SO tools.
For example, I was able to read in the Generic XML file, set the model name to my scaled model (and other tags), and set the initial and final time for the Analysis Set with the following.

Code: Select all

jcTool = AnalyzeTool([InitialPath 'Generic_JCSETUP.xml'])

        jcTool.setModelFilename([subjectDir 'ScaleResults\' subjectNo '_scaled_weighted_matlab.osim']);
	.
	.
	.
	jcTool.getAnalysisSet().get(0).setStartTime(initial_time)
        jcTool.getAnalysisSet().get(0).setEndTime(final_time)
Yet similar structure to change the <forces_file> name to that of the Forces generated from Static Optimization do not run, and I am met with an error message. I am a novice to writing XML files in Matlab and therefore I have tried a few different structures for the command just by trial and error, including the structure used for setting tags above and below the Analysis Set section of the file:

Code: Select all

jcTool.getAnalysisSet().get(0).setForcesFileName([OS_output.results_so '\' SO_forces])

and

Code: Select all

 jcTool.getAnalysisSet().getForcesFileName(0).setForcesFileName([OS_output.results_so '\' 
               SO_forces])
and

Code: Select all

 jcTool.setForcesFileName([OS_output.results_so '\' SO_forces])
No matter which I run, I am met with the error message:

Code: Select all

Unrecognized function or variable 'setForcesFileName'.
According to the OpenSim Joint Reaction Class Reference for OpenSim 4.0, both

Code: Select all

'setForcesFileName'
and

Code: Select all

'getForcesFileName'
are recognized functions. I have not encountered this issue while editing any other parameters. I assume there is an error in the technique I am trying to use to write to the <forces_file> tag, but as I mentioned, I am a novice to writing XML files in Matlab and I do not know what the proper technique may be.

Any help is greatly appreciated.

Thanks

Tags:

User avatar
Thomas Uchida
Posts: 1793
Joined: Wed May 16, 2012 11:40 am

Re: Setting <forces_file> for batch processing of Joint contact analysis

Post by Thomas Uchida » Fri Jan 31, 2020 8:23 am

"Unrecognized function or variable" means that the method cannot be found. The command "getAnalysisSet().get(0)" returns a generic Analysis; you need to tell Matlab that it's a JointReaction by "downcasting". Please search this page for "downcast": https://simtk-confluence.stanford.edu/d ... g+Commands.

POST REPLY