[38ba34]: / Body / AAUHuman / Arm / Interface.any

Download this file

511 lines (420 with data), 14.1 kB

//This file is used for making a interface to the dof of the arm
//the added rotnodes are needed to be able to have the same rotation definitions for 
//the right and left side

AnyKinMeasureOrg SternoClavicularProtraction ={
  
  AnyRefNode &thorax  = ..ShoulderRef.scj;
  thorax={
    AnyRefNode RotNode={ARel={{1,0,0},{0,....Sign*1,0},{0,0,....Sign*1}};};
  };
  AnyFolder &clavicula=..Seg.Clavicula.scj ;
  clavicula={
    AnyRefNode RotNode={ ARel={{....Sign*1,0,0},{0,1,0},{0,0,....Sign*1}};};
  };
  
  AnyKinRotational SCRot = {
    AnyRefNode &thorax_sc = ...ShoulderRef.scj.RotNode;
    AnyRefNode &clavicula_sc = ...Seg.Clavicula.scj.RotNode;    
    Type = RotAxesAngles;
    Axis1 = y;
    Axis2 = z;
    Axis3 = x;
  };
  MeasureOrganizer ={0};
};

AnyKinMeasureOrg SternoClavicularElevation ={
  AnyKinRotational &ref=.SternoClavicularProtraction.SCRot;
  MeasureOrganizer ={1};
};

AnyKinMeasureOrg SternoClavicularAxialRotation ={
  AnyKinRotational &ref=.SternoClavicularProtraction.SCRot;
  MeasureOrganizer ={2};
};



AnyFolder SternoClavicular =
{
  ///^ Follows the ISB recommendations for definitions of joint coordinate systems of the Sterno Clavicula Joint
  ///^ See section 2.4.2 in https://doi.org/10.1016/j.jbiomech.2004.05.042

AnyKinMeasureLinComb Protraction ={
    
     AnyRefNode &thorax  = ...ShoulderRef.scj;
     thorax={
       AnyRefNode ISB_Coord={ARel={{0,0,1},{0,1,0},{-1,0,0}};};
     };
    
    AnyKinRotational SCRot = {
      AnyRefNode &thorax_sc = .thorax.ISB_Coord;
      AnyRefNode &clavicula_sc = ....Seg.Clavicula.AnatomicalFrame.ISB_Coord;    
      Type = RotAxesAngles;
      Axis1 = y;
      Axis2 = x;
      Axis3 = z;
    };
    OutDim = 1;
    Coef = {{...Sign*1,0,0}};
  };

  AnyKinMeasureLinComb Elevation ={
    AnyKinRotational &ref=.Protraction.SCRot;
       OutDim = 1;
       Coef = {{0,...Sign*-1,0}};
  };

  AnyKinMeasureLinComb BackwardAxialRotation ={
    AnyKinRotational &ref=.Protraction.SCRot;
       OutDim = 1;
       Coef = {{0,0,1}};
  };

};



