Algorithmus

Dependencies:   mbed

Revision:
36:99f60052c746
Parent:
35:5a4e1a87b3da
--- a/Motion.cpp	Sat Jun 30 09:49:06 2018 +0000
+++ b/Motion.cpp	Sat Jun 30 14:13:27 2018 +0000
@@ -79,17 +79,17 @@
                 break;    
             
             //Stop at certain distance in speed run
-            }else if (distanceC < 160.0f && speedRun == true && lastMove == true) {
+          /*  }else if (distanceC < 140.0f && speedRun == true && lastMove == true) { //Ursprünglich: 180.0f 
                 stop();
                 break;   
-            
+            */
             //Correct distance from wall
             }else if ( ((countsL - countsLOld)  >= MOVE_DIST || (countsR - countsROld) <= -MOVE_DIST) && (distanceC <= 130.0f) && (distanceC > 40.0f)) {
                 countsLOld += 1000;
                 countsROld -= 1000; 
                   
             //Stop after certain distance if side wall and front wall missing
-            }else if ( deceleration == true && speedRun == false && ( distanceL > 80.0f || distanceR > 80.0f ) && distanceC > 200.0f ) {
+            }else if ( deceleration == true && speedRun == false && ( distanceL > 80.0f || distanceR > 80.0f ) && distanceC > 180.0f ) { //Urspünglich 200.0f
 
                 controller.counterReset();
                 countsLOld = counterLeft.read();
@@ -156,7 +156,7 @@
             }else if ( ((countsL - countsLOld)  >= 824 || (countsR - countsROld) <= -824) && (distanceC >= 100.0f) && (distanceC < 120.0f) )  {
                 countsLOld += 100;
                 countsROld -= 100; 
-                  
+                       
             //Stop after certain distance if side wall missing
             }else if ( (distanceL > 80.0f || distanceR > 80.0f) && lastMove == false && deceleration == true && distanceC < 190.0f) {
 
@@ -166,7 +166,7 @@
                 countsL = counterLeft.read();
                 countsR = counterRight.read();
                 
-                while ((countsL - countsLOld)  <  250.0f || (countsR - countsROld) > -250.0f) {
+                while ((countsL - countsLOld)  <  280.0f || (countsR - countsROld) > -280.0f) { //Ursprünglich 250.0f
                     countsL = counterLeft.read();
                     countsR = counterRight.read(); 
                     accel(RUN_SPEED);