Gruppe 3 / Mbed 2 deprecated PES1

Dependencies:   Servo mbed pixy

Fork of PES by Gruppe 3

Files at this revision

API Documentation at this revision

Comitter:
Shukle
Date:
Mon May 01 13:25:12 2017 +0000
Parent:
23:6feed75772b6
Child:
25:a50ca6f2eca4
Commit message:
superduper Update mega gut

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
readCamera.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Mon May 01 12:35:14 2017 +0000
+++ b/main.cpp	Mon May 01 13:25:12 2017 +0000
@@ -99,7 +99,7 @@
             case 3:
                 printf("3");
                 roboter1.bandeAusweichen();
-                if(time2 < 40) {    // gerade aus fahren
+                if(time2 < 80) {    // gerade aus fahren
                     pwmL = 0.6f;
                     pwmR = 0.4f;
                     time2 ++;
--- a/readCamera.cpp	Mon May 01 12:35:14 2017 +0000
+++ b/readCamera.cpp	Mon May 01 13:25:12 2017 +0000
@@ -9,7 +9,7 @@
 static int range = 1;           // 1: fährt strahl an, 2: fährt kegel an
 static int state = 0;
 static double distance = 0;
-static int yLimit = 90;
+static int yLimit = 130;
 int j;
 uint16_t blocks;
 
@@ -32,7 +32,7 @@
                      
         
                     // soll drehen bis in stahl, fahren bis kegel, 25 pixel links rechts kegel
-                    if(xAxis < 180 && xAxis > 140  &&  yAxis > 0 && yAxis < yLimit ) {              // wenn Klotz an Position zum aufnehmen
+                    if(xAxis < 180 && xAxis > 140  &&  yAxis < 199 && yAxis > yLimit ) {              // wenn Klotz an Position zum aufnehmen
                         state = 400;
                         range = 1;
                         printf("\n\raufnehmen\n\r");
@@ -47,7 +47,7 @@
                                 state = 200 + (int) distance;
                                 printf("\n\rfahre rechts\n\r");
                             } else{   // fährt gerade
-                                distance = (((yAxis - yLimit)/(199-yLimit))*100);
+                                distance = (((double) yAxis - (double) yLimit)/(double) yLimit)*-100.0;
                                 state = 300 + (int) distance;
                                 if (state == 400){
                                     state=399;
@@ -59,6 +59,8 @@
                             if (xAxis > 185 || xAxis < 135) {
                                 range = 1;
                             }
+                            distance = (((double) yAxis - (double) yLimit)/(double) yLimit)*-100.0;
+                            state = 300 + (int) distance;
                         }
                     }