![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Fertige Version mit geschwindigkeit 100
Dependencies: mbed
Fork of Micromouse_alpha_copy_copy by
Diff: Turn.cpp
- Revision:
- 4:e3f388933954
- Parent:
- 2:592f01278db4
- Child:
- 5:b8b1a979b0d5
--- a/Turn.cpp Sun Apr 08 19:17:01 2018 +0000 +++ b/Turn.cpp Thu Apr 12 16:14:02 2018 +0000 @@ -4,7 +4,7 @@ using namespace std; const float Turn::TURNINGSPEED = 50.0f;//Drehgeschwindgkeit -const int Turn::TURNINGCOUNTS = 941; //Entspricht Drehung um 90Grad +const int Turn::TURNINGCOUNTS = 946; //Entspricht Drehung um 90Grad //941; Turn::Turn(EncoderCounter& counterLeft, EncoderCounter& counterRight, Controller& controller, int& wallRight, int& wallFront, int& wallLeft): counterLeft(counterLeft), @@ -29,26 +29,26 @@ if (wallLeft == 0){ //Nach Links Drehen - printf("Links ist frei\n"); + //printf("Links ist frei\n"); while((countsRight <= countsRight0 + TURNINGCOUNTS) && (countsLeft <= countsLeft0 + TURNINGCOUNTS)){ controller.setDesiredSpeedRight(TURNINGSPEED); controller.setDesiredSpeedLeft(TURNINGSPEED); countsRight = counterRight.read(); countsLeft = counterLeft.read(); - printf("%d\n\r", countsRight); - printf("%d\n\r", countsLeft); + //printf("%d\n\r", countsRight); + //printf("%d\n\r", countsLeft); } controller.setDesiredSpeedRight(0.0f); controller.setDesiredSpeedLeft(0.0f); }else if (wallFront == 0){ //Nicht Drehen-> weiter Geradeaus - printf("Vorne ist frei\n"); + //printf("Vorne ist frei\n"); }else if (wallRight == 0) { //Nach Rechts Drehen - printf("Rechts ist frei\n"); + //printf("Rechts ist frei\n"); while((countsRight >= countsRight0 - TURNINGCOUNTS) && (countsLeft >= countsLeft0 - TURNINGCOUNTS)){ controller.setDesiredSpeedRight(-TURNINGSPEED); @@ -64,7 +64,7 @@ }else{ //Alle Wege versperrt-> Wenden - printf("Alles versperrt...zurueck\n"); + //printf("Alles versperrt...zurueck\n"); while((countsRight <= countsRight0 + 2*TURNINGCOUNTS) && (countsLeft <= countsLeft0 + 2*TURNINGCOUNTS)){ controller.setDesiredSpeedRight(TURNINGSPEED);