Fire Fighting Robot

April 9, 2010

We’ve finally finished our fire fighting robot! If anyone is interested in seeing the robot in action, check out the video below. I know it’s kinda boring, we probably should’ve taken a longer video… but alas, we forgot.

This was taken while we were testing it’s sweeping functionality. It scans the 3×3 grid in front, then if and only if a candle is detected, the extinguishing mechanism (the sponge on the arm) is actuated and poof the flame is gone.

You’ll notice after it extinguishes the first two candles that it “bounces” against the black line before stopping. This is actually its self-aligning algorithm. One of the biggest problems we encountered during the course of the project was that the robot would be misaligned whenever it stopped. Essentially, the momentum would carry the robot in anunpredictable direction… Sometimes left, sometimes right. Obviously, as a result, the subsequent trajectory would be affected as well. So, in order to ensure that the robot is straight before proceeding, it is equipped with two photodiodes on the bottom that enables it to do a kind of a repeated “parallel parking” against the line that it’s perpendicular with (aka the line in front of it)… It does this backing up and driving forward motion repeatedly until it is perfectly aligned. Get it? If not, watch the video!

PS. If you’re wondering… here’s the code for the straightening algorithm =)

while( flag == 0) { 

   set_dc1_power(30);
   set_dc2_power(30);

   //not on black
   while( (sensor[2] > highBlack2) && (sensor[3] > highBlack3) ) {  }       

   set_dc1_power(0);
   set_dc2_power(0);

   sensor2 = sensor[2];
   sensor3 = sensor[3];

   //if both sensors are on black, we're straight
   if((sensor2 < highBlack2)  && (sensor3 < highBlack3)) {
      flag=1;
      break;
   }
   else {
      //right sensor is on black and left is on white
      if( (sensor2  highBlack3) ) {
         set_dc1_power(-35);            //back up
         while(sensor[2] < white2){}    //until white
         set_dc1_power(0);
      }
      //left sensor is on black and right is on white
      else if( (sensor3  highBlack2) ) {
         set_dc2_power(-35);             //back up
         while(sensor[3] < white3){}     //until white
         set_dc2_power(0);
      }
   }
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s