












Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!













Final Report Justin Dickinson
University of Florida
Department of Electrical and Computer Engineering
EEL 5666 – IMDL Spring 2009 Intelligent Machines Design Laboratory
This project report illustrates all of the systems information about the Master
Chief A autonomous robot created for the Intelligent Machines Design Laboratory
(IMDL) class during the Spring 2009 semester. The professors in charge of IMDL
are Dr. Arroyo and Dr. Schwartz. This semesters’ TAs were Mike Pridgen and Thomas
Vermeer.
Master Chief A is designed to be an autonomous sentry platform with the purpose
of locating and firing upon another automated robot. The Master Chief A will patrol an
area while using it’s infrared, and bump sensors to perform obstacle avoidance. The
CMU camera 1 will allow Master Chief A to locate the enemy robot and shoot at it with a
fully custom built NERF dart launcher.
Once Master Chief A begins patrolling the target zone, if contact is made with the
other enemy force, he will begin to aim at and track the target. If the target remains in the
cross hairs for a period of time a burst of NERF darts will be fired. Both Master Chief A
and it’s enemies will have an onboard LED array for targeting purposes. If the enemy
robot or Master Chief A are hit by a subsequent NERF dart, then the LED array will be
shut off as a recognition of its defeat.
The main processing power of the Master Chief A robot is the PVR
microcontroller board which was constructed by the TA’s. This board uses an Atmel
ATmega128 8-bit microcontroller programmable in C using the WinAVR GCC compiler
and AVRStudio. All of the code for this project can be found in the appendix at the end
of this report.
Master Chief A was constructed for the real purpose of being battle-bot, built in
conjunction with a fellow class mate. Initial designs included both paintball and air soft
guns. As these are not allowed on campus, demoing such a robot would be exceptionally
difficult. Instead, a NERF dart launching system was designed. Modeled after a football
launcher, two counter rotating wheels provide plenty of force to propel the NERF dart a
maximum of nearly 30 feet.
Another major design aspect of Master Chief A was the ability to act
autonomously. I wanted the entire system to be a set it, and forget it vehicle. While
patrolling for the enemy robot, Master Chief A needed to avoid obstacles so progress
would not be hindered. This fell to a combination of IR and bump sensors. An infrared
sensor array would allow the robot to view any obstacles on both sides, in front of, and
behind the robot. If an object was not detected by the IR sensors, the bump sensor array
will collide with the unseen object. This fail safe will randomly turn the robot upon
collision.
The final subsystem of Master Chief A is the targeting and aiming system. This is
firmly based on the CMU camera 1. Built in color tracking and middle mass modes allow
the camera to communicate with the robot and adjust to aim at the enemy robot. A servo
driven slip ring turret design allows for the turret to rotate in a 360 degree fashion. This
allows the Master Chief A robot to truly act as an autonomous tank robot, much like
automated weapons platforms in service today.
Master Chief A’s platform was first modeled in Solid Works and then constructed with
the 1/8th^ inch wood provided in lab. The IR sensor array includes 3 forward looking and 1
rear facing IR sensor. The bump switches are connected around the perimeter of the robot
and connected to one another with fastened wood strut supports. The CMU camera 1 is
mounted to the turret and allows for complete rotation for tracking enemy robots. Below
is a Solid Works diagram of the preliminary platform design. Also shown below is a
picture of the completed robot.
Figure 2: Solid Works Drawing of Preliminary Platform Design
Figure 3: Completed Robot Platforms
Figure 4: Wiring diagram for bump sensor array
IR Sensors
The Sharp IR sensor is a popular distance sensor that has a unique way of finding ranges
with IR light. The sensor sends out a pulse of IR light into the environment. If it hits an
object, the light reflects back to the sensor. When the light returns to the sensor, it arrives
at an angle dependant of the distance it reflected back from. The sensor has an included
integrated circuit which provides an analog value corresponding to the range it finds. The
infrared proximity sensor made by Sharp, I chose the model GP2D120XJ00F, has an
analog output that varies from 3.1V at 3cm to 0.3V at 40cm with a supply voltage
between 4.5 and 5.5VDC. Corresponding voltages to detected distances are shown in
table 1 and figure 2 below. The detected values compared to distance does vary linearly,
but can be accurately predicted across all four sharp IR sensors used for this robot.\
CMU Camera
The CMU 1 Robot Vision Cam will be my special sensor used to find the enemy robot
using vision processing. This device is designed to return high level vision capabilities to
microprocessor boards that normally would not have enough processing power to execute
such abilities. The camera to will operate through the microcontroller by sending serial
commands to the CMU camera, and the preprogrammed firmware on the camera will
then use the Track Color command and Middle Mass mode to find the target robot. The
microcontroller will then send commands to the servos to drive the robot towards its
colored target and then engage the firing mechanism. The Middle Mass function of the
CMU camera will be vital in accurately targeting the enemy robot. By focusing on the
giving enough time for the DC motors to get up to speed, the loading servo moves
forward and back three times to send a burst of darts at the enemy target.
Values read from the infrared sensors have the most need for experimental data to be
drawn from. When the IR sensor sends out an infrared light, if an object is detected, the
infrared signal is sent back to the sensor. How strong the signal is returned to the sensor
hub is directly proportional to the distance the object is away from the robot. A set of
values was needed to be experimentally determined to come up with a threshold for the
IR sensors. The data below represents the voltage received based on distance of the
object detected. By raising the threshold of the sensors the robot will be considered more
aggressive, while setting the threshold lower will make the robot more conservative.
Table 1: Output voltages compared to detected distances
Distance (in) Value 0 158 1 140 2 119 3 86 4 65 5 56 6 45 7 40 8 34 9 29 10 27 11 25 12 23
IR Sensor with Black Target
0
20
40
60
80
100
120
140
160
180
0 2 4 6 8 10 12 14 Distance (in)
Output Value
Figure 5: Output voltages corresponding to detected distances
Code in its entirety
include <avr/io.h> #include <avr/interrupt.h> #include "PVR_Servos.h" #include "sleep.h" #include "LCD.h" #include "ADC.h" #include "uart.h"
#ifndef F_CPU #define F_CPU 16000000UL // Atmega128 runs at 16mHz #endif #define UART_BAUD_RATE 19200 // Baud rate
void receive(void); void shoot(void); void track(void);
int data[8], pix, con, shotCnt = 0, increment = 0, found = 0, lock = 0, count = 0, TC = 0;
int main(void) { int i, j = 0, bump = 0, IR[4], p = 0b00000000, up = 1, found = 0; int loc[4] = {0, 0, 0, 0}; char c = '\n';
// Initialization functions initSleep(); // Sleep lcdInit(); // LCD display initServo(); // Servos initADC(); // A/D channels DDRA = 0b00001111; // Port A (for A/D Mux) - First four bits to ouput ms_sleep(100); uart_init( UART_BAUD_SELECT( UART_BAUD_RATE, F_CPU ) ); sei(); lcdString("Justin The Conqueror");
lcdClear(); uart_puts("PM 1 \r"); ms_sleep(500); do { c = uart_getc();
} while (c != ':'); ms_sleep(1000);
lcdClear(); uart_puts("SW 1 1 80 143 \r"); ms_sleep(500); do { c = uart_getc(); } while (c != ':'); ms_sleep(1000);
lcdClear(); uart_puts("MM 1 \r"); ms_sleep(500); do { c = uart_getc(); } while (c != ':'); ms_sleep(1000); // End initialization
moveServo4(-70);
while(shotCnt < 10) { moveServo1(-100); moveServo2(100); moveServo3(increment); ms_sleep(50); for (i = 0; i < 4; i++) { PORTA = p; p = p + 2; IR[i] = adcOne(); if (IR[i] > 80) loc[i] = 1; } if (IR[0] > 80 || IR[1] > 80 || IR[2] > 80 || IR[3] > 80) { moveServo1(0); moveServo2(0); moveServo3(0); ms_sleep(25); IRAvoid(loc, IR); loc[0] = 0; loc[1] = 0; loc[2] = 0; loc[3] = 0;
lcdString("Command failed"); ms_sleep(1000); lcdClear(); } TC = 1; } do { c = uart_getc(); lcdChar(c); } while (c != 'M'); c = uart_getc(); i = 0; temp[0] = uart_getc(); temp[1] = uart_getc(); if ((temp[1] >= 0x30) && (temp[1] <= 0x39)) { x = 2; temp[2] = uart_getc(); if (temp[2] >= 0x30 && temp[2] <= 0x39) { data[0] = 100 * (temp[0] - 0x30) + 10 * (temp[1] - 0x30) + (temp[2] - 0x30); } else data[0] = 10 * (temp[0] - 0x30) + (temp[1] - 0x30); } else data[0] = temp[0] - 0x30; lcdInt(data[0]); ms_sleep(250); lcdClear(); }
/*void track(void) { if (data[0] > 32 && data[0] < 48) count++; // Center turret on x = 40 else count = 0; if (count == 5) lock = 1; // If held on target for ~4 seconds lock = true if (!lock) { if (data[0] < 36) increment = increment + 5; if (data[0] > 44) increment = increment - 5; moveServo3(increment); ms_sleep(50); receive(); // if ((data[0] < 10) || (data[0] > 70)) found = 0;// If color lost return to search loop if (data[0] == 0) found = 0;
if (lock && shotCnt < 10) { lcdClear(); lcdString("Lock"); shoot(); receive(); if (data[0] < 10 || data[0] > 70) { found = 0; lock = 0; } if (data[0] < 33 || data[0] > 47) lock = 0; if (data[0] < 36) increment = increment + 2.5; if (data[0] > 44) increment = increment - 2.5; moveServo3(increment); ms_sleep(50); }
}*/
void shoot(void) { DDRE = 0b11111111; shotCnt++; PORTE = 0b11100000; moveServo4(80); ms_sleep(1000); PORTE = 0b00000000; moveServo4(-70); ms_sleep(1000); DDRE = 0b00100000; }