I have a generic .xml external load file that I wish to use on several different iterations of CMC. For each iteration, I want to start a new CMCTool(setup), included in the setup file is the .xml external load file. I then want to pick a specific externalForce.mot file for the given trial. I have the following code but it is not working. Any tips?
model = Model([path 'scaled_upper_arm_CMC.osim']);
state = model.initSystem();
cmc = CMCTool(setup);
% Set-up trial specific output
exLoads = cmc.getExternalLoads.setDataFileName(motFile);
cmc.updExternalLoads();
% run CMC tool
cmc.run()
Set .mot file of External load applied during CMC
- Tom Augenstein
- Posts: 38
- Joined: Thu May 03, 2018 8:19 am
Set .mot file of External load applied during CMC
Last edited by Tom Augenstein on Wed Aug 29, 2018 3:09 pm, edited 1 time in total.
Tags:
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: Set .mot file of External load applied during CMC
This line does nothing:
Methods with the "upd" prefix just return a writable reference, so all you're doing here is fetching the reference and throwing it away. Perhaps try the following:
You can print the CMCTool before running and open the file in a text editor to ensure your script has made the expected change.
Code: Select all
cmc.updExternalLoads();
Code: Select all
% Replace these lines...
exLoads = cmc.getExternalLoads.setDataFileName(motFile);
cmc.updExternalLoads();
% ...with this line
cmc.setExternalLoadsFileName(motFile);