2014 Eurobot fork

Dependencies:   mbed-rtos mbed QEI

Revision:
70:0da6ca845762
Parent:
69:4b7bb92916da
Child:
74:9620d24a2f4e
Child:
76:532d9bc1d2aa
--- a/Processes/AI/ai.cpp	Sun Apr 14 20:23:07 2013 +0000
+++ b/Processes/AI/ai.cpp	Sun Apr 14 22:02:21 2013 +0000
@@ -19,6 +19,8 @@
     Waypoint *wpptr;
 };
 
+void arm_upper(const void *dummy); //TODO: kill
+
 void delayed_setter(const void *tid_wpptr); //TODO: kill the hack
 
 void ailayer(void const *dummy)
@@ -42,6 +44,8 @@
 
     bool firstavoidstop = 1;
     delayed_struct ds = {Thread::gettid(),&current_waypoint};
+    RtosTimer delayed_wp_set(delayed_setter, osTimerOnce, (void *)&ds);
+    RtosTimer delayed_armer(arm_upper, osTimerOnce);
     
     for (float phi=(180-11.25)/180*PI; phi > 11.25/180*PI;)
     {
@@ -52,7 +56,8 @@
             //Thread::wait(1000);
             arm::upper_arm.go_down();
             delayed_done = false;
-            RtosTimer delayed_wp_set(delayed_setter, osTimerOnce, (void *)&ds);
+            delayed_armer.start(1200);
+            delayed_wp_set.start(2400);
             //Thread::wait(2000);
             //arm::upper_arm.go_up();
             
@@ -83,10 +88,15 @@
     }
 }
 
+void arm_upper(const void *dummy)
+{
+    arm::upper_arm.go_up();
+}
+
 void delayed_setter(const void *tid_wpptr) //TODO: kill the hack
 {
     delayed_struct *dsptr = (delayed_struct *)tid_wpptr;
-    arm::upper_arm.go_up();
+    //arm::upper_arm.go_up();
     motion::setNewWaypoint(dsptr->tid,dsptr->wpptr);
     delayed_done = true;
 }