FDK MOCAP Plug-in-gait-Simple

Hello AnyBody,

I'm trying to change the knee joint from a revolute joint to an FDK joint with 6 degrees of freedom in the MOCAP Plug-In Gait Simple Lower extremity. I have used the tutorials and the THA Knee Bend example for excluding the joint, adding the implants, and the contact forces because I didn't find the TKA Knee Bend in the beta section.
I have used AnyMechObjectExcluder to exclude the joint.

AnyMechObjectExcluder ExcludedKneeJoint=
 {
   Objects = arrcat(
   ObjSearch("Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJoint","AnyMechObject"),
  ObjSearch("Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJoint","AnyMechObject"),

   ObjSearchRecursive("Main.HumanModel.BodyModel.Right.Leg.Jnt.Knee","*","AnyMechObject"),
   
  ObjSearchRecursive("Main.Studies.InverseDynamicStudy.ModelEnvironmentConnection.JointsAndDrivers.JntDriverRightLegTD","Knee*","AnyMechObject"),
  ObjSearchRecursive("Main.HumanModel.BodyModel.Right.Leg.Jnt.Knee.Constraints","AnyMechObject")
   );
 };

After that, I added the FDK knee joint with implants and contact forces, but the result is that the segments are penetrating each other, and the femoral implant is located below the tibial plateau.
// New Knee Joint:
//JZ

AnyKinRotational Knee ={
  AnyRefNode &ShankNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame;
  AnyRefNode &ThighNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame;
  Type=RotVector;
};

//JZ
AnyKinLinear KneeLin={
  AnyRefNode &ShankNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame;
  AnyRefNode &ThighNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame;
  Ref=0;
};
//JZ
AnyRevoluteJoint FDKKneeJoint = {
  Axis = z;
  AnyRefNode &ShankNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame;
  AnyRefNode &ThighNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame;
  //AnyDrawStdJoint Knee = {  };
  
  //JZ 
  Constraints = {
    CType = {ForceDep, ForceDep, ForceDep, ForceDep, ForceDep};
    Reaction.Type={Off,Off,Off,Off,Off};
 };
 };
//Implants
Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame = {
//  Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJoint= {

  // Node to position the femoral implant
 
  AnyRefNode FemImplantNode = 
  {
    sRel={-0.01, 0.001, 0};

    // Surface geometry of the femoral implant
    AnySurfSTL FemoralImplant = 
    {
      FileName = "../Input/simplefemoral";
      ScaleXYZ = 0.9*1*{1.0, 1.0, 1.0};
      AnyDrawSurf DrwSurfFem = {
        FileName = .FileName;
        ScaleXYZ = .ScaleXYZ;
        Opacity = 1;
      };
    };
  };
  
 };

Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame = {
// Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJoint = {

  //JZ
  AnyRefNode ShankImplantNode = 
    

  {
      sRel={-0.01, 0.006, 0};

// Surface geometry of the Shank implant
AnySurfSTL ShankImplant = 
    {
      FileName = "../Input/simpletibial";
      ScaleXYZ = 1*{1.0, 1.0, 1.0};
      
      AnyDrawSurf DrwSurfFem = {
        FileName = .FileName;
        ScaleXYZ = .ScaleXYZ;
        RGB = {1,0,0};
        Opacity = 1;
     };
    };
  }; 
};


 AnyForceSurfaceContact FSurf = 
{ 
  AnySurface &sMaster = Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame.FemImplantNode.FemoralImplant;  
  AnySurface &sSlave=  Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame.ShankImplantNode.ShankImplant;

    
  PressureModule = 3.7e10;//3.7e9;//600e8;  //Vol Pen
  
  ForceViewOnOff = On;
  MeshRefinementMaster = 0;
  MeshRefinementSlave = 0;
  SingleSidedOnOff= Off;
  
};
AnyKinLinear KneeLin={
  AnyRefNode &ShankNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame.ShankImplantNode;
  AnyRefNode &ThighNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame.FemImplantNode;
  Ref=0;
};
AnyKinRotational Knee ={
  AnyRefNode &ShankNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame.ShankImplantNode;
  AnyRefNode &ThighNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame.FemImplantNode;
  Type=RotVector;
};

AnyForce ArtificialStiffness1 = 
{
  AnyFloat Stiffness = 7.5e2;//5e4; // N/m
  AnyKinLinear &lin = Main.Studies.KneeLin;
    F = -1*Stiffness * lin.Pos;

};

