Page 1 of 1

Setting Joint Reaction Properties via Matlab

Posted: Fri Mar 02, 2018 2:27 pm
by pittpanther13
Hi everyone,

Does anyone know how to define the body for which the joint reaction loads are calculated via Matlab (child or parent)? I am trying to use the PropertyHelper but cannot see to access or define what I think is a String Array (apply_on_bodies). When I treat the value as a string value and try to set it to 'parent' (as shown in the code), Matlab crashes. I tried using PropertyHelper.setValueStringArray(x2,['parent']) but was unsuccessful as well.

Code: Select all

jr= JointReaction();

jr.setOn(true);
jr.setStepInterval(1)
jr.setInDegrees(true)

jr.setStartTime(initial_time);
jr.setEndTime(final_time);
analyzeTool.getAnalysisSet().adoptAndAppend(jr)

x1=analyzeTool.getAnalysisSet().get(0).getPropertyByIndex(5);
PropertyHelper.setValueString('C:\OpenSim 3.3\StaticOptimization\subject07_StaticOptimization_force.sto',x1);
x2 = analyzeTool.getAnalysisSet().get(0).getPropertyByIndex(7);
PropertyHelper.setValueString('parent',x2);

Re: Setting Joint Reaction Properties via Matlab

Posted: Sat Mar 03, 2018 12:53 am
by tkuchida
Are you looking for setOnBody() (https://simtk.org/api_docs/opensim/api_ ... 0a5eb87cec)?

Code: Select all

import org.opensim.modeling.*
jr = JointReaction();
onbody = ArrayStr(['parent']);
jr.setOnBody(onbody);
...

Re: Setting Joint Reaction Properties via Matlab

Posted: Wed Mar 07, 2018 5:07 pm
by pittpanther13
Thanks Tom. That is exactly what I was looking for. Still getting used to the language!