MATLAB Forward Dynamics Tool Setup File Input
Posted: Sun May 27, 2018 10:43 pm
Hello all,
I'm not quite sure how to input a forward dynamics setup file or EMG input file to a forward dynamics object in MATLAB. Using the excellent MoBL-ARMS project <https://simtk.org/projects/upexdyn>, as described in their documentation I've used the model MoBL_ARMS_module2_4_allmuscles.osim, forward dynamics setup file MoBL_ARMS_module4_Setup_wrist.xml, and EMG input controls_EMG_wrist.sto to produce a file MoBL_ARMS_module2_4_allmuscles_wrist_states_degrees.mot in the OpenSim GUI. However, I can't reproduce this in MATLAB.
Here is a small MATLAB code snippet of what I've tried ; files are attached:
If I uncomment the lines 'ft.setInitialTime(0.);' and 'ft.setFinalTime(1.);', the simulation runs for hours. I've never let it 'finish' and produce files because I don't think it would finish. With these lines commented out, if I run the above program it produces a _states_degrees.mot file which I know isn't correct because if I load it in the OpenSim GUI with the model, the movement is unnatural and certainly not like the MoBL_ARMS_module2_4_allmuscles_wrist_states_degrees.mot file produced through forward dynamics using the GUI.
Any help would be greatly appreciated! Thank you very much!
I'm not quite sure how to input a forward dynamics setup file or EMG input file to a forward dynamics object in MATLAB. Using the excellent MoBL-ARMS project <https://simtk.org/projects/upexdyn>, as described in their documentation I've used the model MoBL_ARMS_module2_4_allmuscles.osim, forward dynamics setup file MoBL_ARMS_module4_Setup_wrist.xml, and EMG input controls_EMG_wrist.sto to produce a file MoBL_ARMS_module2_4_allmuscles_wrist_states_degrees.mot in the OpenSim GUI. However, I can't reproduce this in MATLAB.
Here is a small MATLAB code snippet of what I've tried ; files are attached:
Code: Select all
import org.opensim.modeling.*
% model
model = Model('MoBL_ARMS_module2_4_allmuscles.osim');
% forward dynamics
genericSetupForFD = 'MoBL_ARMS_module4_Setup_wrist.xml';
ft = ForwardTool(genericSetupForFD);
ft.setModel(model);
%ft.setInitialTime(0.);
%ft.setFinalTime(1.);
ft.run();
Any help would be greatly appreciated! Thank you very much!