FRC_equipe1 / Mbed 2 deprecated FRC_2019

Dependencies:   mbed

Revision:
38:a8b84be7dce5
Parent:
37:65650aab8387
Child:
39:82c1de84bf40
--- a/main.cpp	Sat Jun 08 02:47:31 2019 +0000
+++ b/main.cpp	Sat Jun 08 06:17:19 2019 +0000
@@ -23,9 +23,7 @@
     Robot robot;
     
     while(1)
-    {
         automate_run(robot);
-    }   
 }
 
 void automate_run(Robot& robot)
@@ -180,7 +178,7 @@
                     T_corrige.reset();
                 }
             }
-            else if( T_corrige.read() > 1.5f )
+            else if( T_corrige.read() > 1.0f )
             {
                 etat = RAS;
                 T_corrige.stop();
@@ -311,7 +309,7 @@
 
 bool automate_fin_de_partie(Robot& robot)
 {
-    typedef enum{AVANCE, EXPLOSE_BALLON, FIN_PARTIE} type_etat;
+    typedef enum{AVANCE, INTERMEDIAIRE, EXPLOSE_BALLON, FIN_PARTIE} type_etat;
     static type_etat etat = AVANCE;
     
     static Timer T_fin;
@@ -319,7 +317,12 @@
     switch(etat)
     {
         case AVANCE:
-            if(robot.GoToXYT(robot.pos(Robot::X),3600,0))
+            if(robot.tourne( -robot.pos(Robot::THETA) ))//if(robot.GoToXYT(robot.pos(Robot::X),3600,0))
+                etat = INTERMEDIAIRE;
+            break;
+            
+        case INTERMEDIAIRE:
+            if(robot.avance( 4000 - robot.pos(Robot::Y) - 350))
                 etat = EXPLOSE_BALLON;
             break;