Spring 2014, ECE 4180 project, Georgia Institute of Technolgoy. This is the human driver (RF controller) program for the Robotics Cat and Mouse program.

Dependencies:   ADXL345_I2C_NEST HMC6352 IMUfilter ITG3200_NEST USBHost mbed-rtos mbed

Fork of Project by Ganesh Subramaniam

Revision:
6:3fb9f96765f6
Parent:
5:210cd333f770
--- a/AIPosition.h	Wed Apr 30 05:53:51 2014 +0000
+++ b/AIPosition.h	Wed Apr 30 12:23:04 2014 +0000
@@ -48,8 +48,6 @@
     double g_temp = imuFilter.getYaw();
 
     // determine direction we are facing and add to that direction
-    //y_position += y_temp;
-    //x_position += y_temp * tan(g_temp);
     double dx = 0;
     double dy = 0;
     QUADRANT quadrant;
@@ -81,13 +79,10 @@
             break;
     }
 
+    // add to total position
     x_position += dx;
     y_position += dy;
 
-    // pc.printf("sin(g): %f, cos(g): %f\n\r", sin(g_temp), cos(g_temp));
-    // pc.printf("DEBUG: dx: %f, dy: %f, gyro: %f, quadrant: %d\n\r", dx, dy, toDegrees(g_temp), quadrant);
-    // pc.printf("x: %f, y: %f, dx: %f, dy:  %f, g: %f, q: %d\n\r", x_position, y_position, dx, dy, toDegrees(g_temp), quadrant);
-
     // check if human car is close enough to end game
     gameOver = isGameOver(x_hum, y_hum, x_position, y_position);
     if(gameOver) {
@@ -95,6 +90,10 @@
         xbee.putc('d');
         pc.printf("Game over sent!\n\r");
 
+        // sanity
+        for(int i = 0; i < 500; i++)
+            xbee.putc('d');
+                
         // go to end game routine
         endGame();
     }
@@ -122,17 +121,12 @@
 
 void receivePosition(void const *)
 {
+    // temp variables
     char buffer[SERIAL_BUFFER_SIZE];
     int index = 0;
     int xt = 0;
     int yt = 0;
 
-    // clear any garbage
-    // xbee.getc();
-    //xbee.getc();
-
-    // while(!gameOver) {
-
     // wait for start character
     while(xbee.readable() && xbee.getc() != 'x' && !gameOver);