[bfdf16]: / Tests / ModelUtilities / test_rhythmclass.any

Download this file

324 lines (265 with data), 9.1 kB

#include "../libdef.any"


Main = {


  AnyOperationSequence RunTest = {
     AnyOperation& s1 = Main.study1.Kinematics;
     AnyOperation& s2 = Main.study2.Kinematics;
     AnyOperation& s3 = Main.study3.Kinematics;
     AnyOperation& s4 = Main.study4.Kinematics;
     AnyOperation& s5 = Main.study5.Kinematics; 
     AnyOperation& s6 = Main.study6.Kinematics; 
  };
  
  AnyFolder Rhythms = 
  {
     // With input with measure organizer
     RhythmDriverLinear r1 =
     {
       RhythmCoefficients = {0.9, 0.9, 0.2, 0.9};
       
       Measures.Input = {
          AnyKinMeasure& jg = Main.Model.j_ground;
          AnyKinMeasure& j1 = Main.Model.j1;
          AnyKinMeasure& j2 = Main.Model.j2;
          AnyKinMeasure& j3 = Main.Model.j3;
          MeasureOrganizer = {2,5,8,11};
       };
     
     };
     // Simple input without a measure organizer
     RhythmDriverLinear r2 =
     {
       RhythmCoefficients = {0.9, 0.9, 0, 0.9};
       Measures.Input = {
          AnyKinMeasureOrg ZRot = {
              AnyKinMeasure& jg = Main.Model.j_ground;
              AnyKinMeasure& j1 = Main.Model.j1;
              AnyKinMeasure& j2 = Main.Model.j2;
              AnyKinMeasure& j3 = Main.Model.j3;
              MeasureOrganizer = {2,5,8,11};
         };
       };
     };
   
     // Explicit formulation with respect to one of the DOF and zero weights.
     RhythmDriverLinear r3(RELATIVE_TO_DOF=1) =
     {
       RhythmCoefficients = {0.9, 0.9, 0, 0.9};
       Measures.Input = {
          AnyKinMeasureOrg ZRot = {
              AnyKinMeasure& jg = Main.Model.j_ground;
              AnyKinMeasure& j1 = Main.Model.j1;
              AnyKinMeasure& j2 = Main.Model.j2;
              AnyKinMeasure& j3 = Main.Model.j3;
              MeasureOrganizer = {2,5,8,11};
         };
       };
     };
     
     
     // Two way rhythm dirver with implicit formulation
     RhythmDriverBiLinear r4(NDIM=4) =
     {
       RhythmCoefficients = {0.2, 1, 1, 0.2};
       RhythmCoefficientsNegative = {0.2, 0.2, 1, 1};

       Measures.Input = {
          AnyKinMeasureOrg ZRot = {
              AnyKinMeasure& jg = Main.Model.j_ground;
              AnyKinMeasure& j1 = Main.Model.j1;
              AnyKinMeasure& j2 = Main.Model.j2;
              AnyKinMeasure& j3 = Main.Model.j3;
              MeasureOrganizer = {2,5,8,11};
         };
       };
     };
     
     // Two way rhythm dirver with explicit formulation
     RhythmDriverBiLinear r5(NDIM=4, RELATIVE_TO_DOF=2) =
     {
       RhythmCoefficients = {0.1, 1, 1, 0.1};
       RhythmCoefficientsNegative = {0.1, 0.1, 1, 1};
       
       TransitionInterval = 0.5;
       
       Measures.Input = {
          AnyKinMeasureOrg ZRot = {
              AnyKinMeasure& jg = Main.Model.j_ground;
              AnyKinMeasure& j1 = Main.Model.j1;
              AnyKinMeasure& j2 = Main.Model.j2;
              AnyKinMeasure& j3 = Main.Model.j3;
              MeasureOrganizer = {2,5,8,11};
         };
       };
     };
     
     // Two way rhythm dirver with explicit formulation and input measure organizer
     RhythmDriverBiLinear r6(NDIM=4, RELATIVE_TO_DOF=2) =
     {
       RhythmCoefficients = {0.0001, 1, 1, 0.0001};
       RhythmCoefficientsNegative = {0.0001, 0.0001, 1, 1};
       
       TransitionInterval = 0.1;
       
       Measures.Input = {
          AnyKinMeasureOrg ZRot = {
              AnyKinMeasure& jg = Main.Model.j_ground;
              AnyKinMeasure& j1 = Main.Model.j1;
              AnyKinMeasure& j2 = Main.Model.j2;
              AnyKinMeasure& j3 = Main.Model.j3;
         };
         MeasureOrganizer = {2,5,8,11};
       };
     };
     
  
  };
  
  
  
  
  
  
  
  
  
  

  AnyKinStudy study1 = {
     tEnd=1;
     nStep=50;
     AnyFolder& Model = Main.Model;
     AnyFolder& Rhythm = Main.Rhythms.r1;
  };
  
  AnyKinStudy study2 = {
     tEnd=1;
     nStep=50;
     AnyFolder& Model = Main.Model;
     AnyFolder& Rhythm = Main.Rhythms.r2;
  };
  
  AnyKinStudy study3 = {
     tEnd=1;
     nStep=50;
     AnyFolder& Model = Main.Model;
     AnyFolder& Rhythm = Main.Rhythms.r3;
  };
  
  AnyKinStudy study4 = {
     tEnd=1;
     nStep=50;
     AnyFolder& Model = Main.Model;
     AnyFolder& Rhythm = Main.Rhythms.r4;
  };
  
  AnyKinStudy study5 = {
     tEnd=1;
     nStep=50;
     AnyFolder& Model = Main.Model;
     AnyFolder& Rhythm = Main.Rhythms.r5;
  };
  
  AnyKinStudy study6 = {
     tEnd=1;
     nStep=50;
     AnyFolder& Model = Main.Model;
     AnyFolder& Rhythm = Main.Rhythms.r6;
  };

  
  AnyFolder Model = {
    
    AnyFixedRefFrame Ground = {
      viewRefFrame.Visible=On;
      
    };
    
    
    AnyKinMotion EndDriver = {
      AnyKinMeasureOrg ref  = {
        AnyKinMeasure& ref = Main.Model.Measures.EndMeasure;
        MeasureOrganizer = {2};
      };
      DriverPos0 = {-1};
      DriverVel0 = {2};
    };
    
    

    
    AnySeg s1 = {
      r0 = 1*{3,0,0}-{1.5,0,0};
      viewInertia.Visible=On;
      Mass = 2;
      Jii = {0.05, 1, 1};
      AnyRefNode n1 = {sRel={-1.5,0,0};viewRefFrame.Visible=On;};
      AnyRefNode n2 = {sRel={1.5,0,0};viewRefFrame.Visible=On;};
    };
    AnySeg s2 = {
      r0 = 2*{3,0,0}-{1.5,0,0};
      viewInertia.Visible=On;
      Mass = 2;
      Jii = {0.05, 1, 1};
      AnyRefNode n1 = {sRel={-1.5,0,0};viewRefFrame.Visible=On;};
      AnyRefNode n2 = {sRel={1.5,0,0};viewRefFrame.Visible=On;};
    };
    AnySeg s3 = {
      r0 = 3*{3,0,0}-{1.5,0,0};
      viewInertia.Visible=On;
      Mass = 2;
      Jii = {0.05, 1, 1};
      AnyRefNode n1 = {sRel={-1.5,0,0};viewRefFrame.Visible=On;};
      AnyRefNode n2 = {sRel={1.5,0,0};viewRefFrame.Visible=On;};
    };
    AnySeg s4 = {
      r0 = 4*{3,0,0}-{1.5,0,0};
      viewInertia.Visible=On;
      Mass = 2;
      Jii = {0.05, 1, 1};
      AnyRefNode n1 = {sRel={-1.5,0,0};viewRefFrame.Visible=On;};
      AnyRefNode n2 = {sRel={1.5,0,0};viewRefFrame.Visible=On;};
    };
    
    AnySphericalJoint j_ground ={
      viewJoint.Visible= On;
      AnyRefFrame& r1 = .Ground;
      AnyRefFrame& r2 = .s1.n1;
      Orientation.Axis1 = .Measures.EndMeasure.Axis1;
      Orientation.Axis2 = .Measures.EndMeasure.Axis2;
      Orientation.Axis3 = .Measures.EndMeasure.Axis3;
      Orientation.Type = .Measures.EndMeasure.Type;
    };
    AnySphericalJoint j1 ={
      viewJoint.Visible= On;
      AnyRefFrame& r1 = .s1.n2;
      AnyRefFrame& r2 = .s2.n1;
      Orientation.Axis1 = .Measures.EndMeasure.Axis1;
      Orientation.Axis2 = .Measures.EndMeasure.Axis2;
      Orientation.Axis3 = .Measures.EndMeasure.Axis3;
      Orientation.Type = .Measures.EndMeasure.Type;
    };
    AnySphericalJoint j2 ={
      viewJoint.Visible= On;
      AnyRefFrame& r1 = .s2.n2;
      AnyRefFrame& r2 = .s3.n1;
      Orientation.Axis1 = .Measures.EndMeasure.Axis1;
      Orientation.Axis2 = .Measures.EndMeasure.Axis2;
      Orientation.Axis3 = .Measures.EndMeasure.Axis3;
      Orientation.Type = .Measures.EndMeasure.Type;
    };
    AnySphericalJoint j3 ={
      viewJoint.Visible= On;
      AnyRefFrame& r1 = .s3.n2;
      AnyRefFrame& r2 = .s4.n1;
      Orientation.Axis1 = .Measures.EndMeasure.Axis1;
      Orientation.Axis2 = .Measures.EndMeasure.Axis2;
      Orientation.Axis3 = .Measures.EndMeasure.Axis3;
      Orientation.Type = .Measures.EndMeasure.Type;
    };
    
    AnyFolder Measures = {
      AnyKinRotational EndMeasure = {
        AnyRefFrame& r1 = ..Ground;
        AnyRefFrame& r2 = ..s4.n2;
        //               Axis1 =x;
        //               Axis2 =y;
        //               Axis3= z;
        //              Type = RotAxesAngles;
        Type=RotVector;
      };
      
      AnyKinMeasureOrg yrot = {
        AnyKinMeasureOrg joints = {
          AnyKinMeasure& jg = ...j_ground;
          AnyKinMeasure& j1 = ...j1;
          AnyKinMeasure& j2 = ...j2;
          AnyKinMeasure& j3 = ...j3;       
        };
        MeasureOrganizer = {1,4,7,10};
      };
      AnyKinMeasureOrg xrot = {
        AnyKinMeasureOrg joints = {
          AnyKinMeasure& jg = ...j_ground;
          AnyKinMeasure& j1 = ...j1;
          AnyKinMeasure& j2 = ...j2;
          AnyKinMeasure& j3 = ...j3;       
        };
        MeasureOrganizer = {0,3,6,9};
      };
      AnyKinMeasureOrg zrot = {
        AnyKinMeasureOrg joints = {
          AnyKinMeasure& jg = ...j_ground;
          AnyKinMeasure& j1 = ...j1;
          AnyKinMeasure& j2 = ...j2;
          AnyKinMeasure& j3 = ...j3;       
        };
        MeasureOrganizer = {2,5,8,11};
      };
      
    };
    AnyKinEq FixYRot = {
      AnyKinMeasureOrg& ref = .Measures.yrot;
    };
    AnyKinEq FixXRot = {
      AnyKinMeasureOrg& ref = .Measures.xrot;
    };
    //       AnyKinEq FixZRot = {
    //         AnyKinMeasureOrg& ref = .Measures.zrot;
    //       };
    
    
  };








};