Page 1 of 1

RRA tool Matlab Help

Posted: Fri Feb 10, 2017 10:27 am
by ync8yy
I am trying to do part C of the example problem of this link [url]http://simtk-confluence.stanford.edu:80 ... +in+Stance[/url which is to run the RRA tool on Matlab. However, I am having trouble setting up the code to run this problem. The code below is what I have for now, any help or suggestions will be appreciated. Thank you.

Code: Select all

import org.opensim.modeling.*

[genericSetupForIK,genericSetupPath,FilterIndex] = uigetdir('*.xml', 'C:\Users\Yong Cho\Documents\MATLAB\OpenSim 3.3\Models\Leg6Dof9Musc\Stance\leg69_Tracking_Tasks.xml')

[modelFile,modelFilePath,FilterIndex] = uigetdir('*.osim', 'C:\Users\Yong Cho\Documents\MATLAB\OpenSim 3.3\Models\Leg6Dof9Musc\leg6dof9musc.osim')

RRATool = RRATool([genericSetupPath genericSetupForIK]);
% Load model and initialize

model = Model([modelFilePath modelFile]);
model.initSystem();

% Tell RRA tool to use the loaded model

RRATool.setModel(model);

%Sets kinematics

RRATool.setDesiredKinematicsFileName('C:\Users\Yong Cho\Documents\MATLAB\OpenSim 3.3\Models\Leg6Dof9Musc\Stance\leg69_IK_stance.mot')
RRATool.setTaskSetFileName('C:\Users\Yong Cho\Documents\MATLAB\OpenSim 3.3\Models\Leg6Dof9Musc\Stance\leg69_Tracking_Tasks.xml')


Re: RRA tool Matlab Help

Posted: Fri Feb 10, 2017 12:59 pm
by tkuchida
First, you can add the line to run RRA:

Code: Select all

RRATool.run();
You will also need to adjust the mass of the pelvis. You may need to read the new mass from the out.log file generated by RRA. Setting a new pelvis mass looks something like the following:

Code: Select all

pelvis = model.updBodySet().get('pelvis');
pelvis.setMass(newMass);
The doxygen (https://simtk.org/api_docs/opensim/api_ ... ATool.html) and "Scripting with Matlab" documentation (http://simtk-confluence.stanford.edu:80 ... ith+Matlab) might be useful.

Also, you might consider first running through the example using the GUI to get a better idea of what steps you will need to perform in scripting.