AnyForce ArtificialStiffness2 = 
{
  AnyFloat Stiffness = 7.5e2;//5e4; // N/m
  AnyKinRotational &Rot=Main.Studies.Knee;
  F =  -1*Stiffness * Rot.Pos;

};



AnyKinPLine ArtificialSpring = 
{
 AnyRefNode &ShankNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Shank.KneeJointAnatomicalFrame.ShankImplantNode;
  AnyRefNode &ThighNode =Main.HumanModel.BodyModel.Right.Leg.Seg.Thigh.KneeJointAnatomicalFrame.FemImplantNode;  AnyDrawPLine drw = 
  {
    //Visible = On;
    //Opacity = 1;
    Thickness = 0.005;
    RGB = {0,0,1};
  };
};


I've tried to change the position of the implants, adjust the stiffness, and modify the pressure module, but nothing changes. I have also added a ligament using the tutorials, and here I also encountered a problem because when I run the calibration of this ligament, the slack length doesn't change.

//Calibration of the ligament in AnyMocapModel Studies section : 
AnyBodyCalibrationStudy LigCali = {
        AnyFolder &Model = Main.HumanModel.BodyModel.Right.Leg.Ligament.LigModel;
        nStep = 1;
        
  // This driver puts the joint into the calibration position
Main.Studies.InverseDynamicStudy.ModelEnvironmentConnection.JointsAndDrivers.JntDriverRightLegTD.KneeFlexion= {
  
AnyRevoluteJoint &Jnt = Main.Studies.InverseDynamicStudy.FDKKneeJoint;
};
};

So my questions are: Is the penetration problem a result of the exclusion of the knee joint? Did I exclude more things than I should have? Is it a result of the parameters, such as pressure module and stiffness? Should I add more ligaments? And how can I ensure the calibration of the ligament changes the slack length?
And finally, could you please provide the TKA Knee Bend demo example?

Best Regards,
Jamila

Hi Jamila,

Welcome to the AnyScript forum!

FDK models can be quite complex to debug and I would suggest you firstly go through our wiki page listing out some common troubleshooting tips.

The TKA knee bend model was removed from the AMMR many versions ago. I would suggest a couple of other models: the knee simulator model in the AMMR, and the Knee Grand Challenge model on our github repository. These can be of help.

If you still have some questions after you go through these additional resources, please don't hesitate to write again.

Best regards,
Dave

Hi Dave,

Thank you for your response.

I downloaded the Knee Grand Challenge project from GitHub, but I encountered an error when trying to load the TKA squat. The interface throws the following warnings and error:

WARNING(OBJ.MODELDEF1) :   ScalingCustom.any(69)  :   Patella.scaling_message_Right_Patella  :  Custom scaling for 'Right.Patella' segment is used! Please specify a scaling law should an 'Unresolved object' error occur
WARNING(OBJ.MODELDEF1) :   ScalingCustom.any(84)  :   Shank.scaling_message_Right_Shank  :  Custom scaling for 'Right.Shank' segment is used! Please specify a scaling law should an 'Unresolved object' error occur
WARNING(OBJ.MODELDEF1) :   ScalingCustom.any(99)  :   Thigh.scaling_message_Right_Thigh  :  Custom scaling for 'Right.Thigh' segment is used! Please specify a scaling law should an 'Unresolved object' error occur
WARNING(OBJ.MODELDEF1) :   ScalingCustom.any(247)  :   Patella.scaling_message_Left_Patella  :  Custom scaling for Left.Patella' segment is used! Please specify a scaling law should an 'Unresolved object' error occur
WARNING(OBJ.MODELDEF1) :   ScalingCustom.any(262)  :   Shank.scaling_message_Left_Shank  :  Custom scaling for 'Left.Shank' segment is used! Please specify a scaling law should an 'Unresolved object' error occur
WARNING(OBJ.MODELDEF1) :   ScalingCustom.any(276)  :   Thigh.scaling_message_Left_Thigh  :  Custom scaling for 'Left.Thigh' segment is used! Please specify a scaling law should an 'Unresolved object' error occur
ERROR(SCR.PRS9) :   Interface.any(125)  :   'HipJointRef'  :  Unresolved object

Could you help me resolve this issue? Any guidance on how to address these scaling warnings and the unresolved HipJointRef object would be greatly appreciated.

Thank you for your time!

Best regards,
Parisa