Set .mot file of External load applied during CMC

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Tom Augenstein
Posts: 38
Joined: Thu May 03, 2018 8:19 am

Set .mot file of External load applied during CMC

Post by Tom Augenstein » Thu Aug 16, 2018 6:07 pm

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()
Last edited by Tom Augenstein on Wed Aug 29, 2018 3:09 pm, edited 1 time in total.

Tags:

User avatar
Thomas Uchida
Posts: 1790
Joined: Wed May 16, 2012 11:40 am

Re: Set .mot file of External load applied during CMC

Post by Thomas Uchida » Fri Aug 17, 2018 12:20 pm

This line does nothing:

Code: Select all

cmc.updExternalLoads();
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:

Code: Select all

% Replace these lines...
exLoads = cmc.getExternalLoads.setDataFileName(motFile);
cmc.updExternalLoads();
% ...with this line
cmc.setExternalLoadsFileName(motFile);
You can print the CMCTool before running and open the file in a text editor to ensure your script has made the expected change.

POST REPLY