The FollowMeBot follows the user based on the color of his or her shirt. The device hosts a webcam on a servo to find the object and orient the robot. The color is chosen through the user interface with push buttons. Currently, the MATLAB code supports red and green detection. The purpose of FollowMeBot is to be able to follow the user in order to be helpful for daily tasks.

Dependencies:   Rectangle Servo TextLCD mbed

Fork of FollowMeBot3 by Rahul Shetty

Revision:
10:d53a8ef068c0
Parent:
9:72e899c35484
--- a/main.cpp	Fri Dec 06 23:04:26 2013 +0000
+++ b/main.cpp	Sat Dec 07 02:51:52 2013 +0000
@@ -11,8 +11,8 @@
 //#define MAX_VIEW_Y 1200 // maximum Y value input from camera
 #define CENTER_BOX_TOLLERANCE 100 // Size of our box
 #define TO_SERVO_DIVISOR 4000.0 // Value to divide by to get the amount to move the servo by
-#define NO_COLOR_MAX_COUNT 10
-#define COLLISION_DIST .37
+#define NO_COLOR_MAX_COUNT 5
+#define COLLISION_DIST .5
 #define BLOB_CLOSE_DIST 120000
 #define SERVO_HOME .5
 #define SERVO_HOME_TOL .2
@@ -128,19 +128,19 @@
     } else {
         myled = 0;
     }
-    lcd.locate(0,0);
-    lcd.printf("x: %d y: %d", xpos, ypos);
+    //lcd.locate(0,0);
+    //lcd.printf("x: %d y: %d", xpos, ypos);
 
-  /*  float irVal = irSensorFront;
+    //float irVal = irSensorFront;
     lcd.locate(0,0);
     lcd.printf("irVal: %f", irVal);
     lcd.locate(0,1);
-    lcd.printf("blob: %d", blobArea);*/
+    lcd.printf("blob: %d", blobArea);
 }
 
 void moveBot()
 {
-   // irVal = irSensorFront;                aaaaaaaaaaa
+    irVal = irSensorFront;      
 
     //
     // colorLost = false;
@@ -154,19 +154,19 @@
         if(servoIsInHome() > 0) {
             //if(servoHor.read() > .7) {
             //servoHor = servoHor - .1;
-            lcd.printf("right");
+            //lcd.printf("right");
             followMeBot.right();
         } else if(servoIsInHome() < 0) {
             //} else if(servoHor.read() < .3) {
 
             //servoHor = servoHor + .1;
-            lcd.printf("left");
+            //lcd.printf("left");
             followMeBot.left();
 
         } else if(servoIsInHome() == 0) {//n
         
-            //if (irVal < COLLISION_DIST) {
-            if (blobArea < 3000000) {              //just testing          aaaaaa
+            if (irVal < COLLISION_DIST) {
+            //if (blobArea < 180000) {              //just testing          aaaaaa
                 //lcd.cls();
                 //lcd.printf("forward: %f", irVal);
                 followMeBot.forward();
@@ -186,7 +186,7 @@
             lcd.printf("for sp: %d", (SPEED_CONST/(blobArea/100)));*/
         }
     } else {
-        lcd.printf("Color Lost");
+        //lcd.printf("Color Lost");
         followMeBot.left();
       //  followMeBot.stop();//n
        // followMeBot.right();