Pathfinding nach rechts funktioniert noch nicht...der rest schon

Dependencies:   mbed

Fork of MicroMouse_MASTER_THREE by PES2_R2D2.0

Revision:
2:592f01278db4
Parent:
1:d9e840c48b1e
Child:
4:e3f388933954
--- a/Turn.cpp	Sat Mar 31 16:45:57 2018 +0000
+++ b/Turn.cpp	Wed Apr 04 15:24:28 2018 +0000
@@ -4,7 +4,7 @@
 using namespace std;
 
 const float Turn::TURNINGSPEED = 50.0f;//Drehgeschwindgkeit
-const int Turn::TURNINGCOUNTS = 2000;  //Entspricht Drehung um 90Grad
+const int Turn::TURNINGCOUNTS = 941;  //Entspricht Drehung um 90Grad
 
 Turn::Turn(EncoderCounter& counterLeft, EncoderCounter& counterRight, Controller& controller, int& wallRight, int& wallFront, int& wallLeft):
     counterLeft(counterLeft), 
@@ -31,13 +31,13 @@
     
     printf("Links ist frei\n");
     
-    while((countsRight >= countsRight0 - TURNINGCOUNTS) && (countsLeft >= countsLeft0 - TURNINGCOUNTS)){
+    while((countsRight <= countsRight0 + TURNINGCOUNTS) && (countsLeft <= countsLeft0 + TURNINGCOUNTS)){
         controller.setDesiredSpeedRight(TURNINGSPEED);
         controller.setDesiredSpeedLeft(TURNINGSPEED);
         countsRight = counterRight.read();
         countsLeft = counterLeft.read();
-        printf("%d\n", countsRight);
-        printf("%d\n", countsLeft);
+        printf("%d\n\r", countsRight);
+        printf("%d\n\r", countsLeft);
     }
     controller.setDesiredSpeedRight(0.0f);
     controller.setDesiredSpeedLeft(0.0f);
@@ -50,13 +50,13 @@
             
             printf("Rechts ist frei\n");
             
-            while((countsRight <= countsRight0 + TURNINGCOUNTS) && (countsLeft <= countsLeft0 + TURNINGCOUNTS)){
+            while((countsRight >= countsRight0 - TURNINGCOUNTS) && (countsLeft >= countsLeft0 - TURNINGCOUNTS)){
                 controller.setDesiredSpeedRight(-TURNINGSPEED);
                 controller.setDesiredSpeedLeft(-TURNINGSPEED);
                 countsRight = counterRight.read();
                 countsLeft = counterLeft.read();
-                printf("%d\n", countsRight);
-                printf("%d\n", countsLeft);
+                //printf("%d\n", countsRight);
+                //printf("%d\n", countsLeft);
             }
             controller.setDesiredSpeedRight(0.0f);
             controller.setDesiredSpeedLeft(0.0f);
@@ -66,13 +66,13 @@
             
                 printf("Alles versperrt...zurueck\n");
             
-                while((countsRight >= countsRight0 - 2*TURNINGCOUNTS) && (countsLeft >= countsLeft0 - 2*TURNINGCOUNTS)){
+                while((countsRight <= countsRight0 + 2*TURNINGCOUNTS) && (countsLeft <= countsLeft0 + 2*TURNINGCOUNTS)){
                     controller.setDesiredSpeedRight(TURNINGSPEED);
                     controller.setDesiredSpeedLeft(TURNINGSPEED);
                     countsRight = counterRight.read();
                     countsLeft = counterLeft.read();
-                    printf("%d\n", countsRight);
-                    printf("%d\n", countsLeft);
+                    //printf("%d\n", countsRight);
+                    //printf("%d\n", countsLeft);
                 }
                 controller.setDesiredSpeedRight(0.0f);
                 controller.setDesiredSpeedLeft(0.0f);