Append actuators to CMC Tool in MATLAB

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

Append actuators to CMC Tool in MATLAB

Post by Tom Augenstein » Mon Jun 25, 2018 5:22 pm

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.
Attachments
reaching_trial.zip
(91.15 KiB) Downloaded 22 times

Tags:

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

Re: Append actuators to CMC Tool in MATLAB

Post by Thomas Uchida » Mon Jun 25, 2018 5:30 pm

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).

User avatar
Tom Augenstein
Posts: 38
Joined: Thu May 03, 2018 8:19 am

Re: Append actuators to CMC Tool in MATLAB

Post by Tom Augenstein » Tue Jun 26, 2018 8:07 am

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.

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

Re: Append actuators to CMC Tool in MATLAB

Post by Thomas Uchida » Tue Jun 26, 2018 11:56 am

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

User avatar
Tom Augenstein
Posts: 38
Joined: Thu May 03, 2018 8:19 am

Re: Append actuators to CMC Tool in MATLAB

Post by Tom Augenstein » Wed Jun 27, 2018 8:22 am

Ok, that makes sense. Thanks for the help

POST REPLY