Page 1 of 1

Inverse Dynamics Does not Output Results

Posted: Thu Aug 31, 2017 7:14 am
by godfreap
Whenever I use the inverse dynamics tool - either from Matlab or OpenSim - I never have any results saved to the output directory. Everything in the IDSetup file and the tool seems correct, so I'm not sure what is going on.

The Folder structure of the data is
\dataset\ -- where the osim & setup files are
\dataset\ID\ -- where ID results are supposed to go
\dataset\IK\ -- where IK results are supposed to go (IK works correctly)

My IDSetup file looks like this (edited for brevity):

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<OpenSimDocument Version="30000">
	<InverseDynamicsTool name="dataSet">
		<results_directory>\dataset\ID</results_directory>
		<input_directory>./</input_directory>
		<model_file>Unassigned</model_file>
		<time_range> 0 14.51</time_range>
		<forces_to_exclude> Muscles</forces_to_exclude>
		<external_loads_file>dataset\dataSet_ExtForSetup.xml</external_loads_file>
		<coordinates_file>dataset\IK\data_IKResults_filt.mot</coordinates_file>
		<lowpass_cutoff_frequency_for_coordinates>6</lowpass_cutoff_frequency_for_coordinates>
		<output_gen_force_file>dataset\ID\data_IDResults.sto</output_gen_force_file>
		<joints_to_report_body_forces />
		<output_body_forces_file>body_forces_at_joints.sto</output_body_forces_file>
	</InverseDynamicsTool>
</OpenSimDocument>

My InverseDynamicsTool is set up thusly:

Code: Select all

idSetupFiles = dir('*ExtForSetup.xml');
idExtForces = [pathName idSetupFiles.name];
idOutput = [pathName 'ID\' exrName '_IDResultsMJ.sto'];
idCoords = [pathName 'IK\' strrep(ptOutput, '.mot', '_filt.mot')];
% assign the properties to the inverse dynamics tool
idTool = InverseDynamicsTool([pathName idFile]);
idTool.setStartTime(startTime);
idTool.setEndTime(stopTime);
idTool.setExternalLoadsFileName(idExtForces);
idTool.setOutputGenForceFileName(idOutput);
idTool.setCoordinatesFileName(idCoords);
idTool.setResultsDir([pathName 'ID\'])
% save the modified ID setup file
idTool.print(idFile);
idTool.setModel(currentModel);
idTool.run()

Any help is appreciated. Not sure why this isn't working - it had been. (whether or not there's a file that exists with the output file name, this still happens...)

Re: Inverse Dynamics Does not Output Results

Posted: Thu Aug 31, 2017 8:46 am
by chrisdembia
Try this:
<results_directory>dataset/ID</results_directory>
I'm not sure it'll help, but "\dataset\ID" might look like an absolute path to the software.

Re: Inverse Dynamics Does not Output Results

Posted: Thu Aug 31, 2017 8:54 am
by godfreap
Nah, that's not it. It's a full directory listing, I just replaced the path with '\dataset\' for the sake of brevity.

Re: Inverse Dynamics Does not Output Results

Posted: Fri Sep 01, 2017 3:38 am
by godfreap
It seems to be working now. It looks like the problem might have been using a full path name is <results_directory>. Once I changed that to just 'ID\' it seems to be working. So, if anyone else has this problem, there you go.