BeaconAvoid code for AHRC competition.

Dependencies:   MODSERIAL PiSlingers m3pi mbed

Revision:
2:b789f31e6d94
Parent:
1:ac4eff391f12
Child:
3:aa1a77b080eb
--- a/IRBehaviorController.cpp	Sat Apr 07 02:22:00 2012 +0000
+++ b/IRBehaviorController.cpp	Fri Nov 02 03:00:54 2012 +0000
@@ -34,19 +34,23 @@
 void
 IRBehaviorController::runAvoidance(void)
 {
+    float tmp;
+    
     if (debug != NULL)
         debug->printf("IRController: Avoidance Task Start.\r\n");
     
     scanIR();
 
+    tmp = centeroid;
+    
     // Centeroid value needs to be split for avoidance mode.
-    if (centeroid < 0)
-        centeroid += 3;
+    if (tmp < 0)
+        tmp += 3;
     else
-        centeroid -=3;
+        tmp -=3;
         
     if (brightness > activationThreshold)
-        output = pid->run(centeroid);    
+        output = pid->run(tmp);    
     else
         output = 0;