Commits

Jody McAdams  committed 3464d60

update

  • Participants
  • Parent commits 5834590

Comments (0)

Files changed (1)

File Experimental/MicroHorse/MicroHorse.ino

 Animation* lowerLegServoAnimBL;
 Animation* pingAnim;
 
-const float movementMin = 0.0f;
+const float movementMin = 0.1f;
 const float movementMax = 1.0f;
 
-const float closenessEffectMin = 0.5f;
-const float closenessEffectMax = 1.0f;
-
 const float animSpeedMin = 1.25f;
 const float animSpeedMax = 2.5f;
 
-const float movementDistCheckMax = 30.0f;
+const float movementDistCheckMax = 70.0f;
 
 float overallMovementR = 1.0f;
 float overallMovementL = 1.0f;
 float lastTimeMillis = 0.0f;
 void setup() 
 { 
-  Serial.begin(9600);
+  //Serial.begin(9600);
   
   sonar = new NewPing(ultraSoundSignal,ultraSoundSignal,ultrasonicMaxDistanceCM);
   
   overallMovementL = MinF(1.0f,distInRight/movementDistCheckMax);
   overallMovementR = MinF(1.0f,distInLeft/movementDistCheckMax);
   
+  const float moveDiff = 1.0f-abs(overallMovementL-overallMovementR);
+  //Serial.print("moveDiffT: ");
+  //Serial.print(moveDiffT);
+  
+  const float moveDiffAdd = moveDiff*0.5f;
+  //Serial.print(moveDiffAdd);
+  
+  overallMovementL += moveDiffAdd;
+  overallMovementR += moveDiffAdd;
+  
   //overallMovementL += centerDistT*0.5f;
   //overallMovementR += centerDistT*0.5f;
   
   overallMovementR = MinF(1.0f,overallMovementR);
   
   const float maxMove = MaxF(overallMovementL,overallMovementR);
-  const float addToMoveT = Lerp(closenessEffectMin,closenessEffectMax,centerDistT);
-  const float addToMove = (1.0f-maxMove)*addToMoveT;
+  //const float addToMove = (1.0f-maxMove);
   
-  overallMovementL += addToMove;
-  overallMovementR += addToMove;
+  //overallMovementL += addToMove;
+  //overallMovementR += addToMove;
 
   overallMovementL = Lerp(movementMin,movementMax,overallMovementL);
   overallMovementR = Lerp(movementMin,movementMax,overallMovementR);
   
-  animSpeed = Lerp(animSpeedMin,animSpeedMax,centerDistT);
+  //animSpeed = Lerp(animSpeedMin,animSpeedMax,centerDistT);
   
-  Serial.print("Left: ");
+  /*Serial.print("Left: ");
   Serial.print(overallMovementL);
   Serial.print(", Right: ");
   Serial.print(overallMovementR);
   Serial.print(", Anim Speed: ");
-  Serial.println(animSpeed);
+  Serial.println(animSpeed);*/
   
   //Left legs
   upperLegServoAnimFL->animSpeed = animSpeed;