AnyFolder AcromioClavicular = 
{
  //^ Follows the ISB recommendations for definitions of joint coordinate systems of the Acromio-clavicula joint
  //^ See section 2.4.3 in https://doi.org/10.1016/j.jbiomech.2004.05.042

  AnyKinMeasureLinComb Protraction ={
     
     AnyFolder& Calvicula = ...Seg.Clavicula;
     Calvicula.AnatomicalFrame = { 
       AnyRefNode ISB_Coord ={ ARel={{0, 0,......Sign*1}, {0, ......Sign*1,0}, {-1, 0,0}};};
     };
     
     AnyFolder& Scapula = ...Seg.Scapula;
     Scapula.AnatomicalFrame = {
       AnyRefNode ISB_Coord = {ARel={{ 0, 0,......Sign*1}, { 0, ......Sign*1,0}, {-1, 0,0}}; };
     };
     Calvicula.acj = {
          AnyRefNode RotNode={ ARel={{......Sign*1,0,0},  {0,1,0},      {0,0,......Sign*1}};};
       };
     Scapula.acj = {
          AnyRefNode RotNode={ ARel={{......Sign*1,0,0},  {0,1,0},      {0,0,......Sign*1}};};
       };
     
     AnyKinRotational ACRot = {
       AnyRefNode &clavicula = .Calvicula.AnatomicalFrame.ISB_Coord;    
       AnyRefNode &scapula = .Scapula.AnatomicalFrame.ISB_Coord;
       Type = RotAxesAngles;
       Axis1 = y;
       Axis2 = x;
       Axis3 = z;
     };
     OutDim = 1;
     Coef = {{...Sign*1,0,0}};
   };
   
   AnyKinMeasureLinComb MedialRotation ={
     AnyKinRotational &ref=.Protraction.ACRot;
     OutDim = 1;
     Coef = {{0,...Sign*1,0}};  
   };
   
   AnyKinMeasureLinComb PosteriorTilt ={
     AnyKinRotational &ref=.Protraction.ACRot;
     OutDim = 1;
     Coef = {{0,0,1}};  
   };
};

AnyFolder ScapulaHumerus = 
{
  //^ Follows the ISB recommendations for definitions of joint coordinate systems of the Acromio-clavicula joint
  //^ See section 2.4.4 in https://doi.org/10.1016/j.jbiomech.2004.05.042
  
   AnyKinMeasureLinComb PlaneOfElevation ={
     
     AnyFolder& Humerus = ...Seg.Humerus.AnatomicalFrame;
     Humerus = {
       AnyRefNode ISB_Coord = {ARel={{ 0, 0, 1}, { 0, 1,0}, {-1, 0,0}}; };
     };
     AnyKinRotational GHRot = {
       AnyRefNode &scapula = ....Seg.Scapula.AnatomicalFrame.ISB_Coord;
       AnyRefNode &Humerus = .Humerus.ISB_Coord;
       Type = RotAxesAngles;
       Axis1 = y;
       Axis2 = x;
       Axis3 = y;
     };
     OutDim = 1;
     Coef = {{...Sign*1,0,0}};
   };
   
   AnyKinMeasureLinComb Elevation ={
     AnyKinRotational &ref=.PlaneOfElevation.GHRot;
     OutDim = 1;
     Coef = {{0,...Sign*-1,0}};  
   };
   
   AnyKinMeasureLinComb InternalAxialRotation ={
     AnyKinRotational &ref=.PlaneOfElevation.GHRot;
     OutDim = 1;
     Coef = {{0,0,...Sign*1}};  
   };
};

AnyFolder ThoraxScapula = 
{
  //^ Follows the ISB recommendations for definitions of joint coordinate systems of the scapula relative to thorax
  //^ See section 2.4.6 in https://doi.org/10.1016/j.jbiomech.2004.05.042
  
   AnyKinMeasureLinComb Protraction ={
        
     AnyKinRotational ACRot = {
       AnyRefNode &thorax = ....ShoulderRef.scj.ISB_Coord;    
       AnyRefNode &scapula = ....Seg.Scapula.AnatomicalFrame.ISB_Coord;
       Type = RotAxesAngles;
       Axis1 = y;
       Axis2 = x;
       Axis3 = z;
     };
     OutDim = 1;
     Coef = {{...Sign*1,0,0}};
   };
   
   AnyKinMeasureLinComb MedialRotation ={
     AnyKinRotational &ref=.Protraction.ACRot;
     OutDim = 1;
     Coef = {{0,...Sign*1,0}};  
   };
   
   AnyKinMeasureLinComb PosteriorTilt ={
     AnyKinRotational &ref=.Protraction.ACRot;
     OutDim = 1;
     Coef = {{0,0,1}};  
   };
};


