ROBOTIC COMPETITION PARIS 2017

Dependencies:   CMPS03 mbed

Fork of _test_suivi_mur by christophe vermaelen

Revision:
12:6151eb503170
Parent:
11:cb477f6ec781
Child:
13:4fdd8ad91c69
--- a/main.cpp	Thu Jun 01 08:18:04 2017 +0000
+++ b/main.cpp	Thu Jun 01 09:30:37 2017 +0000
@@ -11,7 +11,6 @@
     int etat=0;
     init();
     t3.reset();
-    t3.start();
     while(1) {
         // printf("etat=%d US1=%.0f US2=%.0f US3=%.0f erreur=%.0f AN1=%.0f AN2=%.0f cmdD=%.0f cmdG=%.0f\n\r",etat,US1,US2,US3,(US2-US1),AN1,AN2,cmdD,cmdG);
         //wait(0.05);
@@ -29,19 +28,22 @@
 
         switch(etat) {
             case 0 :
-                if(jack.read()==0) etat=1;
+                if(jack.read()==0) {
+                    etat=1;
+                    t3.reset();
+                }
                 break;
-            case 1 :     
+            case 1 :
                 if(jack.read()!=0) etat=0;
-                if((AN2>10 && AN2<20) || US3<13) {
+                if((AN2>40 && AN2<45) || US3<40) {
                     etat=2;
                     stop();
                 }
-                if(US2>100 && US1<40) {
+                if(US2>100 && AN1<40) {
                     etat=3;
                     stop();
                 }
-                if(t3.read()>t_set) {
+                if(t3.read()>8) {
                     etat=4;
                     bearing_set=bearing_set+25.0;
                     t3.reset();
@@ -64,11 +66,11 @@
                 break;
             case 3 :
                 if(jack.read()!=0) etat=0;
-                if((AN2>10 && AN2<20) || US3<13) {
+                if((AN2>40 && AN2<45) || US3<40) {
                     etat=2;
                     stop();
                 }
-                if(US1>100 && US2<10) {
+                if(t2.read()>2) {
                     etat=1;
                     stop();
                 }
@@ -83,9 +85,8 @@
                 break;
             case 5 :
                 if(jack.read()!=0) etat=0;
-                if((AN2>10 && AN2<22) || US3<22) {
+                if((AN2>40 && AN2<42) || US3<40) {
                     etat=2;
-                    t_set=8;
                     stop();
                 }
                 break;
@@ -99,13 +100,13 @@
                 suivi_mur();
                 break;
             case 2 :
-                rotation_horaire();
+                rotation_sharp();
                 break;
             case 3 :
                 contournement();
                 break;
             case 4 :
-                rotation_horaire();
+                rotation_sharp();
                 break;
             case 5 :
                 en_avant();