Page 1 of 1

Append actuators to CMC Tool in MATLAB

Posted: Mon Jun 25, 2018 5:22 pm
by tomaugenstein
What is the command to append actuators to the CMC tool in the MATLAB API?

Also, how do you directly load a CMC setup file into the MATLAB API? I have the following code but CMC either does not load the file info or MATLAB completely crashes at the line "cmc = CMCTool(setup)"

import org.opensim.modeling.*
model = Model('C:\Users\NeuRRo Lab\Desktop\armModel\CMC_Matlab\MoBL_ARMS_module6_7_CMC_TOMEDITS.osim');
setup = 'C:\Users\NeuRRo Lab\Desktop\armModel\CMC_Matlab\CMC_setup_reaching';
cmc = CMCTool(setup);
cmc.setModel(model);
state = model.initSystem();

I attached the files I'm using as well if anybody wants to give it a try. The set-up file was built (and tested) and saved in the GUI.

Re: Append actuators to CMC Tool in MATLAB

Posted: Mon Jun 25, 2018 5:30 pm
by tkuchida
setup = 'C:\Users\NeuRRo Lab\Desktop\armModel\CMC_Matlab\CMC_setup_reaching';
Looks like you're missing the ".xml" extension. There are example scripts on the "Scripting with Matlab" page in the Confluence documentation (https://simtk-confluence.stanford.edu/d ... ith+Matlab).

Re: Append actuators to CMC Tool in MATLAB

Posted: Tue Jun 26, 2018 8:07 am
by tomaugenstein
Sorry, the missing ".xml" happened when I copied in a different file while posting the question, the ".xml" appears in my MATLAB script and the same fatal error still occurs.

I looked at the "Scripting with MATLAB" page, but as far as I can tell I reference the set-up file the same way in the same way that the example scripts do.

Re: Append actuators to CMC Tool in MATLAB

Posted: Tue Jun 26, 2018 11:56 am
by tkuchida
There is no model specified in your CMC setup file, yet the second argument to the CMCTool's constructor is "true" (default). The Tool is attempting to load a model whose filename is null. You should either provide "false" as the second argument to the constructor (line 4 of your script), or edit line 5 of your setup file. https://simtk.org/api_docs/opensim/api_ ... c57dffee23

Re: Append actuators to CMC Tool in MATLAB

Posted: Wed Jun 27, 2018 8:22 am
by tomaugenstein
Ok, that makes sense. Thanks for the help