AnyFolder ThoraxHumerus = 
{
  //^ Follows the ISB recommendations for definitions of joint coordinate systems of the Humerus relative to Thorax
  //^ See section 2.4.7 in https://doi.org/10.1016/j.jbiomech.2004.05.042   
   
  AnyKinMeasureOrg PlaneOfElevation ={
    AnyRefNode& ThoraxShoulderISB = ...ShoulderRef.scj.ISB_Coord;    
    AnyRefNode& HumerusISB = ...Seg.Humerus.AnatomicalFrame.ISB_Coord;
    
    AnyRefNode& ShoulderNodeRef  = ...ShoulderRef;
    AnyFolder& gh=...Seg.Humerus.gh ;
    
    ThoraxShoulderISB = {
      AnyRefNode RotNodeElevPlane={ARel={{.....Sign*-1,0,0},{0,.....Sign*1,0},{0,0,-1}};};
    };
    HumerusISB = {
      AnyRefNode RotNodeElevPlane={ARel={{.....Sign*-1,0,0},{0,.....Sign*1,0},{0,0,-1}}; };
    };  
    
    AnyKinRotational GHRot = {
      AnyRefNode& ref1  = .ThoraxShoulderISB.RotNodeElevPlane;
      AnyRefNode& ref2  = .HumerusISB.RotNodeElevPlane;
  
      Type = RotAxesAngles;
      Axis1 = y;
      Axis2 = x;
      Axis3 = y;
    };
    MeasureOrganizer = {0};
  };

   AnyKinMeasureOrg Elevation ={
    AnyKinRotational& ref=.PlaneOfElevation.GHRot;
    MeasureOrganizer = {1};
   };
  
  AnyKinMeasureOrg InternalAxialRotation ={
    AnyKinRotational& ref=.PlaneOfElevation.GHRot;
    MeasureOrganizer ={2};
  };

};

AnyKinMeasureOrg ScapulaThoraxProtraction = 
{
  AnyRefFrame &Scapula = ..Seg.Scapula;
  Scapula = {
    AnyRefNode RotNode={ARel={{....Sign*1,0,0},{0,....Sign*1,0},{0,0,1}};};
  };
  MeasureOrganizer = {0};
  AnyKinRotational Rot = 
  {
    Type = RotAxesAngles;
    Axis1 = y;
    Axis2 = z;
    Axis3 = x;
    AnyRefFrame &Thorax = ...ShoulderRef;
    AnyRefFrame &Scapula = ...Seg.Scapula.RotNode;
  };
};

AnyKinMeasureOrg ScapulaThoraxElevation = 
{
  MeasureOrganizer = {1};
  AnyKinRotational &Rot = .ScapulaThoraxProtraction.Rot;
};




AnyKinMeasureOrg GlenohumeralFlexion ={
  AnyRefNode &ShoulderNodeRef  = ..ShoulderRef;
  ShoulderNodeRef={
    AnyRefNode RotNode={ARel={{0,0,1},{0,....Sign*-1,0},{....Sign*1,0,0}};
    };
  };
  AnyFolder &gh=..Seg.Humerus.gh ;
  gh ={
    AnyRefNode RotNode={
      ARel=.ARel*{{0,0,1},{0,....Sign*-1,0},{....Sign*1,0,0}};
    };
  };
  AnyKinRotational GHMeasure ={
    AnyRefNode &ref1  = ...ShoulderRef.RotNode;
    AnyRefNode &ref2  = ...Seg.Humerus.gh.RotNode;
 
    Type=RotAxesAngles;
    Axis1=x;
    Axis2=z;
    Axis3=y;
    
  };
  MeasureOrganizer ={1};

 
};

AnyKinMeasureOrg GlenohumeralExternalRotation ={
  AnyKinRotational &ref=.GlenohumeralFlexion.GHMeasure;
  MeasureOrganizer ={2};
};
AnyKinMeasureOrg GlenohumeralAbduction ={
  AnyKinRotational &ref=.GlenohumeralFlexion.GHMeasure;
  MeasureOrganizer ={0};
};




