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 FollowMeBot by richard choy

Files at this revision

API Documentation at this revision

Comitter:
rshetty6
Date:
Fri Dec 06 23:04:26 2013 +0000
Parent:
8:7758b1db4d5b
Commit message:
aaaaaaaaaaaaaaaaaa

Changed in this revision

iRobot/iRobot.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/iRobot/iRobot.cpp	Fri Dec 06 20:40:17 2013 +0000
+++ b/iRobot/iRobot.cpp	Fri Dec 06 23:04:26 2013 +0000
@@ -123,7 +123,7 @@
 void iRobot::receive_sensor()
 {
     char start_character;
-    printf("reading\n");
+   // printf("reading\n");
 // Loop just in case more than one character is in UART's receive FIFO buffer
     while (device.readable()) {
         switch (Sensor_byte_count) {
--- a/main.cpp	Fri Dec 06 20:40:17 2013 +0000
+++ b/main.cpp	Fri Dec 06 23:04:26 2013 +0000
@@ -5,10 +5,10 @@
 #include "TextLCD.h"
 
 // Macros/Constants
-//#define MAX_VIEW_X 640 // maximum X value input from camera
-//#define MAX_VIEW_Y 480 // maximum Y value input from camera
-#define MAX_VIEW_X 1600 //maximum X value input from camera
-#define MAX_VIEW_Y 1200 // maximum Y value input from camera
+#define MAX_VIEW_X 640 // maximum X value input from camera
+#define MAX_VIEW_Y 480 // maximum Y value input from camera
+//#define MAX_VIEW_X 1600 //maximum X value input from camera
+//#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
@@ -60,6 +60,7 @@
 {
     followMeBot.start();
     servoHor = .5;
+   // pc.printf("%d\n", GREEN);
 
     while(1) {
         getXYpos();
@@ -127,6 +128,8 @@
     } else {
         myled = 0;
     }
+    lcd.locate(0,0);
+    lcd.printf("x: %d y: %d", xpos, ypos);
 
   /*  float irVal = irSensorFront;
     lcd.locate(0,0);
@@ -163,7 +166,7 @@
         } else if(servoIsInHome() == 0) {//n
         
             //if (irVal < COLLISION_DIST) {
-            if (blobArea < 180000) {              //just testing          aaaaaa
+            if (blobArea < 3000000) {              //just testing          aaaaaa
                 //lcd.cls();
                 //lcd.printf("forward: %f", irVal);
                 followMeBot.forward();
@@ -171,8 +174,8 @@
             else {
                 followMeBot.stop();
                 lcd.cls();
-                lcd.locate(0,0);
-                lcd.printf("blobArea: %d ", blobArea);
+                //lcd.locate(0,0);
+               //lcd.printf("blobArea: %d ", blobArea);
                 //wait(1);
                // lcd.printf("stop: %f ", irVal);
             } 
@@ -214,6 +217,8 @@
             greenLED = 0;
             redLED = 1;        
         }
+            pc.printf("%d\n", color);
+            servoHor = SERVO_HOME;
     }
     PBPast = PBval;
 }