2014 Eurobot fork

Dependencies:   mbed-rtos mbed QEI

Files at this revision

API Documentation at this revision

Comitter:
rsavitski
Date:
Mon Apr 15 13:53:58 2013 +0000
Parent:
70:0da6ca845762
Child:
77:8d83a0c00e66
Commit message:
tuning gains with counterweights + cleanup

Changed in this revision

Processes/AI/ai.cpp Show annotated file Show diff for this revision Revisions of this file
Processes/Motion/motion.cpp Show annotated file Show diff for this revision Revisions of this file
Processes/Motion/motion.h Show annotated file Show diff for this revision Revisions of this file
--- a/Processes/AI/ai.cpp	Sun Apr 14 22:02:21 2013 +0000
+++ b/Processes/AI/ai.cpp	Mon Apr 15 13:53:58 2013 +0000
@@ -19,7 +19,8 @@
     Waypoint *wpptr;
 };
 
-void arm_upper(const void *dummy); //TODO: kill
+void raise_top_arm(const void *dummy);
+void raise_bottom_arm(const void *dummy);
 
 void delayed_setter(const void *tid_wpptr); //TODO: kill the hack
 
@@ -45,7 +46,7 @@
     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);
+    RtosTimer top_arm_up_timer(raise_top_arm, osTimerOnce);
     
     for (float phi=(180-11.25)/180*PI; phi > 11.25/180*PI;)
     {
@@ -56,7 +57,7 @@
             //Thread::wait(1000);
             arm::upper_arm.go_down();
             delayed_done = false;
-            delayed_armer.start(1200);
+            top_arm_up_timer.start(1200);
             delayed_wp_set.start(2400);
             //Thread::wait(2000);
             //arm::upper_arm.go_up();
@@ -88,15 +89,19 @@
     }
 }
 
-void arm_upper(const void *dummy)
+void raise_top_arm(const void *dummy)
 {
     arm::upper_arm.go_up();
 }
 
+void raise_bottom_arm(const void *dummy)
+{
+    arm::lower_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();
     motion::setNewWaypoint(dsptr->tid,dsptr->wpptr);
     delayed_done = true;
 }
--- a/Processes/Motion/motion.cpp	Sun Apr 14 22:02:21 2013 +0000
+++ b/Processes/Motion/motion.cpp	Mon Apr 15 13:53:58 2013 +0000
@@ -44,7 +44,7 @@
 };
 
 // local copy of the current active motion
-motion_cmd current_motion;
+motion_cmd current_motion = {motion_waypoint, 0, false, NULL};
 
 Waypoint target_waypoint = {0,0,0,0,0}; //local wp copy, TODO: fix and make a shared local memory pool for any movement cmd to be copied to
 
@@ -186,7 +186,6 @@
     current_motion.setter_tid = setter_tid_in;
     current_motion.motion_type = motion_waypoint;
 
-    //current_motion.wp_ptr = new_wp; //TODO: need to make local copy or edits to mem ptr contents screw motion over
     target_waypoint = *new_wp;
 }
 
--- a/Processes/Motion/motion.h	Sun Apr 14 22:02:21 2013 +0000
+++ b/Processes/Motion/motion.h	Mon Apr 15 13:53:58 2013 +0000
@@ -12,6 +12,7 @@
 void motionlayer(void const *dummy);
 void waypoint_motion_handler();
 
+// supports both polling on sticky bit via checkMotionStatus(), waiting/blocking on signal 0x1 in setter thread (signalled upon reaching the wp)
 void setNewWaypoint(osThreadId setter_tid_in, Waypoint *new_wp);
 bool checkMotionStatus();