AnyKinMeasureOrg GlenohumeralFlexionJntMus ={
  AnyRefNode &Scapula  = ..Seg.Scapula.gh ;
  Scapula={
    AnyRefNode RotNode={
      ARel={{0,0,....Sign*1},{0,-1,0},{....Sign*1,0,0}};
    };
  };
  AnyKinRotational GHMeasure ={
    AnyRefNode &ref1  = ...Seg.Scapula.gh.RotNode;
    AnyRefNode &ref2  = ...Seg.Humerus.gh.RotNode;
 
    AngVelOnOff = On;
    Type=RotAxesAngles;
//    Axis1=x;
//    Axis2=z;
//    Axis3=y;
// The measure is now a xyz vector
    
  };
  MeasureOrganizer ={2};
};

AnyKinMeasureOrg GlenohumeralExternalRotationJntMus ={
  AnyKinRotational &ref=.GlenohumeralFlexionJntMus.GHMeasure;
  MeasureOrganizer ={1};
};
AnyKinMeasureOrg GlenohumeralAbductionJntMus ={
  AnyKinRotational &ref=.GlenohumeralFlexionJntMus.GHMeasure;
  MeasureOrganizer ={0};
};







AnyKinMeasureOrg ElbowFlexion= {
  AnyFolder &humerus=..Seg.Humerus.fe ;
  humerus ={
    AnyRefNode RotNode={ 
      ARel=.ARel*{{1,0,0},{0,....Sign*-1,0},{0,0,....Sign*-1}};
    };
  };
  AnyFolder &ulna=..Seg.Ulna.fe ;
  ulna ={
    AnyRefNode RotNode={ 
      ARel=.ARel*{{....Sign*-1,0,0},{0,1,0},{0,0,....Sign*-1}};
    };
  };
  AnyKinRotational  Rot= {
    AnyRefNode &HumerusFE = ...Seg.Humerus.fe.RotNode;
    AnyRefNode &UlnaFE = ...Seg.Ulna.fe.RotNode;
    Type=RotAxesAngles;
  };
  MeasureOrganizer={2}; //this cooresponds to x  (remember z y x is default)
  
};


AnyKinMeasureOrg ElbowPronation={
  
  AnyFolder &ulna=..Seg.Ulna.ps2 ;
  ulna ={
    AnyRefNode RotNode={ 
      ARel={{0,1,0},{-....Sign*1,0,0},{0,0,....Sign*1}};
    };
  };
  AnyFolder &radius=..Seg.Radius.PointPS2;
  radius ={
    AnyRefNode RotNode={ 
      ARel=RotMat(-....Sign*30*pi/180,x)*{{....Sign*1,0,0},{0,....Sign*1,0},{0,0,1}};
    };
  };
  
  AnyKinRotational PSRotProximal = {
    Type = RotAxesAngles;
    AnyRefNode &UlnaPs = ...Seg.Ulna.ps2.RotNode;
    AnyRefNode &RadiusPs = ...Seg.Radius.PointPS2.RotNode;
    
  };//End pronation supination joint proximal
  MeasureOrganizer = {2}; //this cooresponds to x  (remember z y x is default)
  
  
  
};


//Definition of wrist joint
AnyKinMeasureOrg WristFlexion ={
  AnyFolder &radius=..Seg.Radius.wj;
  radius ={
    AnyRefNode RotNode={ 
      ARel={{....Sign*1,0,0},{0,-1,0},{0,0,....Sign*-1}};
    };
  };
  AnyFolder &WristJointSeg= ..Seg.WristJointSeg.FlexionExtensionAxis;
  WristJointSeg ={
    AnyRefNode RotNode={ 
      ARel={{....Sign*1,0,0},{0,-1,0},{0,0,....Sign*-1}};
    };
  };
  
  AnyKinRotational WristJoint = {
    Type=RotAxesAngles;
    AnyRefNode &radius_wj = ...Seg.Radius.wj.RotNode;
    AnyRefNode &hand_wj = ...Seg.WristJointSeg.FlexionExtensionAxis.RotNode;
  };//End WristJoint
  MeasureOrganizer ={1};
};


