[bfdf16]: / Body / AAUHuman / BodyModels / GenericBodyModel / BodyModel.MannequinDrivers.any

Download this file

1238 lines (1112 with data), 45.7 kB

/* ----------------------------------------------------------------
Default mannequin drivers:

-The pelvis is locked to the ground 
-The remaining degrees of freedom are controlled by parameters in the "<BM_MANNEQUIN_FILE>" file.
-This file is a good way to get an overview of the dof in the full body model
 all the dof in the body model is driven from this file.
-In total 

Soeren, March 1, 2006.
----------------------------------------------------------------  */
// But the bennefit of this implementation with optional Assignment
// is that all variables can be overridden, as if they were 
// variables of a class. 
// For example all weight can be customized in the application files:
//
// Main.HumanModel.DefaultMannequinDrivers = {
//       PostureDriverBending.Weights.Fun.Value = 0.1;
// };
  
AnyFolder DefaultMannequinDrivers = 
{

  AnyComponentDefinition obj = {};
  
  AnyFloat DefaultWeakDriverWeight ??= 0.001;
  
  #if BM_MANNEQUIN_DRIVER_WEAK_SWITCH == 1
  AnyKinEqType DefaultDriverCType ??= Soft;
  #else
  AnyKinEqType DefaultDriverCType ??= Hard;
  #endif

   

  #if BM_GLOBAL_REFERENCE_FRAME_SWITCH == 0
    AnyFixedRefFrame GenericGRF = {Origin ??= {0,0,0};};
  #endif
  
  AnyFolder &JntPos = .Mannequin.Posture;
  AnyFolder &JntVel = .Mannequin.PostureVel;
  
  #if BM_MANNEQUIN_DRIVER_PELVIS_POS_X
  /// Enabled/disabled with:
  /// #define BM_BM_MANNEQUIN_DRIVER_PELVIS_POS_X ON/OFF
  /// 
  AnyKinEqSimpleDriver PelvisGroundDriverPosX = {
    AnyKinLinear lin = {
      #if BM_GLOBAL_REFERENCE_FRAME_SWITCH == 0
        AnyFixedRefFrame &ref1 =..GenericGRF;
      #else
        AnyFixedRefFrame &ref1 = GLOBAL_REFERENCE_FRAME;
      #endif
      AnyRefFrame &ref2 =...BodyModel.Trunk.SegmentsLumbar.PelvisSeg.AnatomicalFrame;
    };
    MeasureOrganizer = {0};
    DriverPos ??=  {.JntPos.PelvisPosX};
    DriverVel ??=  {.JntVel.PelvisPosX};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  #if BM_MANNEQUIN_DRIVER_PELVIS_POS_Y
  /// Default mannequin driver. Control with:
  /// #define BM_BM_MANNEQUIN_DRIVER_PELVIS_POS_Y ON/OFF
  /// 
  AnyKinEqSimpleDriver PelvisGroundDriverPosY ={
    AnyKinLinear lin ={
      #if BM_GLOBAL_REFERENCE_FRAME_SWITCH == 0
        AnyFixedRefFrame &ref1 =..GenericGRF;
      #else
        AnyFixedRefFrame &ref1 = GLOBAL_REFERENCE_FRAME;
      #endif
      AnyRefFrame &ref2 =...BodyModel.Trunk.SegmentsLumbar.PelvisSeg.AnatomicalFrame;
    };
    MeasureOrganizer = {1};
    DriverPos ??=  {.JntPos.PelvisPosY};
    DriverVel ??=  {.JntVel.PelvisPosY};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif

  
  
  #if BM_MANNEQUIN_DRIVER_PELVIS_POS_Z
  /// Enabled/disabled with:
  /// #define BM_BM_MANNEQUIN_DRIVER_PELVIS_POS_Z ON/OFF
  /// 
  AnyKinEqSimpleDriver PelvisGroundDriverPosZ ={
    AnyKinLinear lin ={
      #if BM_GLOBAL_REFERENCE_FRAME_SWITCH == 0
        AnyFixedRefFrame &ref1 =..GenericGRF;
      #else
        AnyFixedRefFrame &ref1 = GLOBAL_REFERENCE_FRAME;
      #endif
      AnyRefFrame &ref2 =...BodyModel.Trunk.SegmentsLumbar.PelvisSeg.AnatomicalFrame;
    };
    MeasureOrganizer = {2};
    DriverPos ??=  {.JntPos.PelvisPosZ};
    DriverVel ??=  {.JntVel.PelvisPosZ};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif

  
  #if BM_MANNEQUIN_DRIVER_PELVIS_ROT_Z
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_PELVIS_ROT_Z ON/OFF
  /// 
  AnyKinEqSimpleDriver PelvisGroundDriverRotZ ={
    AnyKinRotational rot ={
      #if BM_GLOBAL_REFERENCE_FRAME_SWITCH == 0
        AnyFixedRefFrame &ref1 =..GenericGRF;
      #else
        AnyFixedRefFrame &ref1 = GLOBAL_REFERENCE_FRAME;
      #endif
      AnyRefFrame &ref2 =...BodyModel.Trunk.SegmentsLumbar.PelvisSeg.AnatomicalFrameTrunk;
      Type=RotAxesAngles;
    };
    MeasureOrganizer = {0};
    DriverPos ??=  pi/180*{.JntPos.PelvisRotZ};
    DriverVel ??=  pi/180*{.JntVel.PelvisRotZ};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  #if BM_MANNEQUIN_DRIVER_PELVIS_ROT_Y
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_PELVIS_ROT_Y ON/OFF
  /// 
  AnyKinEqSimpleDriver PelvisGroundDriverRotY ={
    AnyKinRotational rot ={
      #if BM_GLOBAL_REFERENCE_FRAME_SWITCH == 0
        AnyFixedRefFrame &ref1 =..GenericGRF;
      #else
        AnyFixedRefFrame &ref1 = GLOBAL_REFERENCE_FRAME;
      #endif
      AnyRefFrame &ref2 =...BodyModel.Trunk.SegmentsLumbar.PelvisSeg.AnatomicalFrameTrunk;
      Type=RotAxesAngles;
    };
    MeasureOrganizer = {1};
    DriverPos ??=  pi/180*{.JntPos.PelvisRotY};
    DriverVel ??=  pi/180*{.JntVel.PelvisRotY};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  #if BM_MANNEQUIN_DRIVER_PELVIS_ROT_X
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_PELVIS_ROT_X ON/OFF
  /// 
  AnyKinEqSimpleDriver PelvisGroundDriverRotX ={
    AnyKinRotational rot ={
      #if BM_GLOBAL_REFERENCE_FRAME_SWITCH == 0
        AnyFixedRefFrame &ref1 =..GenericGRF;
      #else
        AnyFixedRefFrame &ref1 = GLOBAL_REFERENCE_FRAME
      #endif
      AnyRefFrame &ref2 =...BodyModel.Trunk.SegmentsLumbar.PelvisSeg.AnatomicalFrameTrunk;
      Type=RotAxesAngles;
    };
    MeasureOrganizer = {2};
    DriverPos ??=  pi/180*{.JntPos.PelvisRotX};
    DriverVel ??=  pi/180*{.JntVel.PelvisRotX};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  
  
  
  
  // ************************************
  // Drivers for the spine
  // ************************************
  #if BM_TRUNK_LUMBAR_RHYTHM == 0
    AnyMessage LumbarSpineMannequinDrivers = {TriggerPreProcess=On;Type=MSG_Message; Message="Please note that BM_SPINE_RHYTHM is set to OFF; No default mannequin drivers are used to drive lumbar spine joints.";};
  #endif
  
   #if BM_MANNEQUIN_DRIVER_SKULL_THORAX_FLEXION
     /// Enabled/disabled with:
     /// #define BM_MANNEQUIN_DRIVER_SKULL_THORAX_FLEXION ON/OFF
     /// 
     AnyKinEqSimpleDriver SkullThoraxFlexionDriver = {
       AnyKinMeasure& SkullThoraxFlexion = ..BodyModel.Interface.Trunk.SkullThoraxFlexion;

       DriverPos ??=  pi/180*{-.JntPos.NeckExtension};
       DriverVel ??=  pi/180*{-.JntVel.NeckExtension};
       Reaction = {Type ??=  {Off};};
       AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
       AnyFolder Weights = 
       {
         AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
       };
       WeightFun ??=  {&Weights.Fun};
       CType ??=  repmat(nDim, .DefaultDriverCType);
     };
   #endif
   
   #if BM_MANNEQUIN_DRIVER_SKULL_THORAX_LATERALBENDING
     /// Enabled/disabled with:
     /// #define BM_MANNEQUIN_DRIVER_SKULL_THORAX_LATERALBENDING ON/OFF
     /// 
     AnyKinEqSimpleDriver SkullThoraxLateralBendingDriver = {
       AnyKinMeasure& SkullThoraxLateralBending = ..BodyModel.Interface.Trunk.SkullThoraxLateralBending;

       DriverPos ??=  pi/180*{.JntPos.NeckLateralBending};
       DriverVel ??=  pi/180*{.JntVel.NeckLateralBending};
       Reaction = {Type ??=  {Off};};
       AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
       AnyFolder Weights = 
       {
         AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
       };
       WeightFun ??=  {&Weights.Fun};
       CType ??=  repmat(nDim, .DefaultDriverCType);
     };
   #endif
   
   #if BM_MANNEQUIN_DRIVER_SKULL_THORAX_ROTATION
     /// Enabled/disabled with:
     /// #define BM_MANNEQUIN_DRIVER_SKULL_THORAX_ROTATION ON/OFF
     /// 
     AnyKinEqSimpleDriver SkullThoraxRotationDriver = {
       AnyKinMeasure& SkullThoraxRotation = ..BodyModel.Interface.Trunk.SkullThoraxRotation;

       DriverPos ??=  pi/180*{.JntPos.NeckRotation};
       DriverVel ??=  pi/180*{.JntVel.NeckRotation};
       Reaction = {Type ??=  {Off};};
       AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
       AnyFolder Weights = 
       {
         AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
       };
       WeightFun ??=  {&Weights.Fun};
       CType ??=  repmat(nDim, .DefaultDriverCType);
     };
   #endif  
  
  //Thorax pelvis rotation driver
  #if BM_MANNEQUIN_DRIVER_PELVIS_THORAX_LATERAL_BENDING
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_SKULL_THORAX_ROTATION ON/OFF
  /// 
  AnyKinEqSimpleDriver PostureDriverBending ={
    AnyKinMeasure& Ref2 = ..BodyModel.Interface.Trunk.PelvisThoraxLateralBending;        
    DriverPos ??=  pi/180*{.JntPos.PelvisThoraxLateralBending};
    DriverVel ??=  pi/180*{.JntVel.PelvisThoraxLateralBending};
    Reaction = {Type ??=  {Off};};  
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };  
  #endif

  #if BM_MANNEQUIN_DRIVER_PELVIS_THORAX_ROTATION
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_PELVIS_THORAX_ROTATION ON/OFF
  /// 
  AnyKinEqSimpleDriver PostureDriverRotation ={
    AnyKinMeasure& Ref3 = ..BodyModel.Interface.Trunk.PelvisThoraxRotation;   
    DriverPos ??=  pi/180*{.JntPos.PelvisThoraxRotation};
    DriverVel ??=  pi/180*{.JntVel.PelvisThoraxRotation};
    Reaction = {Type ??=  {Off};};  
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };  
  #endif
  
  #if BM_MANNEQUIN_DRIVER_PELVIS_THORAX_EXTENSION
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_PELVIS_THORAX_EXTENSION ON/OFF
  /// 
  AnyKinEqSimpleDriver PostureDriverExtension ={
    AnyKinMeasure& Ref1 = ..BodyModel.Interface.Trunk.PelvisThoraxExtension;
    DriverPos ??=  pi/180*{.JntPos.PelvisThoraxExtension};
    DriverVel ??=  pi/180*{.JntVel.PelvisThoraxExtension};
    Reaction = {Type ??=  {Off};};  
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };  
  #endif
  
  
  // ************************************
  // Drivers for the right arm
  // ************************************

  #if BM_ARM_RIGHT == 1
  
  #if BM_ARM_SHOULDER_RHYTHM == 0 
  
  //Sterno clavicular joint driver
  #if  BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_PROTRACTION_RIGHT
    /// Enabled/disabled with:
    /// #define BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_PROTRACTION_RIGHT ON/OFF
    /// 
    AnyKinEqSimpleDriver SCProtractionDriverRight ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Right.SternoClavicularProtraction;
    DriverPos ??=  pi/180*{.JntPos.Right.SternoClavicularProtraction};
    DriverVel ??=  pi/180*{.JntVel.Right.SternoClavicularProtraction};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if  BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_ELEVATION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_ELEVATION_RIGHT ON/OFF
  /// 
  AnyKinEqSimpleDriver SCElevationDriverRight ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Right.SternoClavicularElevation;
    DriverPos ??=  pi/180*{ .JntPos.Right.SternoClavicularElevation };
    DriverVel ??=  pi/180*{ .JntVel.Right.SternoClavicularElevation };
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if  BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_AXIAL_ROTATION_RIGHT & BM_ARM_CLAVICULA_ROTATION_RHYTHM == 0
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_AXIAL_ROTATION_RIGHT ON/OFF
  /// 
  AnyKinEqSimpleDriver SCAxialRotationDriverRight ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Right.SternoClavicularAxialRotation;
    DriverPos ??=  pi/180*{ .JntPos.Right.SternoClavicularAxialRotation  };
    DriverVel ??=  pi/180*{ .JntVel.Right.SternoClavicularAxialRotation  };
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };  
  #endif
  
  #endif // BM_ARM_SHOULDER_RHYTHM = 0 
  
  
  //Glenohumeral joint 
  #if BM_MANNEQUIN_DRIVER_GLENOHUMERAL_ABDUCTION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_GLENOHUMERAL_ABDUCTION_RIGHT ON/OFF
  /// 
  AnyKinEqSimpleDriver GHDriverRightAbduction={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Right.GlenohumeralAbduction;
     DriverPos ??=  pi/180*{.JntPos.Right.GlenohumeralAbduction};
     DriverVel ??=  pi/180*{.JntVel.Right.GlenohumeralAbduction};    
     Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_GLENOHUMERAL_FLEXION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_GLENOHUMERAL_FLEXION_RIGHT ON/OFF
  /// 
  AnyKinEqSimpleDriver GHDriverRightFlexion={
    AnyKinMeasure& ref2 =..BodyModel.Interface.Right.GlenohumeralFlexion;
     DriverPos ??=  pi/180*{.JntPos.Right.GlenohumeralFlexion};
     DriverVel ??=  pi/180*{.JntVel.Right.GlenohumeralFlexion};    
     Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_GLENOHUMERAL_EXTERNAL_ROTATION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_GLENOHUMERAL_EXTERNAL_ROTATION_RIGHT ON/OFF
  /// 
  AnyKinEqSimpleDriver GHDriverRightExternalRotation={
    AnyKinMeasure& ref3 =..BodyModel.Interface.Right.GlenohumeralExternalRotation;
     DriverPos ??=  pi/180*{.JntPos.Right.GlenohumeralExternalRotation};
     DriverVel ??=  pi/180*{.JntVel.Right.GlenohumeralExternalRotation};    
     Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  
  //Elbow flexion driver  
  #if BM_MANNEQUIN_DRIVER_ELBOW_FLEXION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_ELBOW_FLEXION_RIGHT ON/OFF
  /// 
  AnyKinEqSimpleDriver ElbowFlexionDriverRight={
    AnyKinMeasureOrg  &Elbow =..BodyModel.Interface.Right.ElbowFlexion;
    DriverPos ??=  pi/180*{.JntPos.Right.ElbowFlexion};  
    DriverVel ??=  pi/180*{.JntVel.Right.ElbowFlexion};  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  //Elbow pronation driver
  #if BM_MANNEQUIN_DRIVER_ELBOW_PRONATION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_ELBOW_PRONATION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver ElbowPronationDriverRight={
    AnyKinMeasure& Elbow =..BodyModel.Interface.Right.ElbowPronation;
    DriverPos ??=  pi/180*{.JntPos.Right.ElbowPronation };  

    DriverVel ??=  pi/180*{.JntVel.Right.ElbowPronation };  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif

  
  
  //Wrist driver 
  #if BM_MANNEQUIN_DRIVER_WRIST_FLEXION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_WRIST_FLEXION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver WristDriverRightFlexion ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Right.WristFlexion;
    DriverPos ??=  pi/180*{.JntPos.Right.WristFlexion};
    DriverVel ??=  pi/180*{.JntVel.Right.WristFlexion};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_WRIST_ABDUCTION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_WRIST_ABDUCTION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver WristDriverRightAbduction ={
    AnyKinMeasure& ref2 =..BodyModel.Interface.Right.WristAbduction;
    DriverPos ??=  pi/180*{.JntPos.Right.WristAbduction};
    DriverVel ??=  pi/180*{.JntVel.Right.WristAbduction};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #endif

  

  // ************************************
  // Drivers for the left arm
  // ************************************
  
  #if BM_ARM_LEFT == 1
  
  #if BM_ARM_SHOULDER_RHYTHM == 0 
  
  //Sterno clavicular joint driver
  #if BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_PROTRACTION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_PROTRACTION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver SCProtractionDriverLeft ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Left.SternoClavicularProtraction;
    DriverPos ??=  pi/180*{.JntPos.Left.SternoClavicularProtraction};
    DriverVel ??=  pi/180*{.JntVel.Left.SternoClavicularProtraction};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if  BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_ELEVATION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_ELEVATION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver SCElevationDriverLeft ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Left.SternoClavicularElevation;
    DriverPos ??=  pi/180*{ .JntPos.Left.SternoClavicularElevation };
    DriverVel ??=  pi/180*{ .JntVel.Left.SternoClavicularElevation };
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if  BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_AXIAL_ROTATION_LEFT & BM_ARM_CLAVICULA_ROTATION_RHYTHM == 0

  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_STERNOCLAVICULAR_AXIAL_ROTATION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver SCAxialRotationDriverLeft ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Left.SternoClavicularAxialRotation;
    DriverPos ??=  pi/180*{ .JntPos.Left.SternoClavicularAxialRotation  };
    DriverVel ??=  pi/180*{ .JntVel.Left.SternoClavicularAxialRotation  };
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };  
  #endif
  #endif // BM_ARM_SHOULDER_RHYTHM = 0 
  
  
  //Glenohumeral joint driver
  #if BM_MANNEQUIN_DRIVER_GLENOHUMERAL_ABDUCTION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_GLENOHUMERAL_ABDUCTION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver GHDriverLeftAbduction={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Left.GlenohumeralAbduction;
    DriverPos ??=  pi/180*{.JntPos.Left.GlenohumeralAbduction};    
    DriverVel ??=  pi/180*{.JntVel.Left.GlenohumeralAbduction};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_GLENOHUMERAL_FLEXION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_GLENOHUMERAL_FLEXION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver GHDriverLeftFlexion={
    AnyKinMeasure& ref2 =..BodyModel.Interface.Left.GlenohumeralFlexion;
    DriverPos ??=  pi/180*{.JntPos.Left.GlenohumeralFlexion};    
    DriverVel ??=  pi/180*{.JntVel.Left.GlenohumeralFlexion};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif

  #if BM_MANNEQUIN_DRIVER_GLENOHUMERAL_EXTERNAL_ROTATION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_GLENOHUMERAL_EXTERNAL_ROTATION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver GHDriverLeftExternalRotation={
    AnyKinMeasure& ref3 =..BodyModel.Interface.Left.GlenohumeralExternalRotation;
    DriverPos ??=  pi/180*{.JntPos.Left.GlenohumeralExternalRotation};    
    DriverVel ??=  pi/180*{.JntVel.Left.GlenohumeralExternalRotation};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif

  //Elbow flexion driver  
  #if BM_MANNEQUIN_DRIVER_ELBOW_FLEXION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_ELBOW_FLEXION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver ElbowFlexionDriverLeft={
    AnyKinMeasureOrg  &Elbow =..BodyModel.Interface.Left.ElbowFlexion;
    DriverPos ??=  pi/180*{.JntPos.Left.ElbowFlexion};  
    DriverVel ??=  pi/180*{.JntVel.Left.ElbowFlexion};  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  //Elbow pronation driver
  #if BM_MANNEQUIN_DRIVER_ELBOW_PRONATION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_ELBOW_PRONATION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver ElbowPronationDriverLeft={
    AnyKinMeasure& Elbow =..BodyModel.Interface.Left.ElbowPronation;
    DriverPos ??=  pi/180*{.JntPos.Left.ElbowPronation };  
    DriverVel ??=  pi/180*{.JntVel.Left.ElbowPronation };  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif  
  
  //Wrist driver
  #if BM_MANNEQUIN_DRIVER_WRIST_FLEXION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_WRIST_FLEXION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver WristDriverLeftFlexion ={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Left.WristFlexion;
    DriverPos ??=  pi/180*{.JntPos.Left.WristFlexion};
    DriverVel ??=  pi/180*{.JntVel.Left.WristFlexion};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_WRIST_ABDUCTION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_WRIST_ABDUCTION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver WristDriverLeftAbduction ={
    AnyKinMeasure& ref2 =..BodyModel.Interface.Left.WristAbduction;
    DriverPos ??=  pi/180*{.JntPos.Left.WristAbduction};
    DriverVel ??=  pi/180*{.JntVel.Left.WristAbduction};
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  #endif //Left arm
  
  #if BM_ARM_DETAILED_HAND 
  #if BM_ARM_RIGHT & BM_MANNEQUIN_DRIVER_HAND_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HAND_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver HandDriversRight ={
    AnyKinMeasure& CMC1Flexion = ..BodyModel.Interface.Right.CMCFlexion;
    AnyKinMeasure& CMC1Abduction = ..BodyModel.Interface.Right.CMCAbduction;
    AnyKinMeasure& MCP1Flexion = ..BodyModel.Interface.Right.MCPFlexion;
    AnyKinMeasure& MCP1Abduction = ..BodyModel.Interface.Right.MCPAbduction;
    AnyKinMeasure& DIP1 = ..BodyModel.Interface.Right.DIP;
    AnyKinMeasure& MCP2 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger2.Jnt.MCP;
    AnyKinMeasure& PIP2 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger2.Jnt.PIP;
    AnyKinMeasure& DIP2 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger2.Jnt.DIP;
    AnyKinMeasure& MCP3 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger3.Jnt.MCP;
    AnyKinMeasure& PIP3 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger3.Jnt.PIP;
    AnyKinMeasure& DIP3 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger3.Jnt.DIP;
    AnyKinMeasure& MCP4 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger4.Jnt.MCP;
    AnyKinMeasure& PIP4 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger4.Jnt.PIP;
    AnyKinMeasure& DIP4 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger4.Jnt.DIP;
    AnyKinMeasure& MCP5 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger5.Jnt.MCP;
    AnyKinMeasure& PIP5 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger5.Jnt.PIP;
    AnyKinMeasure& DIP5 = ..BodyModel.Right.ShoulderArm.Seg.Hand.Finger5.Jnt.DIP;    
    DriverPos ??=  pi/180*{
      .JntPos.Right.Finger1.CMCFlexion,
      .JntPos.Right.Finger1.CMCDeviation,
      .JntPos.Right.Finger1.MCPFlexion,
      .JntPos.Right.Finger1.MCPDeviation,
      .JntPos.Right.Finger1.DIPFlexion,
      .JntPos.Right.Finger2.MCPFlexion,
      .JntPos.Right.Finger2.PIPFlexion,
      .JntPos.Right.Finger2.DIPFlexion,
      .JntPos.Right.Finger3.MCPFlexion,
      .JntPos.Right.Finger3.PIPFlexion,
      .JntPos.Right.Finger3.DIPFlexion,
      .JntPos.Right.Finger4.MCPFlexion,
      .JntPos.Right.Finger4.PIPFlexion,
      .JntPos.Right.Finger4.DIPFlexion,
      .JntPos.Right.Finger5.MCPFlexion,
      .JntPos.Right.Finger5.PIPFlexion,
      .JntPos.Right.Finger5.DIPFlexion   
    };
    DriverVel ??=  pi/180*{
      .JntVel.Right.Finger1.CMCFlexion,
      .JntVel.Right.Finger1.CMCDeviation,
      .JntVel.Right.Finger1.MCPFlexion,
      .JntVel.Right.Finger1.MCPDeviation,
      .JntVel.Right.Finger1.DIPFlexion,
      .JntVel.Right.Finger2.MCPFlexion,
      .JntVel.Right.Finger2.PIPFlexion,
      .JntVel.Right.Finger2.DIPFlexion,
      .JntVel.Right.Finger3.MCPFlexion,
      .JntVel.Right.Finger3.PIPFlexion,
      .JntVel.Right.Finger3.DIPFlexion,
      .JntVel.Right.Finger4.MCPFlexion,
      .JntVel.Right.Finger4.PIPFlexion,
      .JntVel.Right.Finger4.DIPFlexion,
      .JntVel.Right.Finger5.MCPFlexion,
      .JntVel.Right.Finger5.PIPFlexion,
      .JntVel.Right.Finger5.DIPFlexion   
    };    
    Reaction = {Type ??=  repmat(.nDim, Off);};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif // BM_MANNEQUIN_DRIVER_HAND
  
  
  #if BM_ARM_LEFT & BM_MANNEQUIN_DRIVER_HAND_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HAND_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver HandDriversLeft ={
    AnyKinMeasure& CMC1Flexion = ..BodyModel.Interface.Left.CMCFlexion;
    AnyKinMeasure& CMC1Abduction = ..BodyModel.Interface.Left.CMCAbduction;
    AnyKinMeasure& MCP1Flexion = ..BodyModel.Interface.Left.MCPFlexion;
    AnyKinMeasure& MCP1Abduction = ..BodyModel.Interface.Left.MCPAbduction;
    AnyKinMeasure& DIP1 = ..BodyModel.Interface.Left.DIP;
    AnyKinMeasure& MCP2 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger2.Jnt.MCP;
    AnyKinMeasure& PIP2 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger2.Jnt.PIP;
    AnyKinMeasure& DIP2 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger2.Jnt.DIP;
    AnyKinMeasure& MCP3 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger3.Jnt.MCP;
    AnyKinMeasure& PIP3 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger3.Jnt.PIP;
    AnyKinMeasure& DIP3 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger3.Jnt.DIP;
    AnyKinMeasure& MCP4 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger4.Jnt.MCP;
    AnyKinMeasure& PIP4 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger4.Jnt.PIP;
    AnyKinMeasure& DIP4 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger4.Jnt.DIP;
    AnyKinMeasure& MCP5 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger5.Jnt.MCP;
    AnyKinMeasure& PIP5 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger5.Jnt.PIP;
    AnyKinMeasure& DIP5 = ..BodyModel.Left.ShoulderArm.Seg.Hand.Finger5.Jnt.DIP;    
    DriverPos ??=  pi/180*{
      .JntPos.Left.Finger1.CMCFlexion,
      .JntPos.Left.Finger1.CMCDeviation,
      .JntPos.Left.Finger1.MCPFlexion,
      .JntPos.Left.Finger1.MCPDeviation,
      .JntPos.Left.Finger1.DIPFlexion,
      .JntPos.Left.Finger2.MCPFlexion,
      .JntPos.Left.Finger2.PIPFlexion,
      .JntPos.Left.Finger2.DIPFlexion,
      .JntPos.Left.Finger3.MCPFlexion,
      .JntPos.Left.Finger3.PIPFlexion,
      .JntPos.Left.Finger3.DIPFlexion,
      .JntPos.Left.Finger4.MCPFlexion,
      .JntPos.Left.Finger4.PIPFlexion,
      .JntPos.Left.Finger4.DIPFlexion,
      .JntPos.Left.Finger5.MCPFlexion,
      .JntPos.Left.Finger5.PIPFlexion,
      .JntPos.Left.Finger5.DIPFlexion   
    };
    DriverVel ??=  pi/180*{
      .JntVel.Left.Finger1.CMCFlexion,
      .JntVel.Left.Finger1.CMCDeviation,
      .JntVel.Left.Finger1.MCPFlexion,
      .JntVel.Left.Finger1.MCPDeviation,
      .JntVel.Left.Finger1.DIPFlexion,
      .JntVel.Left.Finger2.MCPFlexion,
      .JntVel.Left.Finger2.PIPFlexion,
      .JntVel.Left.Finger2.DIPFlexion,
      .JntVel.Left.Finger3.MCPFlexion,
      .JntVel.Left.Finger3.PIPFlexion,
      .JntVel.Left.Finger3.DIPFlexion,
      .JntVel.Left.Finger4.MCPFlexion,
      .JntVel.Left.Finger4.PIPFlexion,
      .JntVel.Left.Finger4.DIPFlexion,
      .JntVel.Left.Finger5.MCPFlexion,
      .JntVel.Left.Finger5.PIPFlexion,
      .JntVel.Left.Finger5.DIPFlexion   
    };    
    Reaction = {Type ??=  repmat(.nDim, Off);};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif // BM_MANNEQUIN_DRIVER_HAND  
  
  #endif //Detailed hand
  
  
  
  
 
  // ************************************
  // Drivers for the right leg
  // ************************************
  
  #if BM_LEG_RIGHT == 1
  
   //Hip driver 
  #if BM_MANNEQUIN_DRIVER_HIP_FLEXION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HIP_FLEXION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver HipDriverRightFlexion={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Right.HipFlexion;
    DriverPos ??=  pi/180*{.JntPos.Right.HipFlexion};    
    DriverVel ??=  pi/180*{.JntVel.Right.HipFlexion};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_HIP_EXTERNAL_ROTATION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HIP_EXTERNAL_ROTATION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver HipDriverRightExternalRotation={
    AnyKinMeasure& ref2 =..BodyModel.Interface.Right.HipExternalRotation;
    DriverPos ??=  pi/180*{.JntPos.Right.HipExternalRotation};    
    DriverVel ??=  pi/180*{.JntVel.Right.HipExternalRotation};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_HIP_ABDUCTION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HIP_ABDUCTION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver HipDriverRightAbduction={
    AnyKinMeasure& ref3 =..BodyModel.Interface.Right.HipAbduction;
    DriverPos ??=  pi/180*{.JntPos.Right.HipAbduction};    
    DriverVel ??=  pi/180*{.JntVel.Right.HipAbduction};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
   
  //Knee driver
  #if BM_MANNEQUIN_DRIVER_KNEE_FLEXION_RIGHT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_KNEE_FLEXION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver KneeDriverRight={
    AnyKinMeasure  &Knee = ..BodyModel.Interface.Right.KneeFlexion;
    DriverPos ??=  pi/180*{.JntPos.Right.KneeFlexion};  
    DriverVel ??=  pi/180*{.JntVel.Right.KneeFlexion};  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  //Ankle driver
  #if BM_FOOT_MODEL == _FOOT_MODEL_DEFAULT_
  #if BM_MANNEQUIN_DRIVER_ANKLE_FLEXION_RIGHT 
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_ANKLE_FLEXION_RIGHT ON/OFF
  ///  
  AnyKinEqSimpleDriver AnkleDriverRightFlexion={
    AnyKinMeasure& ref1=..BodyModel.Interface.Right.AnklePlantarFlexion;
    DriverPos ??=  pi/180*{.JntPos.Right.AnklePlantarFlexion};  
    DriverVel ??=  pi/180*{.JntVel.Right.AnklePlantarFlexion};  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_LEG_RIGHT & (BM_LEG_MODEL == _LEG_MODEL_LEG_)
   #if BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_RIGHT
   /// Enabled/disabled with:
   /// #define BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_RIGHT ON/OFF
   ///  
   AnyKinEqSimpleDriver AnkleDriverRightEversion={
     AnyKinMeasure& ref2=..BodyModel.Interface.Right.AnkleEversion;
     DriverPos ??=  pi/180*{.JntPos.Right.SubTalarEversion};  
     DriverVel ??=  pi/180*{.JntVel.Right.SubTalarEversion};  
     Reaction = {Type ??=  {Off};};
     AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
     AnyFolder Weights = 
     {
       AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
     };
     WeightFun ??=  {&Weights.Fun};
     CType ??=  repmat(nDim, .DefaultDriverCType);
   };
   #endif
  #endif
 
  
  #if BM_LEG_RIGHT & BM_LEG_MODEL_IS_TLEM
   #if BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_RIGHT
   /// Enabled/disabled with:
   /// #define BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_RIGHT ON/OFF
   ///  
   AnyKinEqSimpleDriver AnkleDriverRightEversion={
     AnyKinMeasure& ref=..BodyModel.Interface.Right.SubTalarEversion;
     DriverPos ??=  pi/180*{.JntPos.Right.SubTalarEversion};  
     DriverVel ??=  pi/180*{.JntVel.Right.SubTalarEversion};  
     Reaction = {Type ??=  {Off};};
     AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
     AnyFolder Weights = 
     {
       AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
     };
     WeightFun ??=  {&Weights.Fun};
     CType ??=  repmat(nDim, .DefaultDriverCType);
    };
   #endif
  #endif
  
  #endif 
  
#endif
  

  // ************************************
  // Drivers for the Left leg
  // ************************************
  
  #if BM_LEG_LEFT == 1 
  
  //Left hip driver
  #if BM_MANNEQUIN_DRIVER_HIP_FLEXION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HIP_FLEXION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver HipDriverLeftFlexion={
    AnyKinMeasure& ref1 =..BodyModel.Interface.Left.HipFlexion;
    DriverPos ??=  pi/180*{.JntPos.Left.HipFlexion};    
    DriverVel ??=  pi/180*{.JntVel.Left.HipFlexion};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_HIP_EXTERNAL_ROTATION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HIP_EXTERNAL_ROTATION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver HipDriverLeftExternalRotation={
    AnyKinMeasure& ref2 =..BodyModel.Interface.Left.HipExternalRotation;
    DriverPos ??=  pi/180*{.JntPos.Left.HipExternalRotation};    
    DriverVel ??=  pi/180*{.JntVel.Left.HipExternalRotation};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  #if BM_MANNEQUIN_DRIVER_HIP_ABDUCTION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_HIP_ABDUCTION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver HipDriverLeftAbduction={
    AnyKinMeasure& ref3 =..BodyModel.Interface.Left.HipAbduction;
    DriverPos ??=  pi/180*{.JntPos.Left.HipAbduction};    
    DriverVel ??=  pi/180*{.JntVel.Left.HipAbduction};    
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  
  //Knee driver
  #if BM_MANNEQUIN_DRIVER_KNEE_FLEXION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_KNEE_FLEXION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver KneeDriverLeft={
    AnyKinMeasure& Knee =..BodyModel.Interface.Left.KneeFlexion;
    DriverPos ??=  pi/180*{.JntPos.Left.KneeFlexion   };  
    DriverVel ??=  pi/180*{.JntVel.Left.KneeFlexion   };  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  

  
 
  //Ankle driver
  #if BM_FOOT_MODEL == _FOOT_MODEL_DEFAULT_
  
  #if BM_MANNEQUIN_DRIVER_ANKLE_FLEXION_LEFT
  /// Enabled/disabled with:
  /// #define BM_MANNEQUIN_DRIVER_ANKLE_FLEXION_LEFT ON/OFF
  ///  
  AnyKinEqSimpleDriver AnkleDriverLeftFlexion={
    AnyKinMeasure& ref1=..BodyModel.Interface.Left.AnklePlantarFlexion;
    DriverPos ??=  pi/180*{.JntPos.Left.AnklePlantarFlexion};  
    DriverVel ??=  pi/180*{.JntVel.Left.AnklePlantarFlexion};  
    Reaction = {Type ??=  {Off};};
    AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
    AnyFolder Weights = 
    {
      AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
    };
    WeightFun ??=  {&Weights.Fun};
    CType ??=  repmat(nDim, .DefaultDriverCType);
  };
  #endif
  
  
  #if BM_LEG_LEFT & (BM_LEG_MODEL == _LEG_MODEL_LEG_)
   #if BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_LEFT
   /// Enabled/disabled with:
   /// #define BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_LEFT ON/OFF
   ///  
   AnyKinEqSimpleDriver AnkleDriverLeftEversion={
     AnyKinMeasure& ref2=..BodyModel.Interface.Left.AnkleEversion;
     DriverPos ??=  pi/180*{.JntPos.Left.SubTalarEversion};  
     DriverVel ??=  pi/180*{.JntVel.Left.SubTalarEversion};  
     Reaction = {Type ??=  {Off};};
     AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
     AnyFolder Weights = 
     {
       AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
     };
     WeightFun ??=  {&Weights.Fun};
     CType ??=  repmat(nDim, .DefaultDriverCType);
   };
   #endif
  #endif

  #if BM_LEG_LEFT & BM_LEG_MODEL_IS_TLEM
  
   #if BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_LEFT
   /// Enabled/disabled with:
   /// #define BM_MANNEQUIN_DRIVER_ANKLE_SUBTALAR_EVERSION_LEFT ON/OFF
   ///  
   AnyKinEqSimpleDriver AnkleDriverLeftEversion={
     AnyKinMeasure& ref2=..BodyModel.Interface.Left.SubTalarEversion;
     DriverPos ??=  pi/180*{.JntPos.Left.SubTalarEversion};  
     DriverVel ??=  pi/180*{.JntVel.Left.SubTalarEversion};  
     Reaction = {Type ??=  {Off};};
     AnyVar WeakDriverWeight ??=  .DefaultWeakDriverWeight;
     AnyFolder Weights = 
     {
       AnyFunConst Fun = { Value ??=  repmat(..nDim, ..WeakDriverWeight);  };
     };
     WeightFun ??=  {&Weights.Fun};
     CType ??=  repmat(nDim, .DefaultDriverCType);
   };
   #endif
  #endif
  
  #endif
  
  #endif
  
  
};