Hi Thomas,
After all, it seem that this is not the last question.
As a reminder, I wanted to estimate the passive joint torques during a passive (without muscle activity) sollicitation.
Experimentally, we mobilize the ankle of a subject with an handheld dynamometer, and we measure the kinematics thanks to VICON.
Thus, I am able to animate my model (Rajagopal's model) - I mean I impose the kinematic on it - and I would like to know the joint torque during this passive movement.
To do so, I compute the musculo-tendinous forces after setting the activations of all the muscles to 0. Thus the calculated musculo-tendinous forces should be the passive forces.
Then, using the moment arms, I should be able to obtain my passive joint torque by summing the products between passive forces and moments arms.
Below, you can find my MatLab Code :
Code: Select all
% Initialisation
% Pull in the modeling classes straight from the OpenSim distribution
import org.opensim.modeling.*
model=Model;
% Main Code
%Initialize
muscle_set = model.getMuscles();
coordinate_set = model.getCoordinateSet();
PathActuator_set=model.getActuators();
% Data : Values of coordinates in radian. (pelvis_tilt, pelvis_list...)
num_timepoints = size(Data,1);
num_muscles = muscle_set.getSize();
num_coordinates=coordinate_set.getSize();
%Set the minimum_activation property of all muscles to 0.0
for i=0:num_muscles-1
MuscMill=Millard2012EquilibriumMuscle.safeDownCast(muscle_set.get(i));
MuscMill.setMinimumActivation(0.0);
end
state=model.initSystem();
%Compute muscle force at each time point in the motion by updating the
%state and muscle activation (to 0)
muscleforces=zeros(num_timepoints,size(nameIndex,2));
for t=1:num_timepoints
%Update state
for i=0:num_coordinates-1
model.updCoordinateSet().get(i).setValue(state,Data(t,i+1),false);
end
clear i
model.assemble(state)
% Set activation of all the muscles to zero
for i=0:num_muscles-1
MuscMill=Millard2012EquilibriumMuscle.safeDownCast(muscle_set.get(i));
MuscMill.setActivation(state,0);
%model.realizeVelocity(state);
Activation(t,i+1)=MuscMill.getActivation(state); %Print 0 for all the muscles
end
model.equilibrateMuscles(state)
%Compute Muscle Forces
model.realizeDynamics(state);
%DownCast + Passive Force
for i=1:size(nameIndex,2) %nameIndex : Index of the muscles acting on the ankle DoF only
MuscMill=Millard2012EquilibriumMuscle.safeDownCast(muscle_set.get(nameIndex(i)-1));
muscleforces(t,i)=MuscMill.getPassiveFiberElasticForceAlongTendon(state);
end
%DownCast + Moment Arms
for i=1:size(nameIndex,2) %nameIndex : Index of the muscles acting on the ankle DoF only
MuscMill=Millard2012EquilibriumMuscle.safeDownCast(PathActuator_set.get(nameIndex(i)-1));
momentarm(t,i)=MuscMill.computeMomentArm(state,coordinate_set.get('ankle_angle_r'));
end
end
%Compute Passive Moment
Moment=muscleforces.*momentarm;
for i=1:size(Moment,1)
TotalMoment(i,1)=sum(Moment(i,:));
end
It works and I am able to obtain the passive moment around the ankle during the mobilization (cf. Attachments).
In a second step, I wanted to validate my results with the GUI. Thus, I decided to plot the passive moments directly through the GUI. To do so, I open my model (the same used in the MatLab Code), I load the motion corresponding to the mobilization.
Then, using the Plot Tool, I sum the moment of all the muscles around the ankle. Moreover, I set the muscle activation to 0 via the Advanced Properties. In the attachments, you can find the details of my plot window.
Nevertheless, when I compare the passive moments obtained through MatLab and through the GUI, the results don't match, as you can in the attachment files.
Do you have any idea of where this difference can come from?
Thanks in advance,
Regards