AnyKinMeasureOrg WristAbduction ={
  MeasureOrganizer ={0};
  
  
  AnyFolder &WristJointSeg=..Seg.WristJointSeg.RadialUlnarDeviation;
  WristJointSeg ={
    AnyRefNode RotNode={ 
      ARel={{....Sign*1,0,0},{0,1,0},{0,0,....Sign*1}};
    };
  };
  AnyFolder &HandSeg= ..Seg.Hand.HandRef.wj;
  HandSeg ={
    AnyRefNode RotNode={ 
      ARel={{....Sign*1,0,0},{0,1,0},{0,0,....Sign*1}};
    };
  };  
  AnyKinRotational WristJoint = {
    Type=RotAxesAngles;
    AnyRefNode &radius_wj = ...Seg.WristJointSeg.RadialUlnarDeviation.RotNode;
    AnyRefNode &hand_wj =...Seg.Hand.HandRef.wj.RotNode;
  };//End WristJoint

};

/// RotVec based measures of joint angles. These measures are used for 
/// exporting and importing joint angles. They do not make sense from 
/// clinical point of view. 
RotVectorMeasures = 
{
    AnyKinRotational ThoraxClavicula = 
    {
       Type = RotVector;
       AnyRefFrame &ref1 = ...ShoulderRef.scj.RotNode;
       AnyRefFrame &ref2 = ...Seg.Clavicula.scj.RotNode;
    };  
    AnyKinRotational ClaviculaScapula = 
    {
       Type = RotVector;
       AnyRefFrame &ref1 = ...Seg.Clavicula.acj.RotNode;
       AnyRefFrame &ref2 = ...Seg.Scapula.acj.RotNode;
    };  
    AnyKinRotational ScapulaHumerus = 
    {
       Type = RotVector;
       AnyRefFrame &ref1 = ...Seg.Scapula.gh.RotNode;
       AnyRefFrame &ref2 = ...Seg.Humerus.gh.RotNode;
    };
    AnyKinMeasureOrg HumerusUlna = {
      AnyKinRotational rot = 
      {
         Type = RotVector;
         AnyRefFrame &ref1 = ....Seg.Humerus.fe.RotNode;
         AnyRefFrame &ref2 = ....Seg.Ulna.fe.RotNode;
      };
      MeasureOrganizer = {0}; 
    };
    AnyKinMeasureOrg UlnaRadius = {
      AnyKinRotational rot = 
      {
         Type = RotVector;
         AnyRefFrame &ref1 = ....Seg.Ulna.ps2.RotNode;
         AnyRefFrame &ref2 = ....Seg.Radius.PointPS2.RotNode;
      };
      MeasureOrganizer = {0}; 
    };
    AnyKinMeasureOrg RadiusWrist = {
      AnyKinRotational rot = 
      {
         Type = RotVector;
         AnyRefFrame &ref1 = ....Seg.Radius.wj.RotNode;
         AnyRefFrame &ref2 = ....Seg.WristJointSeg.FlexionExtensionAxis.RotNode;
      };
      MeasureOrganizer = {1}; 
    };
    AnyKinMeasureOrg WristHand = {
      AnyKinRotational rot = 
      {
         Type = RotVector;
         AnyRefFrame &ref1 = ....Seg.WristJointSeg.RadialUlnarDeviation.RotNode;
         AnyRefFrame &ref2 = ....Seg.Hand.HandRef.wj.RotNode;
      };
      MeasureOrganizer = {2}; 
    };
    
    
  };


#if !((BM_ARM_RIGHT & BM_ARM_DETAILED_HAND) | (BM_ARM_LEFT & BM_ARM_DETAILED_HAND))
AnyRefNode &GloveContactNode =.Seg.Glove.ContactNode;
AnyRefNode  &WristContactNode=.Seg.Glove.WristContactNode;
AnyRefNode  &PalmLateralContactNode=.Seg.Glove.PalmLateralContactNode;
AnyRefNode  &PalmMedialContactNode=.Seg.Glove.PalmMedialContactNode;
#endif