Establish a 3 DOFs knee

Hi,

I want to modify the knee joint and increase its DOFs from a hinge joint to a SphericalJoint by modifying the code in the leg.root.any and Interface.any.
AnyKinMeasureOrg KneeFlexion = {
AnyFolder &Thigh = …Seg.Thigh.KneeJoint;
Thigh ={
AnyRefNode RotNode={
ARel={{…Sign1,0,0},{0,…Sign1,0},{0,0,1}};
};
};
AnyFolder &Shank = …Seg.Shank.KneeJoint;
Shank ={
AnyRefNode RotNode={
ARel={{…Sign1,0,0},{0,…Sign1,0},{0,0,1}};
};
};
AnyKinRotational KneeRot={
AnyRefNode &ShankNode = …Seg.Shank.KneeJoint.RotNode;
AnyRefNode &ThighNode = …Seg.Thigh.KneeJoint.RotNode;
Type=RotAxesAngles;
};
MeasureOrganizer={0};
};

AnyKinMeasureOrg KneeAbduction= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={1};
};
AnyKinMeasureOrg KneeExternalRotation= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={2};
};

when I run inverse kinematics ,everything goes well (kinematics.png).
However,when I run inverse dynamics, the location of marker on the tibia is not good(kinetics.png).Seen in the attched pictures.
Could you please give me some suggestion?
Thanks very much for your attention.

Best wishes,
johntiger

Hi JohnTiger,

Judging from your code it will not alter any joints it is a set of new measures only.

To modify the knee joint it would exclude the current knee joint using the MechObjectExclude options of the AnyBodyStudy. Then add a new spherical joint instead, using the exclude options it is possible to avoid altering the original AMMR script.

The difference in the pictures may arise if you run a parameter optimization and then somehow fail to transfer the optimized values to the inverse dynamic model. If you use the built in sequence of operations in the MocapModels this should be automatically handled but if you select the operations manually you have to ensure you do it correctly.

Best regards
Søren

Dear Søren,

Thanks very much for your quick reply.
As for the model,I modified the knee joint from a hinge joint to a spherical joint in the leg.root.any.
AnySphericalJoint &Knee = .Jnt.Knee;

And as for the parameters, I added extra code in the model. And I have transfered the optimized values calculated from inverse kinematics to the inverse dynamic model successfully in the first 20 frames. And the location of the marker on the tibia is good in the beginning, but goes wrong in later frames as I mentioned. Could you please help me with that?

As for your suggestions, I will have a try and replace the previous joint using the MechObjectExclude.

Thanks for your time!

Best regards,
John

Hi JohnTiger,

It is strange that the correspondance seems to be ok in the start and then deviate.

The only thing i could think of is if you are exporting the joint angles in the knee using one rotational measure and then when applying them in the inverse analysis you are using a different measure or different sequence?, please verify this.

The mechobjectexclude will not change your results, it is just a way to make the model without changing the AMMR body model code.

Best regards
Søren

Dear Søren,

Thanks very much for your reply.
I have checked the model again and found that the locations of the marker are not good in the first frame.I am sorry for my last reply.
I use step to debug the model.In the first,it runs well,and it shows finishes updating the expressions.And the error took place when the Design variables updated.I guess the optimised locations from the inverse kinematic analysis are not well transmitted to the inverse dynamics steps.

As for the mechobjectexclude code,I have encountered some problems.
I have added the new kneejoint in the inverse kinematic step as following.However,the other two angles are extremly low(max angle 8e-5rad) compared with flexion angle(max angle 1.2 rad).Could you please help me with that?
//AnyObjectPtrArray l1 = ObjSearch(“Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJoint”,“AnyMechObject”);
// exclude knee joint
AnyObjectPtrArray l1 = ObjSearch(“Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJoint”,“AnyMechObject”);
AnyObjectPtrArray l2 = ObjSearchRecursive(“Main.HumanModel.BodyModel.Right.Leg.Jnt.Knee”,"",“AnyMechObject”);
AnyObjectPtrArray l3 = ObjSearchRecursive(“Main.Model.ModelEnvironmentConnection.JointsAndDrivers.JntDriverRightLegTD”,"Knee
",“AnyMechObject”);

AnyObjectPtrArray KneeExcludeList = arrcat(arrcat(l1,l2), l3);

MechObjectExclude = KneeExcludeList;

AnySphericalJoint Knee = {

AnyRefFrame &ThighNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJoint;
AnyRefFrame &ShankNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJoint;

AnyKinMeasureOrg KneeFlexion = {
AnyKinRotational KneeRot={
AnyRefNode &ShankNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJoint;
AnyRefNode &ThighNode = Main.Studies.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJoint;
Type=RotAxesAngles;
};
MeasureOrganizer={0};
};

AnyKinMeasureOrg KneeAbduction= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={1};
};
AnyKinMeasureOrg KneeExternalRotation= {
AnyKinRotational &KneeJoint=.KneeFlexion.KneeRot;
MeasureOrganizer={2};
};
};

I really appreciate your patience.

Best regards,
John

Hi JohnTiger,

One other thing comes to my mind please ensure that you run the sequence of operations correctly so using the RunAnalysis operation it ensures that the values are transferred correctly and the updates are done.

If you see values in the spherical joint being zero i may indicate that the revolute joint was not excluded correctly. To see if this is the case click on the invserseStudy in the modeltree and go though it’s information on joint, drivers, segs… the knee joint should not be present and you should see your new joint there. If this is not the case the exclusion was wrong.

The exclude code looks in principle ok but there are some spaces (e.g. ht.Leg.Seg .Thigh.KneeJoint) in the search terms that are wrong and will affect the result.

Hope it helps

Bets regards
Søren

Hi Søren,

Thanks very much for your reply!
I am modifying the model and hope it will work.

best regards,
John

This topic was automatically closed 125 days after the last reply. New replies are no longer allowed.