Setting Joint Reaction Properties via Matlab

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Ryan Byrne
Posts: 28
Joined: Thu Jan 22, 2015 8:33 am

Setting Joint Reaction Properties via Matlab

Post by Ryan Byrne » Fri Mar 02, 2018 2:27 pm

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

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

Re: Setting Joint Reaction Properties via Matlab

Post by Thomas Uchida » Sat Mar 03, 2018 12:53 am

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

User avatar
Ryan Byrne
Posts: 28
Joined: Thu Jan 22, 2015 8:33 am

Re: Setting Joint Reaction Properties via Matlab

Post by Ryan Byrne » Wed Mar 07, 2018 5:07 pm

Thanks Tom. That is exactly what I was looking for. Still getting used to the language!

POST REPLY