Time is good

Dependencies:   RoboClaw mbed

Fork of Robot2016_2-0 by ARES

Files at this revision

API Documentation at this revision

Comitter:
IceTeam
Date:
Fri May 06 12:34:25 2016 +0000
Parent:
89:46730de0d013
Child:
91:65fb6b9f3932
Commit message:
Fonctionnel 61 max :);

Changed in this revision

deplacement.cpp Show annotated file Show diff for this revision Revisions of this file
entete.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/deplacement.cpp	Fri May 06 11:54:27 2016 +0000
+++ b/deplacement.cpp	Fri May 06 12:34:25 2016 +0000
@@ -106,6 +106,7 @@
 
 void GotoThet(double theta_) {
     roboclaw.ResetEnc();
+    wait_ms(10);
     float diameter_left = 61.7;
     float diameter_right = 61.8;
     int distance_ticks_left = -theta_*ENTRAXE/(2*(diameter_left*3.14159/4096));
--- a/entete.h	Fri May 06 11:54:27 2016 +0000
+++ b/entete.h	Fri May 06 12:34:25 2016 +0000
@@ -21,6 +21,7 @@
 extern DigitalOut LEDV;
 extern DigitalIn button;
 extern int SCouleur;
+extern float R_SEUIL_SHARP;
 
 // Fonctions main.cpp
 void Sharps();
@@ -53,7 +54,6 @@
 #define deccel_dista 2000
 
 #define waiting_time 1
-#define R_SEUIL_SHARP 1
 #define GAUCHE 1
 #define DROITE -1
 
--- a/main.cpp	Fri May 06 11:54:27 2016 +0000
+++ b/main.cpp	Fri May 06 12:34:25 2016 +0000
@@ -19,6 +19,7 @@
 int Ravance = 1;
 DigitalIn start(PB_7);
 AX12 umbrella(PA_9, PA_10, 2, 250000);
+float R_SEUIL_SHARP = 1;
 
 /* Debut du programme */
 int main(void)
@@ -31,22 +32,34 @@
     umbrella.setMaxTorque(200);
     umbrella.setGoal(150);
     wait(1);
-    umbrella.setGoal(200);
+    umbrella.setGoal(160);
     wait(1);
-    umbrella.setGoal(160);
+    umbrella.setGoal(150);
+    wait(1);
+    umbrella.setMaxTorque(0);
     
     depart();
     if (SCouleur == VERT) {
-        end.attach(&endFonc, 90);
-        GotoDist(8);
-        GotoArr(8.2);
+        end.attach(&endFonc, 60);
+        GotoDist(9.0);
+        GotoArr(9.2);
+        R_SEUIL_SHARP = 0.25;
+        GotoDist(2.5);
+        GotoThet(-3.14159);
+        GotoDist(4);
+        R_SEUIL_SHARP = 1;
+        GotoDist(3.5);
     }
     else if (SCouleur == VIOLET) {  
-        end.attach(&endFonc, 30);
-        //GotoDist(8.2);
-        //GotoArr(8.2);
-        GotoDist(2);
+        end.attach(&endFonc, 60);
+        GotoDist(9.0);
+        GotoArr(9.2);
+        R_SEUIL_SHARP = 0.25;
+        GotoDist(2.5);
         GotoThet(3.14159);
+        GotoDist(4);
+        R_SEUIL_SHARP = 1;
+        GotoDist(3.5);
     }
     else if (SCouleur == NOIR) {
         TestDist3(2,2);
@@ -72,7 +85,7 @@
     RvalRcapt3 = RvalRcapt3 > 10 ? 10 : RvalRcapt3;
     RvalRcapt3 = RvalRcapt3 < 0 ? 0 : RvalRcapt3;
     
-    if (RvalRcapt1 >= 5 || RvalRcapt2 >= 5 || RvalRcapt3 >= 5)
+    if ((RvalRcapt1 >= 5 || RvalRcapt2 >= 5 || RvalRcapt3 >= 5))
         Ravance = 0;
     else 
         Ravance = 1;
@@ -87,6 +100,8 @@
     roboclaw.ForwardM1(0);
     roboclaw.ForwardM2(0);
     wait(1);
+    umbrella.setMaxTorque(400);
+    wait(1);
     umbrella.setGoal(300);
     while(1);
 }