Fork de Timer après le match à 61 points

Dependencies:   RoboClaw mbed

Fork of Timer by ARES

Revision:
86:0c5e9ac3d8d8
Child:
88:e4de39dd3e2e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deplacement.cpp	Fri May 06 10:05:33 2016 +0200
@@ -0,0 +1,73 @@
+#include "entete.h"
+
+void GotoDist(float timer) {
+    Timer t;
+    
+    roboclaw.SpeedAccelM1(accel_dista, vitesse_dista);
+    roboclaw.SpeedAccelM2(accel_dista, vitesse_dista);
+    
+    t.reset();
+    t.start();
+    
+    while (t.read() < timer) {
+        if (Ravance != 1) {
+            roboclaw.ForwardM1(0);
+            roboclaw.ForwardM2(0);
+            t.stop();
+            while (Ravance != 1);
+            roboclaw.SpeedAccelM1(accel_dista, vitesse_dista);
+            roboclaw.SpeedAccelM2(accel_dista, vitesse_dista);
+            t.start();
+        }
+    }
+    
+    roboclaw.ForwardM1(0);
+    roboclaw.ForwardM2(0);
+    
+    t.stop();
+    t.reset();
+    
+    wait(waiting_time);
+}
+
+void GotoThet (float timer, int signe) {
+    Timer t;
+    
+    if (signe < 0) {
+        roboclaw.SpeedAccelM1(accel_dista, vitesse_dista);
+        roboclaw.SpeedAccelM2(-accel_dista, -vitesse_dista);
+    }
+    else {
+        roboclaw.SpeedAccelM1(-accel_dista, -vitesse_dista);
+        roboclaw.SpeedAccelM2(accel_dista, vitesse_dista);
+    }
+    
+    t.reset();
+    t.start();
+    
+    while (t.read() < timer) {
+        if (Ravance != 1) {
+            roboclaw.ForwardM1(0);
+            roboclaw.ForwardM2(0);
+            t.stop();
+            while (Ravance != 1);
+            t.start();
+        }
+        if (signe < 0) {
+            roboclaw.SpeedAccelM1(accel_dista, vitesse_dista);
+            roboclaw.SpeedAccelM2(-accel_dista, -vitesse_dista);
+        }
+        else {
+            roboclaw.SpeedAccelM1(-accel_dista, -vitesse_dista);
+            roboclaw.SpeedAccelM2(accel_dista, vitesse_dista);
+        }
+    }
+    
+    roboclaw.ForwardM1(0);
+    roboclaw.ForwardM2(0);
+    
+    t.stop();
+    t.reset();
+    
+    wait(waiting_time);
+}
\ No newline at end of file