Page 1 of 1

How to get contact parameters of huntcrossley force

Posted: Tue Oct 13, 2020 11:58 pm
by amini_opensim
Hi guys
I was wondering if how contact parameters of huntcrossley force get in MATLAB. I used this code, but it's wrong:

HuntCrossleyForce.getStiffness('Foot_r_R')

Foot_r_R: refers to rear contact of right leg

I am looking forward your replay...

Re: How to get contact parameters of huntcrossley force

Posted: Wed Oct 14, 2020 2:31 am
by nicos1993
Hello Samaneh,

In the OpenSim 3.3 Matlab API I did something like this in the past (perhaps it is now easier in 4.x):

osimModel = Model('gait10dof18musc.osim');
forceSet = osimModel.getForceSet();
r1hc = HuntCrossleyForce.safeDownCast(forceSet.get('Foot_Ground_R1'));
stiffness = r1hc.getStiffness();

Have you also tried querying the available methods and input arguments for HuntCrossleyForce in Matlab, something like:

methodsview('HuntCrossleyForce')

This should bring up a table with the available methods and help with your problem!

Hope that helps!

Nicos

Re: How to get contact parameters of huntcrossley force

Posted: Wed Oct 14, 2020 4:32 am
by amini_opensim
Dear Nicos Haralabidis

it's done successfully. Thanks for guiding me.
From your opinion, if I want to set the desired stiffness, what would I do?

Re: How to get contact parameters of huntcrossley force

Posted: Wed Oct 14, 2020 5:56 am
by amini_opensim
Hi Nicos

thanks again. I could set the desired stiffness with your code:

Foot_r_R = HGait.getForceSet().get('foot_r_R');
r1hc = HuntCrossleyForce.safeDownCast(Foot_r_R);
stiffness = r1hc.getStiffness()
r1hc.setStiffness(2)

thanks so much :D