Commits

Jody McAdams  committed 5dc7521

perfected the walk cycle

  • Participants
  • Parent commits 99d10bb

Comments (0)

Files changed (1)

File Experimental/MicroHorse/MicroHorse.ino

 #include <MathUtil.h>
 #include <Animation.h>
 
+#define DEBUG_RESET 0
+
 Animation* upperLegServoAnimFR;
 Animation* upperLegServoAnimFL;
 Animation* upperLegServoAnimBR;
 Animation* lowerLegServoAnimBR;
 Animation* lowerLegServoAnimBL;
 
-const float overallMovement = 0.6f;
+const float overallMovement = 1.0f;
 
-const float animSpeed = 3.5f;
+const float animSpeed = 3.0f;
 
-const float rightSideOffset = 3.5f*0.50f;
+const float backLegOffset = 0.8f;
+
+const float rightSideOffset = 3.5f*0.5f;
 
 const Animation::AnimMode upperLegMode = Animation::AnimMode_Wrap;
 const Animation::AnimMode lowerLegMode = Animation::AnimMode_Wrap;
 //Top
 
 //Front
-const int numUpperLegAnimValuesF = 5;
-Animation::KeyFrame upperLegAnimValuesF[numUpperLegAnimValuesF] = {{0.0f,-55},{1.0f,40},{2.2f,40},{3.1f,-55},{3.5f,-55}};
+const int numUpperLegAnimValuesF = 4;
+Animation::KeyFrame upperLegAnimValuesF[numUpperLegAnimValuesF] = {{0.0f,30},{1.0f,-55},{2.1f,0},{3.5f,30}};
 //Back
 const int numUpperLegAnimValuesB = 4;
-Animation::KeyFrame upperLegAnimValuesB[numUpperLegAnimValuesB] = {{0.0f,-50},{1.0f,35},{2.0f,-70},{3.5f,-50}};
+Animation::KeyFrame upperLegAnimValuesB[numUpperLegAnimValuesB] = {{0.0f,30},{1.0f,-55},{2.1f,0},{3.5f,30}};
 
 //Bottom
 
 //Front
 const int numLowerLegAnimValuesF = 5;
-Animation::KeyFrame lowerLegAnimValuesF[numLowerLegAnimValuesF] = {{0.0f,-15},{0.2f,-15},{2.0f,0},{2.8,90},{3.5f,-15}};
+Animation::KeyFrame lowerLegAnimValuesF[numLowerLegAnimValuesF] = {{0.0f,0},{1.0f,90},{1.25f,-30},{2.0f,0},{3.5f,0}};
 
 //Back
-const int numLowerLegAnimValuesB = 4;
-Animation::KeyFrame lowerLegAnimValuesB[numLowerLegAnimValuesB] = {{0.0f,-15},{1.0f,0},{1.5f,90},{3.5f,-15}};
+const int numLowerLegAnimValuesB = 5;
+Animation::KeyFrame lowerLegAnimValuesB[numLowerLegAnimValuesB] = {{0.0f,0},{1.0f,90},{1.25f,-30},{2.0f,0},{3.5f,0}};
 
 Servo servoUpperFR;
 Servo servoUpperFL;
   upperLegServoAnimBR->animSpeed = animSpeed;
   lowerLegServoAnimBR->animSpeed = animSpeed;
   
+  //Left legs
+  upperLegServoAnimBL->currT += backLegOffset;
+  lowerLegServoAnimBL->currT += backLegOffset;
+
+  //Right legs
+  upperLegServoAnimBR->currT += backLegOffset;
+  lowerLegServoAnimBR->currT += backLegOffset;
+  
   servoUpperFR.attach(4);
   servoUpperFL.attach(5);
   servoUpperBR.attach(6);
   topBackLeftAnimVal += 90.0f;
   bottomBackLeftAnimVal += 90.0f;  
   
-  //Set servo values from animations
+ #if !DEBUG_RESET
+   //Set servo values from animations
   servoUpperFR.write(topFrontRightAnimVal);
   servoLowerFR.write(bottomFrontRightAnimVal);
   servoUpperBR.write(topBackRightAnimVal);
   servoLowerFL.write(bottomFrontLeftAnimVal);
   servoUpperBL.write(topBackLeftAnimVal);
   servoLowerBL.write(bottomBackLeftAnimVal);
+ #endif
+  
 }