Hi,
I'm trying to execute the Forward Dynamics Tool in Matlab, but the results obtained are wrong. I use the MoBL-ARMS model and I give a .xml file in input at FD Tool. This file contains a constant activation of Brachioradialis muscle(the other muscles of the model have a null activation).
I implement this section of script:
file = [path '\BRD.xml']; % excitation file of Brachioradialis
file = [file{:}];
FDinamicsTool = ForwardTool(file, true, false);
FDinamicsTool.setModel(myModel);
FDinamicsTool.setResultsDir(muscleDir);
FDinamicsTool.setStartTime(time(1));
FDinamicsTool.setFinalTime(time(end));
FDinamicsTool.run();
In the output directory, I obtain: 2 .sto file and 1 .mot file. All files are wrong, because Brachioradialis muscle isn't activated, and it should be instead.
If I execute this tool in OpenSim with the same file the results are correct.
How could I implement Forward Dynamics Tool in Matlab?
Thanks in advance.
Maria Cristina Panettieri
Forward Dynamics in Matlab
- Maria Cristina Panettieri
- Posts: 8
- Joined: Sat Nov 09, 2019 1:42 am
- Carmichael Ong
- Posts: 401
- Joined: Fri Feb 24, 2012 11:50 am
Re: Forward Dynamics in Matlab
Thanks for a nice concise code snippet. Looks close to me. A couple of possible issues below:
1.
The ForwardTool() constructor in this line is expecting a setup file (like the one you would get if you save out a setup file from the GUI) instead of the controls file. You could either pass in a setup file, or use a constructor that doesn't take in a file.
2. You can look at the ForwardTool documentation (https://simtk.org/api_docs/opensim/api_ ... dTool.html) which may be helpful for setting the controls file. If you click under functions that it inherits from parent classes, one function that might work is setControlsFileName() (https://simtk.org/api_docs/opensim/api_ ... a70711d8ce)
1.
Code: Select all
FDinamicsTool = ForwardTool(file, true, false);
2. You can look at the ForwardTool documentation (https://simtk.org/api_docs/opensim/api_ ... dTool.html) which may be helpful for setting the controls file. If you click under functions that it inherits from parent classes, one function that might work is setControlsFileName() (https://simtk.org/api_docs/opensim/api_ ... a70711d8ce)
- Maria Cristina Panettieri
- Posts: 8
- Joined: Sat Nov 09, 2019 1:42 am
Re: Forward Dynamics in Matlab
Using setup file created in Matlab, the FD Tool works correctly.
Thank you very much!
Maria Cristina Panettieri
Thank you very much!
Maria Cristina Panettieri