[38ba34]: / Tests / AnyMocap / Test_ForcePlateAutoDetection.any

Download this file

205 lines (160 with data), 4.8 kB

//define = (
// [
//  {'FP_TYPE':'"1"'}, 
//  {'FP_TYPE':'"2"'}, 
//  {'FP_TYPE':'"2a"'}, 
//  {'FP_TYPE':'"2b"'}, 
//  {'FP_TYPE':'"3"'}, 
//  {'FP_TYPE':'"4"'}
// ],
// [
//  {'PLATE_LIMB_DISTANCE':0.01},
//  {'PLATE_LIMB_DISTANCE': 0.5}
// ],
//)




#include "../libdef.any"

#include "<ANYMOCAP_PATH>\ForcePlates\ForcePlateAutoDetection.any"


#ifndef FP_TYPE
#define FP_TYPE "all"
#endif


#ifndef PLATE_LIMB_DISTANCE  
#define PLATE_LIMB_DISTANCE  1.05
#endif



// Prevent the no reaction bug
Main = {
  AnyFixedRefFrame fixref = {}; AnyReacForce reac = {AnyKinLinear lin = {AnyRefFrame& ref = ..fixref;};};
};




#define CREATE_DUMMY_LIMB(NAME, DIST)  AnyFixedRefFrame NAME= {\
  Origin = .Plate.Corners.PlateCenter.sRel+ {0,0, DIST}*Axes';\
  Axes = .Plate.Corners.PlateCenter.ARel;\
  AnyRefNode HeelContactNodeLow = {}; AnyRefNode ToeLateralContactNode = {};  }
#define CREATE_C3D(FNAME) AnyInputC3D C3D = {\
  FileName = #FNAME;\
  PointsScaleFactor = 0.001; ConstructChartOnOff = Off; ConstructModelOnOff = Off; }



Main = 
{  
  
  
  AnyFolder ForcePlates =  {
    
    #if FP_TYPE == "1" | FP_TYPE == "all"
    AnyFolder  Type1 = {
      CREATE_C3D(c3d_data/type1.c3d);
      CREATE_DUMMY_LIMB(foot1, PLATE_LIMB_DISTANCE);
      CREATE_DUMMY_LIMB(foot2, 5);
      
      ForcePlateAutoDetection Plate(
        PLATE_NO=1,
        HeightTolerance = 0.07,
        VelThreshold = 2.2,
        C3D_OBJECT = Main.ForcePlates.Type1.C3D,
        FORCEPLATE_TYPE = 1,
        LIMB1 =.foot1,
        LIMB2 = .foot2
      )
      ={ };  
      
    };
    #endif
    
    
    
    #if FP_TYPE == "2" | FP_TYPE == "all"
    AnyFolder Type2 = {
      CREATE_C3D(c3d_data/type2.c3d);
      CREATE_DUMMY_LIMB(foot1, PLATE_LIMB_DISTANCE);
      CREATE_DUMMY_LIMB(foot2, 5);
      
      ForcePlateAutoDetection Plate(
      PLATE_NO=1,
      HeightTolerance = 0.07,
      VelThreshold = 2.2,
      C3D_OBJECT = Main.ForcePlates.Type2.C3D,
      FORCEPLATE_TYPE = 2,
      LIMB1 =.foot1,
      LIMB2 = .foot2
      )
      ={ };  
    };
    #endif
       
    #if FP_TYPE == "2a" | FP_TYPE == "all"
    AnyFolder Type2a = {
      CREATE_C3D(c3d_data/type2a.c3d);
      CREATE_DUMMY_LIMB(foot1, PLATE_LIMB_DISTANCE);
      CREATE_DUMMY_LIMB(foot2, 5);
      
      ForcePlateAutoDetection Plate(
      PLATE_NO=1,
      HeightTolerance = 0.07,
      VelThreshold = 2.2,
      C3D_OBJECT = Main.ForcePlates.Type2a.C3D,
      FORCEPLATE_TYPE = 2,
      LIMB1 =.foot1,
      LIMB2 = .foot2
      )
      ={ };  
    };
    #endif
       
    #if FP_TYPE == "2b" | FP_TYPE == "all"
    AnyFolder Type2b = {
      CREATE_C3D(c3d_data/type2b.c3d);
      CREATE_DUMMY_LIMB(foot1, PLATE_LIMB_DISTANCE);
      CREATE_DUMMY_LIMB(foot2, 5);
      
      ForcePlateAutoDetection Plate(
      PLATE_NO=1,
      HeightTolerance = 0.07,
      VelThreshold = 2.2,
      C3D_OBJECT = Main.ForcePlates.Type2b.C3D,
      FORCEPLATE_TYPE = 2,
      LIMB1 =.foot1,
      LIMB2 = .foot2
      )
      ={ };  
    };
    #endif
           
    
    #if FP_TYPE == "3" | FP_TYPE == "all"
    AnyFolder Type3 = {
      CREATE_C3D(c3d_data/type3.c3d);
      CREATE_DUMMY_LIMB(foot1, PLATE_LIMB_DISTANCE);
      CREATE_DUMMY_LIMB(foot2, 5);
      
      ForcePlateAutoDetection Plate(
      PLATE_NO=1,
      HeightTolerance = 0.07,
      VelThreshold = 2.2,
      C3D_OBJECT = Main.ForcePlates.Type3.C3D ,
      FORCEPLATE_TYPE = 3,
      LIMB1 =.foot1,
      LIMB2 = .foot2
      )
      ={ };  
    };
    #endif  
    
    #if FP_TYPE == "4" | FP_TYPE == "all"
    AnyFolder Type4 = {
      CREATE_C3D(c3d_data/type4.c3d);
      CREATE_DUMMY_LIMB(foot1, PLATE_LIMB_DISTANCE);
      CREATE_DUMMY_LIMB(foot2, 5);
      
      
      ForcePlateAutoDetection Plate(
      PLATE_NO=1,
      HeightTolerance = 0.07,
      VelThreshold = 2.2,
      C3D_OBJECT = Main.ForcePlates.Type4.C3D,
      FORCEPLATE_TYPE = 4,
      LIMB1 =.foot1,
      LIMB2 = .foot2
      )
      ={ };
    };
    #endif
  };
  
  
  AnyOperation& RunTest = Study.InverseDynamics;
  
  AnyBodyStudy Study = {
    Gravity= {0,0,0};
    tStart = 0.8;
    tEnd = 2;
    nStep = 10;
    AnyFolder& ForcePlates = Main.ForcePlates;
    Kinematics.SolverType = KinSolDeterminate;
    InverseDynamics.Criterion.Type = MR_Linear;
    
    AnySeg Dummy = 
    {
       Mass = 0.0;
       Jii = {0,0,0};   
    };
    AnyKinDriver dummy_fix = 
    {
      AnyKinLinear lin = { AnyRefFrame& ref = ..Dummy;  };
      AnyKinRotational rot = {Type = RotAxesAngles; AnyRefFrame& ref = ..Dummy;};
    }; 
    
  };
  
};