Hi all,
I am attempting to run a static optimization using Matlab, but I'm having trouble trying to get the program to use the force set file. In the GUI, I would append additional force set files under the actuator tab. And the coding for this is in the xml file I use to set the settings of the analyze tool. The method in AnalyzeTool that I think I should use is "setForceSetFiles", but the class for this is "org.opensim.modelling.ArrayStr" and "SOTool.setForceSetFiles(ArrayStr([dirorig '\CMC_Actuators_rai.xml']));" doesn't work. (SOTool is the name of the AnalyzeTool).
Any help or advice would be appreciated. Without appending the force set, I can't solve the optimization.
Thank-you!
Adding Force Set for Static optimization in Matlab
- Bryan Schlink
- Posts: 2
- Joined: Fri Sep 15, 2017 8:19 am
Re: Adding Force Set for Static optimization in Matlab
You have to build the ArrayStr() before you can set its value and use it. The below code works for me in Matlab.
Code: Select all
% Construct an AnalyzeTool from an existing file
at = AnalyzeTool('so_setup.xml');
% Instantiate a String Array
as = ArrayStr();
% Set the first value of the array to the actuators file
as.set(0,'gait2354_RRA_Actuators.xml')
% Set the force set file to use the new array
at.setForceSetFiles(as)
- Bryan Schlink
- Posts: 2
- Joined: Fri Sep 15, 2017 8:19 am
Re: Adding Force Set for Static optimization in Matlab
Thank you for the help. Unfortunately I'm still having issues. I don't believe it is because of the force set anymore (I have a "Adding force object set from CMC_Actuators_rai.xml" message pop up when I initialize the model). But optimization still fails and constraint violations are really high. The data follows the same path as the data I found using the GUI, but it's very noisy. Is there a common mistake made when setting up static optimization in matlab that leads to really poor results?
I can post my entire code if that would help.
Thanks again.
I can post my entire code if that would help.
Thanks again.