Mr Firefly Final Paper Ms Word1265

download Mr Firefly Final Paper Ms Word1265

of 27

Transcript of Mr Firefly Final Paper Ms Word1265

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    1/27

    University of Florida

    Department of Electrical EngineeringEEL 5666

    Intelligent Machines Design Lab

    Mr. Fireflyby

    Steven Laha !r.

    Instr"ctor# Dr. $ntonio $. $rroyo

    December %&' ()))

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    2/27

    *able of +ontents

    $bstract &

    E,ec"tive S"mmary -

    Introd"ction 5

    Integrated System 5

    Mobile latform 6

    $ct"ation 6

    Sensors 6

    ehaviors %%

    +oncl"sion %(

    Doc"mentation %&

    $ppendices %-

    2

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    3/27

    $bstract

    Mr. Firefly is a robot based on the idea that everyone can use an extra handaround the house or office. This robot will also provide a simple natural interface so thatanyone can easily use the robot with little preparation. The robot will also provide anadvanced platform for a variety of programs to create a variety of different functionswithout many hardware changes.

    3

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    4/27

    E,ec"tive S"mmary

    Mr. Firefly is an entertainment and personal assistant robot. The main purpose ofMr. Firefly is to provide a base that can be easily upgraded with different programs to

    provide various entertainment and personal assistant abilities.Mr. Firefly is outfitted with bump switches, infrared detectors, motion detectors,an RF transmitter, and a speech synthesier.

    The bump switches and infrared detectors allow Mr. Firefly to avoid hittingobstacles or to correct himself when he does. This follows !saac "simov#s first and thirdlaws of robotics, to prevent the in$ury of humans from the robot, and to protect therobot#s own existence. The two infrared detector%emitter pairs are placed in a cross&viewpattern, attached with a type of 'elcro so they can be ad$usted.

    The three Motion detectors placed at (2) degrees from each other give the robot asocial behavior, it allows him to locate human movement and go toward it. These help itinteract with humans. This will be a useful behavior in the case where the robot could be

    programmed as a pet. !f the robot is to be used li*e a personal assistant it can follow its+master around to be at his call.The voice synthesier provides a way for the robot to communicate with its

    owner. The voice synthesier can be used to say anything as it ta*es in "-!! text andoutputs near perfect speech. For a pet program it can be used to bar*, or meow, or evenchirp. For an assistant program it can say a schedule, and even has the ability to dial/TMF tones, so it could even hold phone numbers given the proper programming.

    "dditionally there is the RF receiver, voice recognition, and 01/ face modules,which at this point were not added due to some problems with the remote board andprogramming deadlines. These will allow the robot to respond to human commands, andinteract with a face that provides human to almost human interaction.

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    5/27

    Introd"ction

    The design of Mr. Firefly is based around the home or home office. Mr. Firefly isli*e a personal secretary. !t would allow the user to manage phone calls, and to *eep

    trac* of the day#s events. Mr. Firefly also provides a friendly human to +almost humaninterface. ! feel this is most important, because it allows people to get used to the idea ofwor*ing with robots without having to tal* to a box. erhaps this will even smooth thetransition to the possible future of androids.

    This pro$ect has one main ob$ective, to create a helpful robot that is easy andalmost natural to use. There are a few parts that accomplish this ob$ective on this robotpro$ect. The robot should respond to a set of voice commands thus freeing the ownerfrom some form of remote or having to touch the robot. To increase the compatibility ofthe robot with the user it should also have a voice synthesis system to allow it to spea* tothe user increasing the human li*e interface, and a display as a +face. The robot willalso interact with the telephone. This will let the user use the telephone through the

    robot, hands free, also reducing the need to find a nearby telephone. "lso the pro$ectshould allow for other types of software programs to be downloaded to the robotchanging it#s ma$or function. 4ne example is by downloading new code it should be ableto turn into a robotic pet without need for too many additional sensors if any. Througheach part of the pro$ect the coding should be done so the robot will be entertaining in it#sfinal result, ma*ing it appealing to the general public as well as the user.

    The integrated system of Mr. Firefly will use a variety of circuits to perform thevoice synthesis and recognition as well as the display. The mobile platform will besimilar to the Talri* platforms, rolling on two motoried wheels in a tricycle fashion."ctuation will be provided through mostly two servos and additional parts to create thevarious functions. " variety of sensors will allow the robot to move autonomously andbehave appropriately. The behaviors will allow the robot to interact with humans in away so that it acts more as an animal or human than a robot. The robot will also gothrough a series of experiments to test each of the wor*ing systems and integrate theminto the circuit.

    Integrated system

    Mr. Firefly#s system will wor* much li*e a star networ*, having one centralprocessor that sends and receives information though the processor. !n this system, forexample, the voice synthesis will not have any contact with the voice command system.The main components will be a Motorola 567(( processor, voice synthesis controlsystem, voice recognition control software, display control system, and sensor interfacecontrols.

    8

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    6/27

    T93R4

    :oard

    /isplay Face

    'oice -ynthesis

    -ensors

    RF

    Receiver

    M-.((-ingle chip

    Remote

    :oard

    RF Transmitter

    'oice

    Recognition

    Mobile platform

    Mr. Firefly#s platform relies mostly upon the design of the T9ro and Talri*frames. The robot will roll around on 2 primary wheels controlled by servos, with a thirdnub to balance the robot. The main frame was created using 2 types of plastic, a flexibleyellow for the main dis*, and a rigid blac* plastic for the body. The design is similar tothe T9ro but larger, and with some modifications.

    (Figure 1 - Platform parts)

    $ct"ation

    The ma$ority of the actuation in Mr. Firefly will be to move the robot around andcontrolling its behaviors. The main drive functions will be performed by two servoscontrolling 2 wheels. The servos were hac*ed using the !M/0%Me*atronix method forcontinuous rotation.

    To try to center the servos ;ad$ust the potentiometers so they are e

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    7/27

    and 01/#s will be used for collision avoidance, and give approximate distances to nearbyob$ects. :ump switches will be used to determine when the robot has come into contactwith some ob$ect. Motion detecting of some sort will be used to guide the robot towardits user or toward the nearest human activity. -haft encoders will be used to try to *eeptrac* of how far the robot has traveled for future programming, and possibly used to

    guide it bac* to a recharging station.

    :ump -witches

    ! used 5 bump switches, at about 5) degrees apart. The front one, left, right andall the bac* were separated from each other using the voltage divider mentioned in class;also pictured below=.

    (Figure 2 - Converting bump switches to an analog value)

    -witches 0ow "nalog 'alue 7igh "nalog'alue

    Front 8 3)

    Right 8 88

    0eft 68 >8

    Front and 0eft ()) ()8Front and Right 5) ?)

    :ac* and any other 2)) 288(Table 1 - approximate values for bump switches)

    !nfrared /etector -ensor

    For avoiding obstacles ! used a set of 2 infrared detector%emitter pairs. Thesewere created by collimating the !nfrared diodes and gluing them so they face the samedirection as the detectors. These have a type of 'elcro attached so they can be attachedto the main dis*, but still remain movable. The type of fastener ! used wor*s li*e 'elcro

    but each side is composed of mushroom shape hoo*s, this allows it to be fastened to itselfand is also much sturdier than regular 'elcro, and it has an audible clic* when fastenedtight. The values from the detector range from 68 to 288, ! chose to use >) and ()) aslimits for when it detects an obstacle. "t >) it turns very gradually, at ()) it turnsabruptly and goes in another direction dependent on the angle it ma*es with the wall.

    ?

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    8/27

    (Figure 3 - nfrare! !etector emitter pair)

    Motion /etector -ensor

    4ne of my special sensors was a set of 3 motion detectors. @ith the sensors, therobot should be able to navigate toward human movement. @hen it detects movement itwill rotate toward the movement and then go forward. !deally without any other peoplein the area, it should be able to follow the user. This gives it a sociable behavior much

    li*e a pet or some humans.! bought the motion detector modules from -*ycraft of 4rlando. They had no

    pinouts so ! had to use the pinouts of the chips on the inside to find power and ground.The module runs on a 3.3' supply, but has it#s own voltage regulator so it runs on 8'power. The pins turned out to be, from left to right in the picture of the circuit below,ground, signal, and power. ! hoo*ed this up to the analog port directly to see what *indof response ! would get. The graph below shows the results, which held true for at least 6feet.

    (Figure " - #$-hac%e! &otion !etector output)

    The module acted li*e a permanent switch staying at about 2 volts then going toaround ero and staying there until reset. This would be good for cases where only onemovement is needed to be recorded. 7owever, my robot needed a continuous signal todetect heat without being reset. ! found some pyroelectric detectors are powered by 8'and give out a continuous signal of 2.8' with no motion, and when motion is detected,

    6

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    9/27

    the voltage goes to 8' then to )', or vice versa dependent on direction. ! placed anoscilloscope on the various legs of the chips, which would be easiest to connect to, andsimpler then having to search through the surface mount and traces on the opposite side.

    ! tested each of the pins and got various heat related signals, ! chose pin one of theMotorola chip because it seemed to be the best response for what ! needed, and gave a

    good distance for detecting the heat. To ma*e it easy ! clipped the original signal pin andattached the first pin of the Motorola chip to that signal pin with a soldered wire. Thiswould ma*e the module almost identical as the original, only giving a continuous signaloutput. /ue to the nature of the T9ro board ! had to modify the wires leading to thedetector from the board so, ! could get the proper signal on the proper wire. :elow is adiagram of the circuit after being hac*ed, the gray wire is the hac*ed signal being broughtout to the connector. "fter seeing how the signal changed with the two variable resistors,! choose to *eep them as they were from the factory, all the others limited my range ofheat detection. Aotice the lastic housing on the pyroelectric detector this gives thedetector about (6) degrees of freedom.

    The chart below shows the values ! received for different distances. This shows

    that ! get a good range of values, which can be used to show the robot that heat is present.To get the data for the chart ! used a simple analog recording program that sends the datato the terminal window in !, which has a capture option. ! used excel to ta*e that listof comma separated values and create the graph of data. My program is listed in theappendices as "nalog(.c.

    pyroelectric sensor

    (# 2# 3# # 8# 5# ?# 6#

    &distances from motion detector &

    (Figure ' - &otion !etector circuitr) (Figure - *ac%e! motion !etector !ata)

    These motion sensors tend to be unpredictable at times. The output depends

    highly on the settings of the two variable resistors, and since ! have no data, ! set them tobe the same as the best wor*ing one. This seems to be with the resistors set at almostero.

    RF Transmitter and Receiver

    !n my final design ! could not get the RF communication wor*ing as ! could notget the remote board wor*ing. The RF modules were from Reynolds 1lectronics

    >

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    10/27

    ;7ttpB%%www.rentron.com=. ! did test the RF modules by hoo*ing the serial data out ofthe robot board to the transmitter, and connected the receiver module to the serial cableconnected to the 4M board to the computer. ! used the analog displaying program onthe robot and *ept the speed at >5)) on the board. The two boards were separated byabout 3& inches but had no antenna. The data was almost exactly the same, at the

    beginning of every line there were some errors, but at a lower speed and with an antennathe data would probably be a lot better and able to go the distance of ))C feet ;as per thedata sheet=.

    (Figure + - ,F mo!ules from ,enol!s .lectronics !atasheets)

    'oice Recognition

    "dditionally without a wor*ing remote board, the voice recognition module couldnot be used. ! first tried ma*ing my own voice recognition module. ircuit ellar !ADhad an article in their February (>>6 issue by :rad -tewart. This one claims to offer (5&word voice recognition for around E8. This one uses a 5?7?)8 and some amplificationcircuitry. ! had little experience with the ?)8 and could not alter it to be used on the567(( so ! decided to try that when ! had more time to wor* on it.

    ! eventually bought the 'oice /irect 35 from -ensory !nc.;7ttpB%%www.sensoryinc.com=. This module offers (8&word recognition in stand&alonemode and up to 5) words if controlled with a microprocessor. The stand&alone modere

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    11/27

    To interface the board, ! connected the serial out of the -! of the T9R4 boardto the -erial input of the voice synthesier. This meant that ! could say anything simplyby using a printf statement in my code. This helped when debugging my system as !could have it tell me what mode it was in. 4ne problem with loops is that it tends torepeat what it says a few times if not handled properly. "lso when using !, the speech

    tends to isolate itself from the other commands, so when designing a demo involving thespeech and the motors, all the motor commands ended up running at once and the speechcontinued over the speech. For my demo with this problem, ! choose to run the motorsfirst and then have it do the tal*ing.

    01/ matrix display

    To provide a better human response to the idea of a robot ! thought the idea of aface would ma*e it more li*e a human. ! got the idea from the 4ctober 2))) issue ofAuts and :olts. !n this article, the person creates an 6x6&display face using the MaximM"?2(> display driver ;7ttpB%%www.maxim&ic.com=. This can drive 6 seven&segmentdisplays, or an 6x6 matrix. These chips have information in the datasheets that allow it tobe hoo*ed up to an -! system. This made the displays easy to use and provided all thescan coding needed to *eep the display lit. :elow is the wiring diagram, for the oppositeside ! switched the columns so ! could get a mirror image and minimie coding.

    (Figure / - 0. matrix wiring !iagram)

    /ue to time delays, ! did not get around to programming the display so ! left thatas a future improvement. !t should be simple to code but at this point, ! felt it was best !wor* on the sensors before wor*ing on advancements.

    ehaviors

    The ma$or behavior of Mr. Firefly is that of a servant, following his master aroundresponding to commands. !t should be able to answer the telephone on command. !naddition, it should read various groups of information upon command. @hen left alone itshould go into sleep mode if no activity is around for it to follow. 1very so often itshould wa*e up chec* for activity, then go bac* to sleep until it finds activity.

    ((

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    12/27

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    13/27

    Doc"mentation

    /eagan, Tim, rosthetic -arcasm with 1moticons for -peech, Auts and 'olts, 4ctober2))) pg. ()&(.

    9.0. 9ones, :. ". -eiger, ". M. Flynn, Mobile Robots !nspiration to !mplementation,-econd 1dition. " D eters, Aatic*, M", (>>>.

    Martin, Fred, The 5.2?) Robot :uilders Huide. M!T, (>>2.

    Me*atronix T9 ro Manual, (>>8.

    Me*atronix M-(( Manual, (>>8.

    -tewart, :rad, 0ow ost 'oice Recognition, ircuit ellar !AD, February (>>6.

    /atasheets for the RF modules, Max?2(> chip, 01/ displays, -peech synthesier, 'oicedirect 35.

    Special *han/s *o

    /r. "rroyo/r. -chwartRand handler-cott Aortman"ll the fellow !M/0 studentsHail and -teve 0ahaMaxim semiconductors

    @ithout their help, support, and patience my robot would not have been possible.

    (3

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    14/27

    $ppendices

    "ppendix "/iagrams of the main systems and wiring ;not all wires shown=

    (Figure ,emote boar! laout)

    (Figure &ain boar! laout)

    (

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    15/27

    "ppendix :rice list of ma$or parts

    art urchased from rice ITJ Total

    -ervos Me*atronix E().)) 2 E2).))

    T9R4 board ;asmb= Me*atronix E58.)) ( E58.))

    !R detectors Me*atronix E3.)) 3 E>.))!R emitters Me*atronix E(.)) 3 E3.))

    M-(( board Me*atronix E().)) ( E().))

    'oice /irect 35 "ll 1lectronics ;-ensory !nc.= E8).)) ( E>.>8

    01/s "ll 1lectronics7ttpB%%www.allelectronics.com

    E.(8&E.8) E(.3)

    01/ 6x6 Matrix 7osfelt7ttpB%%www.hosfelt.com

    E(.)) 2 E2.))

    Max?2(> display chips Maxim&!7ttpB%%www.maxim&ic.com

    E).)) 2 E).))

    RF R%T Reynolds 1lec.7ttpB%%www.rentron.com

    E().)) 2 E2).))

    Resistors and Misc. -*ycraft and 1lectronics plus"ntenna -*ycraft E(.)) ( E(.))

    lastic sheets -*ycraft E(.)) 3 E3.))

    Motion /etectors -*ycraft E3.)) 3 E>.))

    "ppendix ode for Mr. Firefly

    "nalog(.c/********************************************************************* Title: analog1.c ** Programmer: Steven LaPha Jr. ** Date: 10/24/2000 ** Version: 1.0 ** Description: To log the ata receive !rom an" analog ** sensor hoo#e $p to the analog%1& port ** on the t'pro (oar. *********************************************************************/

    /*********************)ncl$es**************************************/incl$e +t'p(ase.h,incl$e +analog.h,incl$e +stio.h,

    /********************-onstants**************************************/e!ine sensorval analog%1&/********************ain program***********************************/voi main %voi&int sense i ' #initanalog%&*%$nsigne char*& 030005030 /* t$rn on )6 emitters*/print!%78nalog Val$es o! Sensor7&

    (8

    http://www.rentron.com/http://www.rentron.com/
  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    16/27

    '519hile %1&sense 5 sensorvalprint!%7;t ;n7 ' sense&!or %i50 i+

    >

    %KKKKKKKKKKKKKKKKKKKKKK1nd "nalog(.cKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%

    "nalogall.c%KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK TitleB analogall.c KK rogrammerB -teven 0aha 9r. KK /ateB ()%2%2))) KK 'ersionB (.) KK /escriptionB To log the data recieved from any analog sensor hoo*ed up to the analog;2=

    K

    K port on the t$pro board. KK KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%

    %KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK!ncludesKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%Linclude t$pbase.hNLinclude analog.hNLinclude stdio.hN

    %KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKonstantsKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%Ldefine sense) analog;)=Ldefine sense( analog;(=Ldefine sense2 analog;2=

    Ldefine sense3 analog;3=Ldefine sense analog;=Ldefine sense8 analog;8=Ldefine sense5 analog;5=Ldefine sense? analog;?=%KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKMain programKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%void main ;void=O

    int i, $GinitPanalog;=GK;unsigned charK= )x?)))Q)xFF G %K turn on !R emittersK%printf;"nalog 'alues of -ensor Sn Sn=Gprintf;"nalog), "nalog(, "nalog2, "nalog3, "nalog, "nalog8, "nalog5, "nalog?GSn=G

    $Q(Gwhile ;(=O

    printf;d,St d,St d,St d,St d,St d,St d,St d,St d Sn, $, sense), sense(, sense2,sense3, sense, sense8, sense5, sense? =G

    for ;iQ)G i2)))G iCC=G$Q$C(G

    UU%KKKKKKKKKKKKKKKKKKKKK1nd "nalogall.cKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%

    (5

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    17/27

    t$pff.h%KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK Title t$pbase.h KK rogrammer Deith 0. /oty % -teven 0aha 9r. KK /ate /ecember , 2))) KK 'ersion (.( with servo drivers KK KK /escription K

    KK ollects include files and general constants into one file. KKmodified by -teven 0aha 9r. for Mr. Firefly KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%

    %KKKKKKKKKKKKKKKKKKKKKKKKKKK !ncludes KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%

    Linclude analog.hNLinclude cloc*t$p.hN

    Linclude motort$p.hNLinclude servot$p.hNLinclude serialtp.hNLinclude isrdecl.hNLinclude vectors.hN

    %KKKKKKKKKKKKKKKKKKKKKKKK 1nd of !ncludes KKKKKKKKKKKKKKKKKKKKKKKKKKKK%

    %KKKKKKKKKKKKKKKKKKKKKKKKKKKK onstants KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%Ldefine 01FTPM4T4R )Ldefine R!H7TPM4T4R (Ldefine M"P-11/ ())Ldefine V1R4P-11/ )

    Ldefine -T"RT while;:WM1R()=Ldefine -@T7 analog;)=Ldefine :WM1R analog;(=Ldefine R!H7TP!R analog;2=Ldefine 01FTP!R analog;3=Ldefine RMotion/ analog;=Ldefine 0Motion/ analog;8=Ldefine :Motion/ analog;5=Ldefine '4!1 analog;?=Ldefine R"A/4M TAT

    Ldefine FR4ATP:WM ;:WM1RN8=XX;:WM1R3)=

    Ldefine R!H7TP:WM ;:WM1RN8=XX;:WM1R88=Ldefine 01FTP:WM ;:WM1RN68=XX;:WM1R>8=Ldefine F0P:WM ;:WM1RN())=XX;:WM1R()8=Ldefine FRP:WM ;:WM1RN5)=XX;:WM1R?)=Ldefine :"DP:WM ;:WM1RN2))=

    Ldefine RM/ ;RMotion/>)=Ldefine 0M/ ;0Motion/>)=Ldefine :M/ ;:Motion/>)=

    (?

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    18/27

    %K 1nable 4 interrupt and all servo operations K%Ldefine -1R'4-P4A -1TP:!T;TM-D(,)x()=

    %K/isable 4 interruptB -tops all servo holding tor

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    19/27

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    20/27

    Oint iG

    if ;$N)=O

    Motor0QMotor0K$%;$C(=Gfor;iQ)Gi8)GiCC=G

    Uif ;*N)=O

    MotorRQMotorRK*%;*C(=Gfor;iQ)Gi8)GiCC=G

    UU%KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%

    void setmotor;void=O

    motorp;01FTPM4T4R,MotorR=Gmotorp;R!H7TPM4T4R, Motor0=G

    U

    %KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%%%not fully wor*ing, wor* in progressvoid rotate;int angle=Oint iG

    if ;angleN)=O

    motors;8),&8)=Gfor ;iQ)G iangleGiCC=Gmotors;3),3)=G

    UelseO

    angleQ&angleGmotors;&8),8)=Gfor ;iQ)G iangleGiCC=Gmotors;3),3)=G

    U

    U%KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%void spea*;int says=O

    int i,xGxQ(G%%front bumper

    if ;saysQQ(=O

    printf;4uch that hurts. Sn=GsaysQ)GsayQ)G

    U%%right bumperif ;saysQQ2=O

    printf;1xcuse me. Sn=G

    2)

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    21/27

    saysQ)GsayQ)G

    U%%left bumperif ;saysQQ3=O

    printf;7ey watch out. Sn=GsaysQ)GsayQ)G

    U%%bac* bumperif ;saysQQ=O

    printf;4ooops. Sn=GsaysQ)GsayQ)G

    U%% demo

    if ;saysQQ8=O

    printf;Hood afternoon 0adies, Hentlemen, and fellow robots.Sn=Gwait;())=G

    printf;This is !.M./.0., Fall 2))). Sn=Gwait;8)=G

    printf;My Aame is Mister Fire&fly. Sn=Gwait;8)=G

    printf;My robot is -teven 0aphay $unior. Sn=Gwait;8)=G

    printf;My robot builds people li*e me, stays up late, procrastinates, but is the smartestrobot ! *now. Sn =G

    wait;8)=Gprintf;ourse ! only *now one robot. haaaa haaaa haaaaa. Sn=G

    wait;3)=G

    printf;1nough about my robot, now on to what ! can doY Sn =Gwait;()))=G

    wait;())=Gmotorsinst;3),3)=Gwait;()))=Gmotorsinst;),)=Gwait;()))=Gmotorsinst;),2)=Gwait;3)=Gmotorsinst;),&2)=Gwait;()))=Gmotorsinst;),)=Gwait;())=G

    motorsinst;2),)=Gwait;()))=Gmotorsinst;),)=Gwait;3)=Gmotorsinst;),&)=Gwait;()))=Gmotorsinst;),)=Gwait;())=G

    printf; "s you can see, ! move around on my own free will.Sn=Gwait;())=G

    2(

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    22/27

    printf;! can move left, right, bac*wards, and forwards.Sn=Gwait;())=G

    printf;!Zve also been, dec*ed out, in all these state of the art, electronic gimos. Sn=Gwait;))=GsaysQ)GsayQ)G

    Uif ;sayQQ5=O

    printf;4ne of my gimos, that is still being wor*ed on, is a voice recognitionunit. Sn=G

    wait;5)=Gprintf;!t will then allow me to understand from, (8 to 5), human words=Gwait;2))=Gprintf; That reminds me of a $o*e. Sn=Gwait;5)=Gprintf;" robot, trained to obey all human commands was sitting in a court

    room. Sn=Gwait;5)=Gprintf;The $udge said, 4rder in the ourtroom. Sn=G

    wait;5)=Gprintf; The robot

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    23/27

    wait;3))=Gprintf;4n the remote control -teven is pointing out, man is that a wierd loo*ing

    remote. Sn=Gwait;2)))=Gprintf;! bet ! could build a better one Sn=Gwait;2))=Gprintf;"nyways, on the remote is the voice recognition module, a processor

    board to wor* with the signals, and an RF module to send the data to me. Sn=Gwait;3))=Gprintf;!n the future ! hope -teven will add more to me, and ma*e me even

    better. Sn=Gwait;8))=Gprintf;"nd A4@ what youZve all been waiting for Time to watch me in

    action Sn=Gwait;()))=GsaysQ)GsayQ)G

    Uif ;sayQQ>=O

    printf; 7ey you on the right Sn=Gwait;())=GsaysQ)GsayQ)G

    Uif ;sayQQ()=O

    printf;/onZt thin* youZre going to get rid of me by staying on my left side Sn=Gwait;())=GsaysQ)GsayQ)G

    U

    if ;sayQQ((=O

    printf;@hat are you doing behind me[ Sn=Gwait;())=GsaysQ)GsayQ)G

    Uif ;sayQQ(2=O

    printf;!Zm following you. Sn=Gwait;())=GsaysQ)GsayQ)G

    UsaysQ)Gwait;()=G

    U

    %KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%%%sets motor speed to be even instantlyvoid motorsinst;int ml, int mr=O

    23

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    24/27

    if ;mlN)=motorp;),mlC5=G

    elsemotorp;),ml=G

    if ;mr)=motorp;(,mr&5=G

    elsemotorp;(,mr=G

    U

    %KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%void behavior;void=Oint iG%%ollision detection behavior

    if;:WM1RN()=Oif ;R!H7TP:WM=

    Owhile;R!H7TP:WM=O

    motors;&3),&()=G

    for;iQ)Gi8))GiCC=GUsayQ2G

    Uif ;01FTP:WM=O

    while;01FTP:WM=O

    motors;&(),&3)=Gfor;iQ)Gi8))GiCC=G

    UsayQ3G

    Uif ;:"DP:WM=O

    while;:"DP:WM=O

    motors;),&)=Gfor;iQ)Gi8))GiCC=G

    UsayQG

    Uif ;FR4ATP:WM=O

    while ;FR4ATP:WM=O

    motors;&3),&3)=Gfor;iQ)Gi8))GiCC=G

    UsayQ(G

    U

    2

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    25/27

    UelseO

    %%ollision avoidance behaviorif;01FTP!R N!R00 \ R!H7TP!RN!RR0=O

    if ;01FTP!R !R07=O

    %%left lowif ;R!H7TP!R!RR7=O

    %%left low, right low%%low turnif;01FTP!RNR!H7TP!R=Omotors;;Motor0&()=,;MotorRC()==Gfor;iQ)Gi2))GiCC=GUelseO

    motors;;Motor0C()=,;MotorR&()==Gfor;iQ)Gi2))GiCC=GU

    UelseO

    %%left low, right high%% hard rightmotors;;Motor0C2)=,;MotorR&2)==Gfor;iQ)Gi2))GiCC=G

    UU

    elseO

    %%left highif ;R!H7TP!R!RR7=O

    %%left high, right low%%hard leftmotors;;Motor0&2)=,;MotorRC2)==Gfor;iQ)Gi2))GiCC=G

    UelseO

    %%left high, right high%%hard turn

    if ;01FTP!RNR!H7TP!R=Omotors;;Motor0&2)=,;MotorRC2)==Gfor;iQ)Gi2))GiCC=G

    Uelse

    28

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    26/27

    Omotors;;Motor0C2)=,;MotorR&2)==Gfor;iQ)Gi2))GiCC=GU

    UU

    UelseO

    if;RM/ \ 0M/ \ :M/=O

    if ;RM/ X Y0M/=O

    sayQ>Gwhile;RM/=Omotors;),&)=G

    for;iQ)Gi2)))GiCC=G

    U

    Uif ;0M/ X YRM/=O

    sayQ()Gwhile;0M/=Omotors;&),)=G

    for;iQ)Gi2)))GiCC=GU

    Uif ;:M/ X YRM/ X Y0M/=

    Owhile;:M/=OsayQ((Gmotors;&8),8)=Gfor;iQ)Gi5)))GiCC=GU

    Uif ;RM/ X 0M/ X Y:M/=O

    sayQ(2Gmotors;),)=Gfor;iQ)Gi()))GiCC=G

    U

    UelseOmotors;),)=GU

    UU

    U

    25

  • 8/12/2019 Mr Firefly Final Paper Ms Word1265

    27/27

    %KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKK%