This is some awesome robot code

Dependencies:   mbed-rtos mbed QEI

Fork of ICRSEurobot13 by Thomas Branch

Files at this revision

API Documentation at this revision

Comitter:
madcowswe
Date:
Tue Apr 16 12:55:10 2013 +0000
Parent:
87:272a7129b04b
Child:
89:dfe8c2ec5b88
Commit message:
prelim final RED

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/MotorControl/MotorControl.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Processes/AI/ai.cpp	Tue Apr 16 12:24:25 2013 +0000
+++ b/Processes/AI/ai.cpp	Tue Apr 16 12:55:10 2013 +0000
@@ -78,13 +78,19 @@
     motion::setNewWaypoint(Thread::gettid(),&mid_wp);
     motion::waypoint_flag_mutex.unlock();
     Thread::signal_wait(0x1); //wait until wp reached
-    #endif
     
     Waypoint approach_wp = {2.2, 1.83/*1.85*/, (-3.0f/4.0f)*PI, 0.03, 0.05*PI, 32};
     motion::waypoint_flag_mutex.lock();
     motion::setNewWaypoint(Thread::gettid(),&approach_wp); 
     motion::waypoint_flag_mutex.unlock();
     Thread::signal_wait(0x1); //wait until wp reached
+    #endif
+    /*
+    Waypoint approach_wp2 = {2.2-0.05, 1.83, (-3.0f/4.0f)*PI, 0.03, 0.05*PI, 32};
+    motion::waypoint_flag_mutex.lock();
+    motion::setNewWaypoint(Thread::gettid(),&approach_wp2); 
+    motion::waypoint_flag_mutex.unlock();
+    Thread::signal_wait(0x1); //wait until wp reached*/
     
     Waypoint mutable_cake_wp = {0, 0, 0, 0.01, 0.01*PI, 512};
     
@@ -92,12 +98,12 @@
     
     layer layer_to_push = top_layer;
     
-    float top_target_phi = (180-(11.25+22.5))/180*PI;
+    float top_target_phi = (180-(11.25/*+22.5*/))/180*PI;
     float bot_target_phi = (180-(7.5+15))/180*PI;
     
     float phi = 0; // angle of vector (robot->center of cake)
     
-    for(int i=0; i<17; ++i)
+    for(int i=0; i<18; ++i)
     {
         if (top_target_phi > bot_target_phi)
         {
@@ -130,22 +136,22 @@
         if(layer_to_push == top_layer)
         {
             ColourEnum colour_read = c_upper.getColour();
-            if ((colour_read==own_colour) && MotorControl::motorsenabled)
+            if ((colour_read==own_colour || i==0) && MotorControl::motorsenabled)
             {
                 arm::upper_arm.go_down();
-                top_arm_up_timer.start(1100);
+                top_arm_up_timer.start(1200);
             }
-        }
+        }  
         else
         {
             ColourEnum colour_read = c_lower.getColour();
-            if ((colour_read==own_colour || i==5 || i==7 || i==8 || i==10/*|| colour_read==WHITE*/) && MotorControl::motorsenabled)
+            if ((colour_read==own_colour || i==5+1 || i==7+1 || i==8+1 || i==10+1/*|| colour_read==WHITE*/) && MotorControl::motorsenabled)
             {
                 arm::lower_arm.go_down();
-                bottom_arm_up_timer.start(1100);
+                bottom_arm_up_timer.start(1200);
             }
         }
-        Thread::wait(2000);
+        Thread::wait(2100);
     }
     
     ////////////////////
--- a/Processes/Motion/motion.cpp	Tue Apr 16 12:24:25 2013 +0000
+++ b/Processes/Motion/motion.cpp	Tue Apr 16 12:55:10 2013 +0000
@@ -134,7 +134,7 @@
     
     
     // forward velocity controller
-    const float p_gain_fv = 0.85;//0.7; //TODO: tune
+    const float p_gain_fv = 0.95;//0.7; //TODO: tune
     
     float max_fv = 0.3;//0.2; // meters per sec //TODO: tune
     float max_fv_reverse = 0.03; //TODO: tune
--- a/Processes/MotorControl/MotorControl.cpp	Tue Apr 16 12:24:25 2013 +0000
+++ b/Processes/MotorControl/MotorControl.cpp	Tue Apr 16 12:55:10 2013 +0000
@@ -26,7 +26,7 @@
 
     float testspeed = 0.2;
     float Fcrit = 1.75;
-    float Pcrit = 10;
+    float Pcrit = 8;
     float Pgain = Pcrit*0.45;
     float Igain = 1.2f*Pgain*Fcrit*0.05;