Add an auxiliary torque

Hello AnyBody,
I would like to add an auxiliary torque at each of the left and right hip and knee joints in the Plug-in-gait-simple model, in order to simulate the effect of a conceptual exoskeleton during human gait.
Below is my code.

/// Study for running the inverse dynamic simulation
AnyBodyStudy InverseDynamicStudy =
{
//RightKnee
AnyFunInterpol RightKneeForce =
{
Type = PiecewiseLinear;
FileName = "D:\Anybody_Task\Right_knee.csv";
};
AnyForce RightKneeMoment =
{
F = .RightKneeForce(Main.Studies.InverseDynamicStudy.t);
AnyKinMeasure &ref = Main.HumanModel.BodyModel.Interface.Right.KneeFlexion;
viewForce.Visible = On;
};
//LeftKnee
AnyFunInterpol LeftKneeForce =
{
Type = PiecewiseLinear;
FileName = "D:\Anybody_Task\Left_knee.csv";
};
AnyForce LeftKneeMoment =
{
F = .RightKneeForce(Main.Studies.InverseDynamicStudy.t);
AnyKinMeasure &ref = Main.HumanModel.BodyModel.Interface.Left.KneeFlexion;
viewForce.Visible = On;
};
//RightHip
AnyFunInterpol RightHipForce =
{
Type = PiecewiseLinear;
FileName = "D:\Anybody_Task\Right_hip.csv";
};
AnyForce RightHipMoment =
{
F = .RightHipForce(Main.Studies.InverseDynamicStudy.t);
AnyKinMeasure &ref = Main.HumanModel.BodyModel.Interface.Right.HipFlexion;
viewForce.Visible = On;
};
//LeftHip
AnyFunInterpol LeftHipForce =
{
Type = PiecewiseLinear;
FileName = "D:\Anybody_Task\Left_hip.csv";
};
AnyForce LeftHipMoment =
{
F = .LeftHipForce(Main.Studies.InverseDynamicStudy.t);
AnyKinMeasure &ref = Main.HumanModel.BodyModel.Interface.Left.HipFlexion;
viewForce.Visible = On;
};

"But I ran into a problem: the resulting joint moments are only shifted up/down compared to the case without the auxiliary torques.
The path I used to read / apply the torque is:Studies-InverseDynamicStudy-BodyModel-SelectedOutput-Right-Leg-JointMomentMeasure-HipFlexion or KneeFlexion
Here are two plots comparing the joint moments before and after adding the assist torque.
Uploading: 图片1.png…
Uploading: image.png…

The figure below shows a comparison between my assist torque and the original (baseline) torque.
Uploading: 图片3.png…
Uploading: 图片4.png…
Uploading: 图片5.png…
Uploading: 图片6.png…

After I applied the torque in AnyBody, the observed result turned out like this.
Uploading: 图片7.png…
Uploading: 图片8.png…

The joint moment now looks like this—how should I interpret it, and how can I apply the torque I calculated correctly?
My interpolation file has time (frames) in the first column and torque values (Nm) in the second column.
Any suggestions would be greatly appreciated—thank you very much!

Hi Ronin

Your implementation seems to be ok. Can you please clarify what is the first column in your interpolation files? You wrote "time (frames)", and I can't understand if it is time or frame number. It has to be time. From your graphs, it looks like it's almost a constant offset and that indicates to me that maybe you have used frame number in the interpolation file as the first column. If that is the case, then there would be almost no variation in the applied torque as you interpolate from 1.6 to 2.8 seconds, which in case of frame numbers would mean just two or three frames.

Another thing you can try is apply a constant moment at the joints and see if the selected output measure for joint moment is changing correspondingly according to the values of the applied moment.

Best regards,
Dave

Hi Ronin

The C3D file has frame numbers as the first column. These frame numbers would correspond to time, and this is handled in the model by using the recording frequency. If you search in the code, you can find some examples of how to convert frame number to time using the recording frequency.

As far as your data is concerned, you should also convert the frame numbers to time. You can do that either in the raw data, or in your model.

Best regards,
Dave