ECSE 211 - Autonomous Block Stacking Robot - Project Documentation
description
Transcript of ECSE 211 - Autonomous Block Stacking Robot - Project Documentation
P a g e | 1
Roy Breidi
Alexander Hugh Sam
Payom Meshgin
Paul Sticea
April 8, 2011
Team18:ProjectDocumentation
Team 18
McGill Department of Electrical & Computer Engineering
ECSE-211: Design principles & methods
P a g e | 2
TableofContents1.Requirements1.1.0‐Capabilities1.1.1‐Purpose1.1.2‐Scope1.1.3‐Constraints1.1.4‐UserFunctions1.1.5‐OperatingEnvironment1.1.6‐Performance1.2.0‐Compatibility1.2.1‐ComponentRe‐use1.2.2‐Compatibilitywiththirdpartproducts2.Constraints2.1‐EnvironmentalIssuer2.2‐HardwareConstraints2.3‐SoftwareConstraints2.4‐AvailabilityofResources2.5‐Budget3.Capabilities
3.1‐TeamMembers3.2‐Capabilities3.3‐PossibleApplicationAreas3.4‐Availability
4.Systemdescription4.1SystemModel4.2HardwareAvailableandCapabilities4.3SoftwareAvailableandCapabilities4.4Compatibility4.5Re‐usability4.6Structures4.7Methodologies4.8Tools
AppendixA:GanttChartsAppendixB:BudgetbreakdownAppendixC:MechanicalandPhysicalStructureAppendixD:SoftwareDevelopmentAppendixE:TestingDocumentGlossaryofTermsReferences
P a g e | 3
1.Requirements1.1.0CAPABILITIES
1.1.1PURPOSEThe purpose of this project is to design an autonomous machine capable of navigatingwithinanenclosedmaze.ThemazewillcontainStyrofoamblocksthatneedtobegatheredandstackedatagivenposition.Therewillalsobeobstaclesthattherobotneedstoavoidwhilecompletingitstask.Byautonomouswemeanthattherobotshouldbeabletolocalizeitselfinsidethemazeandnavigate towanted locationswithout assistance from the user. The robot is expected tocircumventobstaclesandavoidcollisionswiththewall.TheStyrofoamblocksshouldbepiledintoasinglestablestructureataspecificlocation.
1.1.2SCOPE
Thesizeofthemazewillbe12x12feetandwillbesubdividedintosquaresof30.48cmoflength. The squares are separated by black lines of 7mm in thickness. The height of thewallsaroundthemazeis7.625inches.ThesizeofoneStyrofoamblockis2x2x4inches.Thesizeofonecinder‐blockis7.625x7.625x15.625inches.Thecompetitionwillconsistof3independentrounds.Allroundsinvolvethesametaskofbuildingthetalleststablestructurepossible.Rounds1and2willaresimilarintermsoftheevaluationmethodwhiletheevaluationinround3isbasedonascorecalculatedfromtheheightofthestructureandthetimetobuild.Eachattemptwillhaveamaximumdurationof10minutes.Thefinalproductisaone‐shotoperation.
1.1.3CONSTRAINTSThe final product must be composed of at most 3 Lego Mindstorm NXT Kits and anyadditionalcomponentsshouldbeapprovedinadvancebytheclient.Also,TherobotmustbeprogrammedusingJava.Theclienthasimposedatimedeadlineonthedesign,itshouldbe completed by Wednesday April 6th 2011.The design process will be spread over aperiodof6.5weeks,overwhichnomorethan234man‐hoursareallocatedforthepurposeofthisprojectbeingateamof4people.
P a g e | 4
Therehavebeen specifications on the size but none on theweight. The robot should bemade inaway such that the center is locatedwithin the cornergrid square.Thismeansthat therobot’scentershouldbeatmost30cmfromits farthestpointon therobot.Thebricksarealsopoweredby6AAbatterieseach.Wemustensurethattherobotisabletorunfor the10minutesrequired for the finalcompetitionwithoutrunningoutofbattery.Formoredetailsontheconstraints,pleaserefertosection2. 1.1.4USERFUNCTIONSTheuserisallowedtomakechangestothedeviceatanytimeoutsideofarun.TherewillbeanaccessiblemenuontheNXTbrickscreen inordertostart therobotandpair itup,usingBluetooth.However, theuser isnotallowedto interferewith therobot’soperationafter it receives its destination from themain computer using Bluetooth. If the robot isusingmore than 1NXTbrick, they should be all started, and then programs running onthemwillconnecttoeachotherandtakeoverfutheroperations.
1.1.5OPERATINGENVIRONMENT
The competitionwill be held on the second floor in the LorneM. Trottier building. Therobotwilloperateona12x12footflatbrightwoodensurfacesubdividedintogrid‐linesof30.48 cm apart. When the maze is setup, appending the 4x4 tiles might lead to cracksvaryingthegrid‐linethickness.Alsoatsomeplaces,thecolorofthegrid‐lineiswashedoutwhichmightaffectthelocalizationoftherobot.Theambientlightmightchangebasedonthe time of day or the location of the maze which should be taken into account whenimplementing the light sensor. Also we should take into consideration the presence ofspectators that could falsify the readings taken by the light sensors, because of theirshadows.Thereislikelygoingtobealotofsoundatcompetitiontimebutitisnotexpectedtoaffect theoperationof therobot.Temperaturewillbeveryclosetoroomtemperaturesince the competition is held indoors and thus there is no worry concerning having adifferentgripofthewheelsthantheonetestedinthelabs..
1.1.6PERFORMANCETherobot is supposed tooperate forat least for thedurationof1 round(10min). Itwillhavetotravelinsidethemazeuntilitachievesitsgoal.Therobotmustreactrelativelyfasttocommandsbecauseoftimeconstraints,itcannotgoover10minpersingleround.(Alsorefertosection1.1.2and1.1.3)
1.2.0COMPATIBILITY 1.2.1COMPONENTRE‐USEComponentreusefromthelabsisencouragedwhilereusefromexternalsourcesrequiresproofofauthorization.AllthesoftwarecomponentsthatwereprogrammedforbasictasksduringtheR&Dlabssuchasfilteringandodometrycanbereusedforthisproject.
P a g e | 5
1.2.2COMPATIBILITYWITHTHIRDPARTPRODUCTSThe systemwill have to interfacewith an IDE such asEclipse. Itwill have to implementBluetoothtechnologytocommunicateduringboththedesignandthecompetitionphase.
P a g e | 6
2.Constraints2.1ENVIRONMENTALISSUESRefertosection1.1.5“OperatingEnvironment”.2.2HARDWARECONSTRAINTSTheautonomousmachinewillbeassembledusingcomponentsfromthreemindstormkitswhichisprovidedwith1NXTBrick.Anyothermaterialmustbeapprovedbytheclient.TheNXTbrickiscomprisedof:‐1USB2.0port,touploadthesoftware.‐3outputports,toconnecttheservomotorstothebrick.‐4inputports,toconnectthesensorstothebrick.‐4sensors(touch,light,ultrasonic,sound)‐3interactiveservomotors.Legocomponentscomewithpredeterminedshapesandlengthsanditissometimeshardifnotimpossibletoimplementanyimagineddesign.Oneunitinlegois9mm(fromholetohole).Andtheincludedpartsmakeanglesofaminimumof45degrees,soitisalsohardtomakesolidstructureswithangleslessthan45degrees.Theprovidedaxes(thatfitinsidethemotors)arebendableandmightbendunderheavyweight.TheNXTbrickuses6AAbatteries,supplyingpowertothesensorandtheservomotorswhichmighthavedifferentbehaviourrelativetotheremainingbatterypower.Ifweusemorethanonebrick,andchoosetocommunicatethroughanRJ12cable,weshouldreserveport#4ontheNXTsforthisactionsinceitistheonlycapableofestablishinganRS485connection.ThisisalistofthehardwarespecificationsoftheNXTbrick(takenfromthelegowebsite):
32‐bitARM7microcontroller 256KbytesFLASH,64KbytesRAM 8‐bitAVRmicrocontroller 4KbytesFLASH,512ByteRAM Bluetoothwirelesscommunication(BluetoothClassIIV2.0compliant) USBfullspeedport(12Mbit/s) 4inputports,6‐wirecabledigitalplatform(OneportincludesaIEC61158Type 4/EN50170compliantexpansionportforfutureuse) 3outputports,6‐wirecabledigitalplatform 100x64pixelLCDgraphicaldisplay Loudspeaker‐8kHzsoundquality.Soundchannelwith8‐bitresolutionand2‐16
P a g e | 7
KHzsamplerate. Powersource:6AAbatteries Threeservomotors Atouchsensor Anultrasoundsensor Asoundsensor Alightsensor
2.3SOFTWARECONSTRAINTSSinceweareusingLeJOS(LegoJavaOperatingSystem),allcodemustbewritteninjavausingtheclassesthatcomewiththeMindstormkitsandsomealreadyavailablejavaclassessuchastheMathclass.TheNXTbrickfeaturesapowerful32‐bitARM7microprocessor,a256kbytesFlashmemoryanda64kbytesRAM.ItalsohasasupportforBluetoothandRS485.Afterreceivingthepositionatwhichthestructuremustbebuilt,thesoftwareshouldbecompletelyautonomous,onlyinputusedbeingtheonefromthesensors.Thesoftwareusedallowsustoprogramandcontrolthedifferentservomotorsandthemultiplesensors.Also,thenumberofthreadsshouldbekeptsmallerthanadeterminedthresholdsothatitdoesnotaffecttheperformanceoftherobot.
2.4AVAILABILITYOFRESOURCESTherewillbeatleastoneweeklymeetingeachWednesdayfrom9:30to11:30.AnyothersupplementalnecessarymeetingcanbeaccommodatedonMondayorFridaymorningduringthesametime.Outsideofthemeetingtimes,eachteammembercanworkindividuallyondifferentpartsoftheprojectordocumentationassignedbytheteammanager.Whendifferentintersectingpartsoftheprojectsneedtobeconnectedorintegratedintothedesign,allconcernedteammembersshouldbepresentinordertoquicklymaketheirfixesoradaptationsincaseoffailure.Themaincriticalpathtaskishavingthestructureoftherobotreadyinordertobeabletointegrateandtestthesoftwareonit.Pleaserefertosection3.4formoredetailedinformationonteamavailability.2.5BUDGETConcerningthetimebudget,eachteammemberbeingexpectedtoworkforanaverageof9hrs/week,thiswillsumuptoamaximumof250hours.Thistotaltimewillbedividedforthedifferenttasksasspecifiedintheganttchart(AppendixA).TheprojectwillbecompletedbyApril6th2011,butweexpecttohaveafunctionalrobotbyApril23rd2011,sothelasttwoweekswillbededicatedtotestingandoptimizationofthesoftwareandhardwarecomponents.Otherthanthetimebudget,weexpecttohavespendingsonbatteries(max40$)andacolorposter(max40$).Thefundingfortheseitemswillcomefromtheteammembers.
P a g e | 8
3.Capabilities
3.1TEAMMEMBERS
Name McGillEmail
RoyBreidi
roy.breidi
PaulSticea
paul.sticea
AlexanderHugh
Sam
Alexander.hughsam
PayomMeshgin
payom.meshgin
3.2‐CAPABILITIES
Thefollowingtableunderlinestheteammember’scapabilitiesaswellastheirinterestinallofthedifferentfieldsrelatedtotheproject.(Allvaluesareover10)
Roy Paul Alexander Payom
P a g e | 9
Electrical Experience 4 5 3 4
Interest 5 4 5 5
Mechanical Experience 4 5 4 3
Interest 5 6 8 5
Software Experience 9 8 5 6
Interest 9 10 5 6
Documentation Experience 5 6 3 4
Interest 4 5 6 2
Management Experience 8 6 4 4
Interest 8 6 5 4
3.3‐POSSIBLEAPPLICATIONAREASWehadaroughsubdivisionoftasks:RoywillberesponsibleforLocalization,PCCommunicationandinter‐brickcommunication,Odometrywithitscorrection.PayomwillberesponsibleforNavigation,blockdetectionandobstacledetection.Paulwillberesponsiblefortheoverallstrategyincludingtheobstacleavoidance.Alexwillberesponsibleforthephysicalstructureoftherobotandthemechanics.Sinceweareshortstaffed,wewillallbeworkingonpartsofthedocumentation.
3.4‐AVAILABILITYWeeklyAvailability:
AweeklymeetingwillbeheldonWednesdaysfrom9:00amto11:30amwherealltheteammemberswillbepresent.Thisdoesnotpreventothersmallersessionstooccurduringeachweek.Everytwoweeks,twoofthemembershaveanElectricCircuitsquizandmaynotbepresentonthemeetings.
P a g e | 10
P a g e | 11
4.SystemDocument4.1SYSTEMMODELTherobotshouldbeabletoperformsomebasicfunctionslikethefollowing:Localization:Therobotwillbeplacedinanyorientationonanyofthebottomcorners.Itwillfirstbeabletolocalizeandalignitselfonthefirstgridintersection.Navigation:‐Therobotshouldbeabletonavigateaccuratelyinsidethemazeaccordingtoacertainstategytofindblocksandavoidobstacles.Objectdetection:‐Therobothastodifferentiatetheblocksthatshouldbepickedupfromtheobstacles(bricks)soitdoesn’tcrashintothem.ObjectsStacking:‐Therobotmustpickuptheblocksandstackthemcorrectlyintoourcageuntilitreachesthedrop‐offarea.ObjectDelivery‐Therobotshouldbeabletogetthepalletstotheonebyonefootdrop‐offareaanddropthemoffcorrectlystackedwithinthe10minutesconstraint.ObstacleAvoidance:‐Therobotshouldbeabletoaccomplishtheprevioustaskswhileavoidinganyobstaclesonitspath.Communication‐RecevingtheinformationfromtheserverviaBluetooth.UsingtwoNXTStheyshouldbeabletocommunicatewitheachother,onebeingthemasterandtheothertheslave.BelowisapreliminaryClassdiagramsummarizingthebasicfunctionsoneachNXT:
P a g e | 12
4.2HARDWAREAVAILABLEANDCAPABILITIESReferto2.2forthehardwareconstraints.Themajorelectromechanicalconstraintthatwehavewouldbethelimitedpowergivenbythebatteries.Thismeansthatwhenthebatterieshavebeenused,theoverallsystemperformancewillalsodegrade.TheNXTBlockisa48MHzprocessorandhasamaximumof256KBofFLASHmemory,andcontains64KBofRAM.Italsouses32‐bitcalculations,soeverydoublewillbeconvertedtofloat.4.3SOFTWAREAVAILABLEANDCAPABILITIESReferto2.3forthesoftwareconstraints.Eclipseisoneofthemajortoolsthatweusetoprogramtherobot.Itispreferredtoothersimilarsoftware,sinceEclipsehasacapabilitytofunctionwithLEJOS,whichisneededtoactuallyrealizethisproject.Eclipsealsohasabuiltinerrordetection,similartoMicrosoftWord’sspelling&grammardetection,whereitcoulddetectoursyntacticalmistakesthusmakingthedevelopmentprocessmorefluidandefficient.Javaistheprogramminglanguageofchoice,sincewealreadyuseitinapre‐requisiteforthiscourse,COMP‐202.Wearealreadyfamiliarwiththislanguage,soitiseasiertoadapttoallthedifferentcomplicationswecouldhavewhenusingtheLejoscomponents.
P a g e | 13
4.4COMPATIBILITYThelegocomponentswehaveinourkitshavecertainrequirements,sinceyoucanonlyattachcertainpiecesinacertainway,andcannotputanypieceyouwanthoweveryouwant.Wehavetousea32‐bitJavacompiler,sincementionedabove,theNXTbrickprocessorworkswith32‐bitcodesonly.Bluetoothwillbeathirdpartysystemthatwewillusetogiveourrobotthecoordinatestogoto.Duringthefirstsixweeksofclass,wehavedevelopedalotofdifferentcodethatwewillbeusingforthisproject,likethenavigatorclass,theodometryclass,thelocalizationclassandtheBluetoothclass.Theseclassesshouldworkinanyenvironmentthatwecouldpossiblyfaceduringthisproject,sotheydonotbringanyconstraintstothemakingofourrobot.Wewillnotbeusingthemechanicaldesignswehaveusedinourpreviouslab,sincewewillbeusingtwoNXTbricks,thereforewearegoingtodesignourownmachine.4.5REUSABILITYRefertosection1.24.6STRUCTURESTomakesuretheStyrofoamblockswillbedetectedbythelightsensorandwillbegrippedin the right direction by the grippingmechanism,wewill use a “Y” shaped structure infrontoftherobottoserveasafunneltoplacetheblockinagoodposition.Wearegoingtouseacagestructuretocontainalltheblocksthatwewillbepickingupandit will also prevent from the stack of styrofoam blocks to fall.We have decided on thisstructure,sinceitwillbeeasier,saferandfasterthantakingonlyoneblockatatimeandpiling themupat thedropzone.Furthermore, therewillbea lift thatwillbeperformingtwo functions in our blockmanipulation. At first, wewanted to use a lift thatwill slideundertheblocksandwewouldthenproceedtolifttheblockupusingaliftingmechanism,butwesoonrealizedthatslidingundertheblockisaverydifficulttasktodo.Instead,webuiltagrippingmechanismthatwillholdtheblock inplace,whilethe liftingmechanism,willliftit.Fortheliftingmechanism,weoptedtousefishwire,sinceitisverysolidandwillbestrongenoughtoliftthegripperandtheStyrofoamblock.Thegripperwillbeputonarailing system,whichwill aid the fishingwire,which is attached to amotor, to lift it upconsistently,andwithoutanywobbling.TwoNXTbrickswillbeusedtocompensateforthelack of input and output ports. They will be linked using a RJ12 wire to be able tocommunicatewitheachotherandwithoutusingBluetooth, sinceweexpect thewirelessconnectiontobeunreliable.OursoftwarestructurewillbeonlyusingTimerListenerinsteadofThreads,sincewelearnedfromthelabsthatthreadsarelessreliablewhenitcomestosynchronizationandtiming.Everysensorwillbepolledinsideitsownthread(timerListener)sothatmeasurementsaretakenatregularpreciseintervals.
P a g e | 14
4.7METHODOLOGIESRefertotheStructuresparagraphabove.4.8TOOLSEclipseAdvantages:Refertosection3.Disadvantages:Largeapplicationsize.Windows7Advantages:AvailabilityinDPMlabandonteammember’slaptops.Extensivedocumentationandsupportavailableonthewebincaseofmalfunction.Disadvantages:GanttProjectAdvantages:Makesscheduletrackingandtaskdivisioneasiertovisualize.Showsdependenciesbetweentasks.Disadvantages:Doesn’tfocusontherelativesizesoftheworkelementsLEGODigitalDesignerAdvantages:Givesaveryrealisticrepresentationofthemodel.Disadvantages:UnintuitiveuserinterfacewhichmakesthemodeldesigntimeconsumingDropBox(filesharing)Advantages:Easyfreeintuitivesharing.HasalargecapacityDisadvantages:Notreliablewhentrackingchangesandversioningofsourcecode.GoogleGroups(internalcommunication)Advantages:Easytoorganizeteamdiscussions.Disadvantages:Cannotreplacemeetings.Winmerge:Advantages:EasytocompareandmergefilesDisadvantages:‐ObjectAidpluginforeclipse:Advantages:AutomaticallygeneratesaclassdiagramfromtheexistingcodeDisadvantage:Hardtocustomizesometimes.JautoDocpluginforeclipse:Advantages:AutomaticallygeneratesjavadocforthecodeDisadvantage:Sometimesovergeneratesuselessdescriptions
P a g e | 15
AppendixA:GanttChartsThefollowingGanttchartsshowtheevolutionofthedevelopmentprocessovertheprojecttimespan:GanttChartforweek2:
GanttChartforweek4:
P a g e | 16
GanttChartforweek6:
P a g e | 17
FinalGanttChart:
P a g e | 18
AppendixB:BudgetbreakdownBeing4peopleinourteaminsteadof6,wehad⅔thebudgetoftheotherteams.Everyteammemberhadabudgetof9hoursperpersonperweek.Theprojectdevelopmenthadatime‐spanof6weeksplus3daysofthe7thweekwhichwasconsideredas“halfaweek”budgetwise.Sothetotalbudgetwouldsumupto9x6.5x4=234hours.Laterinthedevelopmentprocess,ourteamgotveryclosetothebudgetlimitandourrobotrequiredmoretesting.Soweaskedtheclient(Prof.Ferrie)forabudgetincreaseandhewillinglygrantedourteam30additionalman‐hoursconsideringitasagoodinvestment.Belowisatablesummarizingourtimebudgetdivisionoverthespanoftheproject:
PlanningandTeam
Meetings
GeneratingDocumentation
PhysicalDesign
CodeImplementation Testing Total
Week1 Roy 4 1 1 0 0 6Feb15 Paul 4 1 2 0 0 7
Alex 4 0.5 0.5 0 0 5 Payom 4 0 0 0 0 4Week2 Roy 2 2 1 3 1 9Feb28 Paul 1 3 5 9
Alex 1 0 10 0 0 11Payom 1 0 2 4 0.5 7.5
Week3 Roy 1 1 3 4 2 11March7 Paul 1 1 5 2 9
Alex 1 0 9 0 0.5 10.5 Payom 2 0.5 3 6 1 12.5Week4 Roy 1 1 1 3 2 8March14 Paul 1 0 3 3 1 8
Alex 1 3 3 0 0.5 7.5Payom 1 0.5 3 2 2 8.5
Week5 Roy 1 1 1 2 4 9March21: Paul 1 2 4 3 10
Alex 1 6 1 0 0 8 Payom 0 0 0 5 5 10Week6 Roy 1 1 1 3 5 11March28: Paul 1 1 0.5 4 4 10.5
Alex 1 7 0.5 0 0.5 9Payom 1 0.5 0 4 5 10.5
Week7(3days) Roy 0 1 0 2.5 9 12.5April4: Paul 0 0 0 3 10 13
Alex 0 9.5 0 0 1 10.5Payom 0 0 0 4 9 13
P a g e | 19
Thetotalnumberofhoursusedwas260.5whichrepresents98.7%ofourtotalbudgetBelowisagraphgeneratedfromtheabovedata(excludingweek7).
C‐1C‐2
P a g e | 20
AppendixC:MechanicalandPhysicalStructureKnowingthatwewerehandicappedandhadtwomemberslessthantheotherteams,weknewthatweshouldusetheleastamountoftimepossibleandbeaseffectiveaswecanbe.Withthatsaid,thisiswhywewentforamodulardesign,sothateachcomponentcanbedevelopedinparallelwitheachotherandsomoretimecanbesaved.
Thegrippingmechanism:Twodifferentdesignswereinitiallyproposedforthe“pick‐up”blocksystem:awedgethatwouldgoundertheblockandwouldbelifteduporaclaw‐likemechanism,whichwouldgrabtheblockbyit’ssideandwillthenbelifted‐up.Afterourfirstpresentation,weweretoldthatnopinswouldbeplacedundertheStyrofoamblocks.Thisnewsmeanttheendforthewedgeandthestartoftheclaw
mechanism.TheinitialclawmechanismwasverycloselyinspiredbyaproductseenfromtheNXTprogramwebsite(SeefigureC‐1).However,itwasimmediatelymodifiedsinceitwasnotstrongenoughtogripontheblock.
Thesecondrevisioncompromiseduschangingtheclawsfor2pairofrails.Thischangedemonstratedsignificantimprovement.UsingtheNXJconsole,wewereabletoseehowwellitwasabletoholdontotheblocksanditwasafirstsuccess.Nonetheless,afterafewmoretrials,wefiguredthatitdidnothaveenoughfrictionontheStyrofoamblocks.
TherubberpiecesfoundintheNXTMinstormkitwereaddedtoeachrailtoprovidetheneededfrictionandalsomaximizethesurfaceareaforbettergripping.Aflawwaseventuallyfound,sincethebottomrailwouldgripontooneblock,whiletheupperrailwouldgetthesecondblock.Thiswouldleadtolesspressurewhengrippingontheblocks.Anothermodificationhadtobemadetocompensateforthisflaw.Theendpartoftheupperrailwasremove,sothatonlythelowerpartwouldbeabletogrip.Yetagain,anewproblemwastobefound:therewerecasedwherethegrippingwasn’talignedcorrectly(thegripperwasnotstraightalongtheframe).Thisrevisionintroducedamovableendgripper(SeefigureC‐2)andthealignmentproblemwasfinallycorrected.
P a g e | 21
Wesoonfoundoutthattheupperrailhadbecomeunnecessaryandaddedweighttoourgripper,sowetookitoutinfavourforagripperwhichwaslighterandhadbettermanoeuvrability.Thelastrevisionhappenedattheverylastweekbeforethecompetition.Werealisedthatsometimes,blockscouldhitandgetstuckunderthecage.ThisproblemwassolvedbuyimputinganL‐shapedblockontheleftrailofthegripper(SeefigureC‐3).Thiswouldmakesurethatnoblockwillgetstuckunderthecage,andwasalsousedtoalignthetwoblocks.Thebase:Theinitialdesignusedforthebasehadnorealthoughtputintoit.Theteamdecidedtogo with a similar structure to theStronger US Patbot and just addedanother brick on top of it. Multipleproblems have been observed, once thedesignwas done. Themajor flaw of thisbasewas that it had absolutely noplacewhere it could put the grippingmechanismtoeffectivelywork.Aseconddesignwasmadeadaylater,butwasquicklydemolished,since itwasasworstasthepreviousone, ifnotevenworst since it’s structurewaswaymoreunstable.This design was very high, butused fourwheels to travel (2 bymotorsand2thatwereinstalledintheback). The next designwas thought of after seeingmultiple teams using this structure. Thistime,theNXTbrickswereontheirsideandhadtobeattachedtotheirrespectivemotor.Theallwasthenattachedtootherpiecestosolidify thestructure.Wefoundout that thewheelsaxeswerebendingandwantedtoaddsomethingtopreventthis fromhappening.Theteamthoughtitwouldbeagoodideatomodifythebasetomakeitmorestabletohelpthetiresfromnotbendinganymore. The new and final base designintroduced a better structure to thewholerobot,whilealsohavingabetterrailing system. This new design alsointroducessomeaddedgeartopreventthe tires frombending and a fixed rodfrom the tires,which are also used forthesamepurpose(SeefigureC‐4andC‐5).Thecage:
P a g e | 22
Eventhoughwewereatatwomandisadvantage,westillaimedforthetop,anditwasnosurprisethatweneededacagetodothis.Thecagehelpeduskeeptheblocksfromfallingwhenthestackwashigherthantwo.Theinitialdesignhadacagethatwasreallyhighandhadaverytightspacefortheblockstomanoeuver(SeefigureC‐6).Thisledtosomeinconsistencies,whichisnotacceptableinthistypeofcompetition.Also,thecagewasuselessifwedidnotpick‐upmorethanthreeblocks,whichstartedtobecomedangerous,sincethestackofthreecouldhavefalled.Thenextdesignwastheopposite:thestructurewasverylowandlarge.Thisalsoledtoproblems,sincewecouldnotpick‐upmorethanfourblocks(whichatthetimethoughtitwould be easy to accomplish) and the blocks had a high chances of falling due to thespacinginsidethecage.
Obviously,anewcagehadtobemade.Thisonewasthebestofbothworlds.Itwasnottoohigh,nortooshort,andhadtheperfectamountofmanoeuvrability,withoutgivingtheblockssomuchspace.Aftertesting,weconcludedthatthiswouldbethefinaldesignofthecage(SeefigureC‐7).
Therailingsystem: The railing system was one of the easiestmechanicalpartsof thewhole robot todo. InspiredbyanotherproductfromtheNXTProgramswebsite(SeefigureC‐7), teamMaestrosuccessfully installeda railing system which included the grippingmechanism.Unfortunately,itseemedabittoofragile,and was solidified when the team rebuilt the base(SeefigureC‐8).The liftingmechanism:
The lifting mechanism is the only part whichwent through very minor changes. For the lifting partitself,theteamoptedtogoforafishingwirestring,sinceitisknowntobeverystrong,whichweneedtobeableto lift‐up the whole gripping mechanism plus a fewblocks.Fromtheinitialdesign(seefigureC‐9),onlyonegear and one rimwheel have been added to the lifter.Thesechangeshelpedmaintainthefishingwireinplace(SeefigureC‐10).Thedoor: Initially, theteamwantedtouseasortofplatformtokeeptheStyrofoamblocksinthecage,without falling out. The first designwas too heavy to support the cage and it alsointerferedwiththeascensionofthegripper.
P a g e | 23
Thefinaldesignwasmadewhenwemadethefirstcage:Insteadofusingaplatform,theteamoptedtogowitha“door”instead.Thisprovided more stability than the platform and was more easilyinstalled.Wedidnotneedaplatformanymore,sincewedecidedtoliftthegrippingmechanismduringthewholetimeithadpicked‐upablock.Thedoorwasused toprevent theblocks from fallingup‐front(seefigureC‐11)Thefunnel:The funnel is the frontpartof therobot thatserves to guide the block in position for
grabbing. Initially, wemade the funnel very long so it would have avery good reach on Styrofoamblocks (See figureC‐12).However,wefound out it might not be a good idea to make it long, since we
increasedourchancesintohittingacinder block, which would harshlydiminish our chances of gettingmeetingtherequirements.Thus,westillkeptour funnelandonlymadeitshorter(SeefigureC‐13).In conclusion,manymodifications have beenmade tofinally have awinning robot, or sowe thought. In theend, these multiple changes might have been ourdownfall,consideringittookplentyofourtestingtime.However,thewholeteamwasveryhappywiththefinalstructureof the robot, since itwasverysolidandalsovery clean, compared to most of the other competingteams.
P a g e | 24
NXTPortAllocation:
P a g e | 25
AppendixD:SoftwareDevelopmentOverallstrategyAfterdoingtheinitiallocalisationandtravellingtothecenterofthefirstsquare,ourrobotwasmovingacrossthefieldbytravellingfromthecenterofthecurrentsquaretothecenterofanotheradjacentsquare.TheclassStrategywasresponsiblewithfindingaviablepathfortherobottofollow,usingamodifiedversionofleealgorithm,whichwillbedescribedlater.Aftereachdisplacementtherobotwasdoinga180degreessweep(90towardsrightand90towardsleft)inordertodetectobstaclesandfoamblocksthatitcanpickup.Thesquarescontainingthepositionofthedetectedobstacleswasrecordedinamatrix.Alsothepositionatwhichfoamblocksweredetectedwasrecorded,andafterdetectingthesurroundingobstacles,adecisionwasmadeweatheritissafefortherobottotrypickingthedetectedblocks.Inordertopickablocktherobotwasadvancingtowardsituntilthelightsensordetectsitandstartstheliftingmechanismoruntiladistanceof25cmwascovered.Afterpickingupablock,therobotreturnedtothecenterofthesquareandcontinueditspath.Whenthenumberofblockswasreachingathreshold,therobotwasnotlookingforanyfoamblockanymore,butsimplytravelsafelytothedestination.Incaseanobstaclewasdetectedontheway,theleealgorithm(seebelow)wasaskedtorecalculateanewpath.Atthedestination,therobotdeposedtheblocks,openedthecagedoorandbackedup.ImprovedLeealgorithmTheLeeAlgorithm[1]findstheshortestpathbetweentwopointsina2‐dimensionalmatrix,byavoidinggivenobstacles.Ourversionofthealgorithmwasusing3matrices:thefirsttostoretheobstacles,thesecondtostorevisitedsquares,thethirdtoruntheLeealgorithm.The“Obstacle”matrixwasupdatedwheneveranobstaclewasdetected,andthe“Visited”matrixwasupdatedeverytimetherobotwasdone“visiting”asquare.Incasemorethanonepathofminimallengthexisted,thelee()functionwasreturningtheonethatminimizesthenumberofturnsandchoosesunvisitedsquaresinsteadofvisitedones.Asasafetymeasure,allobstacleswereerasedfromtheobstaclematrixincasenopathtothedestinationwasfound,thentherobotwaslookingagainforadjacentobstaclesandrecalculatingthepath.Ifthedestinationisreachedwithinsufficientblocks,thealgorithmwasgeneratingupto4additionalpathsthattherobotcanfollowstartingfromthedestinationpoint.
P a g e | 26
Belowisthestep‐by‐stepproceduresusedintheleealgorithm:1) Initialization - Select start point, mark with 1 - i := 1 2) Wave expansion - REPEAT - Mark all unlabeled neighbors of points marked with i with i+1 - i := i+1 UNTIL ((target reached) or (no points can be marked)) 3) Backtrace - go to the target point REPEAT - go to next node that has a lower mark than the actual node - add this node to path UNTIL (start point reached) 4) Clearance - Block the path for future wirings - Delete all marksGraphicalrepresentationofthealgorithm:
P a g e | 27
SoftwareArchitecture:BelowarerepresentationofourclassdiagramsonbothNXTS:Master:
Slave:
P a g e | 28
AppendixE:TestingDocumentTest1:Generaltestswiththeultrasonicsensor
Date:March7to10
Conditions:Atestrobotisplacedonanopenfieldinfrontofafoamblockwhichisinclinedatdifferentanglesfromtherobotandatdifferentdistancesfromtherobot.Therobotthenmovestowardstheblockataconstantspeedwhilerecordingtherawdistancevaluesreadfromtheultrasonicsensor.
Results:
Blockfacingtherobot(~0degrees)
Blockat45degreeswithrespecttotherobot:
P a g e | 29
Blockat15degreeswithrepecttotherobot:
Throughtheseinitialexperiments,itwasdeterminedthattheultrasonicsensorisabletoreceiveapingfromablockprovidedtheblocksurfaceisfacingtherobot(towithin10degrees).Thisinformationrevealedthatinmanycases,thesensorisincapableasinglevalueshowingtheexistenceofablock.Thusnofiltercanhelptherobotifitslineofsightisnotperpendiculartothesurfaceoftheblock.
Ontheotherhand,ifthelineofsightofthesensorISperpendiculartothesurfaceoftheblock,thenthevaluesreturnedbythesensorarenearlyflawless.
TEST1:Lightsensor‐basedgridlinedetection
When:March5,2011
P a g e | 30
Conditions:Thetestrobotisplacedonanopenfield,withitscentreofrotationonanintersection.Itisprogrammedtorotate360degreeswhilecontinuouslyprintingthevaluesentbythesensorafterasimpledifferentialfilterisapplied.
Results:
Therobotobservesalineoncetheabsolutevalueofthedatafromthedifferentialfilterisveryhigh.
Othercomments:Moretestsweretakenusingthisdifferentialfilterontherobot.Therobot,forinstanceissettodriveoverasetoflines(oneofwhichisactuallya“crack”betweenthe4x4squaretiles)atdifferentspeedsandreleasesasoundcuewhenthesensordetectsacrossedline.Thetestswereverysuccessful.
P a g e | 31
TEST2:Lightsensorbasedgridlinedetection
When:March14,2011
Conditions:Thetestrobotisplacedonanopenfield,withitscentreofrotationonanintersection.Itisprogrammedtorotate360degreeswhilecontinuouslyprintingtherawvaluesentbythesensortothecomputerconsole.
Results:
Asexpected,asthesensorbeginstosweepacrossaline,thevaluereturnedbethesensorincreasessignificantly.Conversely,whenthesensorsweepsoutofaline,thevaluedecreasesconsiderably.
Sincethevaluesreturnedwerejitteringastherobotwasrunning,arunningaveragefilterwasappliedtothevalues.Furthermore,duetotheunknownlightingconditionsonthefieldduringthecompetition,anadditionaldifferentialfilterwasappliedtothevalues.
P a g e | 32
Aftersomemoretesting,itwasobservedthattherobotdefinitelycrossesalineoncethevaluereturnedfromtheaverageanddifferentialfilterssurpasses10.
Othercomments(aftertesting):Wehaveimplementedthefilterabovetoouractualrobotandhaveconfirmeditseffectiveness.Wefoundthattherewasnonoticeablechangeinthedetectionrateoftherobot.Eventually,itwasdecidedthatthelocalizingsensorwilloperatewithadifferentialfilterandwithoutarunningaveragefilter.
TEST3:Lightsensorbasedblockdetection
When:March14,2011
Conditions:Thetestrobotisplacedonanopenfieldwitthafoamblockdirectlyinfrontofit(i.e.thesurfaceofthefoamblockisperpendiculartothe“lineofsight”ofthelightsensor).Therobotisprogrammedtomoveforwardataconstantspeedwhilecontinuouslyprintingtherawvaluesentbythesensortothecomputerconsole.Onceablocksucessfullycontactsthesensor,thetestends.
Anothersimilartestisrepeated,buttheblockisplacedata45degreeanglesuchthatthesensorneverdirectlytouchesthesensor(whichsimulatesablockgettingstuckontheframe).Onceablockcontactstherobot,thetestends.
Results:
P a g e | 33
P a g e | 34
Thegraphaboveshowsthedifferencebetweenthevaluesreadbytheultrasonicsensorwhenablockissuccessfullyenteringtheframeoftherobotandwhenablockgetsstuckontheframe.Astheapprochestheblock,thelightsensorreturnsagraduallyincreasingvalue.Whentheblock’ssurfacecompletelycoversthelightsensor,thevaluereturnedbythesensordropssubstancially.However,iftheblockgetsstuck,thesensor’sreadingdoesnotdecreaseatall(untiltheblockisremovedfromtheframe).
Theprogressionofthevaluesreturnedbythesensorrevealsinterestingthingsaboutthenatureofthesensor.Forone,itwasdeterminedthatthemaximumeffectiveoperatingrangeofthesensor(themaximumdistancefromwhichthesensor’sreturnedvaluecanchange)wasabout15cm.
Othercomments:Wehavecontinuedwithmoretests,coveringcasessuchaswhentheblockslidesalongtheinneredgeoftheframe.Onceblockshavesuccessfullybeendetectedinaconsitentmanner,wefinalisedthefilteringofthelightsensor
P a g e | 35
Test5:Ultrasonicobstacledetectionwithmedianfilter
Date:March14,2011
Conditions:Thetestrobotisplacedinthemiddleofthefieldanddirectlyinfrontoftwocinderblockswhichisfacingit.Therobotissettorotatewhilerecordingthedistancereadfromtheultrasonicsensor.Inaddition,amedianfilterisappliedtotherawvaluesgivenbythesensor.
Results:
P a g e | 36
Thefollowingsectionwilldescribesomegeneraltestsmadeontherobot:
E‐1:UnitTests
# Category Description Pass/Fail Comments
1 Front“Funnel”mechanism
ManuallyapproachaStyrofoamblockindifferentanglestoseeiftheblockgoesintoapositionwhereitcanbegripped.
Conditional
Theblockwillnotgetstuck,unlessitfollowsasideofthefunnelexactly,butinreal‐time,itisalmostimpossibletoachieve.Eventhough,thiswillbecorrectedinthecoding.
2 Grippingmechanism
UsingtheNXJcontrolfoundintheLejosNXTfolder,wewereabletocontrolthemotorofthethegrippingmechanism,soitcanactuallytakeastyrofoamblock.Then,wemanuallyliftupthemechanism.Werepeat
theprevioustaksuntilthestackofstyrofoamblocksfall.
Pass
Thistextdemonstratedthatwecanonlysupport5blockswithoutmakingthestackfall.
Note:Thisisbeforewe
implementedthecagetosupportmoreblocks
3 Liftingmechanism
UsingtheNXJcontrolfoundintheLejosNXTfolder,wewereabletocontrolthemotoroftheliftingmechanismandthegrippingmechanism,
soitcanactuallytakeastyrofoamblockandliftit.Werepeattheprevioustaksuntilthestackofstyrofoamblocksfall.
Pass
Thistextdemonstratedthatwecanonlysupport5blockswithoutmakingthestackfall.
Note:Thisisbeforewe
implementedthecagetosupportmoreblocks
4
LightSensorFiltering(odometrycorrection)
Testsensoronusualblackline;onwornoutlines;onlineseparatingtwo4x4tiles;withhighambientlight;withlow/noambientlight;
PassThetilebordersaredetectedsuccessfully
5UltrasonicSensor(blockdetection)
Testtheultrasonicsensor’sabilitytopickuppingsfromablockorientedatdifferentangles(0,22.5,45degrees)
FAIL
TheUltrasoniccanonlydetectablockwhenthechirpsbouncedirectlyoffit,255isreturned
P a g e | 37
otherwise6 Odometry
Testingdoneusingatestvehicle,beforetherobotconstructionwasready
Conditional Needscalibration
7 OdometryCorrection
8 Navigation
9Inter‐brick
CommunicationSendingstatuses(integers)betweentwobricksusingtheRJ12cables Pass
Needtodefineandidentifythestatuscodes
10PC‐Brick
CommunicationControltherobotusingBluetoothandreceivedata(ex:measurements
fromsensors) PassNeedtotestwithsimilarserveras
inlab5
E‐2:Integrationtests
11Integration
Testing(Demo#1)
Thepurposeofthedemowastoshowthatourmechanicalbuildwasabletopickupatleastonestyrofoamblock.Thisdemonstration
integratesabasiccodeofthetraveltomethod,thegrippingmechanismandtheliftingmechanism
Pass
Ourdemowentverywell,wewereabletomaketherobotmovestraightinlineandpickuptherobotsthatwereinhisway.Itdidpassthe
demo,thoughwestillhadsomedifficultieswhentheyweremorethan1blockto
pickup.
12Cage
implementation
Usingthegrippingandliftingmechanisms,take3styrofoamblocksinarowandseeifeverythingissmoothandtheblocksdonotgetstuck
somewhere.Fail
Theblocksometimesgetsstuckonthebottomofthe
cage,iftheblockissomewhatcrooked.Thus,thegrippingand
liftingmechanismstop
workingcorrectly.
Note:Wethenaddedapieceoneachsideofthe
grippingmechanismtostraightenouttheblocks.
P a g e | 38
*Usingthegrippingandliftingmechanisms,take3styrofoamblocksinarowandseeifeverythingissmoothandtheblocksdonotgetstuck
somewhere.
*Afterthepiecewasaddedtothegripper
Pass
Afterweaddedthepiecetostraightenouttheblocks,ineverycase,thegripperandthe
liftingmechanismdidnotgetstuck
13`Styrofoamblock
detection
Usingtherobottester,maketherobotsweepfrom90o to‐90o.Iftherobotfindsablock,makeitadvancehalfthedistanceitseesandmakeit
sweepagain.Then,advanceandcapturetheblock.Fail
14IntegrationTesting
(Demo#2)
Thepurposeofthedemowastodemonstratethestyrofoamblockdetectionofourrobotandmakeitpickatleastoneofblockupandthedropitataspecifiedlocationbytheclient.ThisdemointegratestheUltrasonicSensor,theLightSensor,thegrippingmechanismandthe
liftingmechanismofourrobot.
Fail
Therobotwasnotabletopickupablockby
itselfconsistently
withouthumanassistance(i.e.manipulatingthestyrofoamblocktoputitin
positionfortheUltrasonic
sensorwillseeit)
UltrasonicSensorLocalization
ImplementationoftheFallingEdgeusedinlaboratory4onourmechanizedrobot
Pass
LightSensorLocalization
Maketherobotmakea360turn.Usingthelightlocalizer,itshouldbeabletocorrecttheodometer.Andtheodometershouldshowexactly
wheretherobotis.Pass
15 PathFindingcode
Lee’salgorithmwasimplementedinourrobotandwastestedtoseeifitsuccessfullyfoundthepathtoitsdestination.(SoftwareTest)
Pass
Thistestwasdoneona
matriximitatinga12x12maze.
15 PathfindingIntegration
Therobotwasgivenhardcodedobstacles.IthadtoapplytheLeealgorithmtofinditswaythroughthemaze.
Pass
Therobotsuccessfullyavoidedtheobstaclesandfinditswaytothespecifieddestination
16Styrofoamblock
detection
Usingthemainrobot,maketherobotsweepfrom90o to‐90o.Iftherobotfindsablock,makeitadvancehalfthedistanceitseesandmakeit
sweepagain.Then,advanceandcapturetheblock.
17Obstacle
detectioninitialtest
Puttingtherobotinsideamazewith2obstacles.Therobotshouldfinditswaytothedestination
ConditionalPass
Therobotwasdetectingmoreobstaclesthanthereactually
was.Processwastoolong.
18Odometry
correctionwithaddedheading
Arelativelylongpathwasgivenfortherobottofollow. PassNeedtotrya10minutelongpath
P a g e | 39
correction
19
Lee'sAlgorithmimplementation
Atestprogramwascreatedtoverifyifthealgorithmwasimplementedcorrectly,byinsertingvaluesmanuallyfortheobstaclematrixandthenprintingthematrixon
whichtheleewasoperatingandthefoundpath
Pass Manycasesweretried,includingonesinwhichallpathwere
blocked,andhadafewproblemswithrunningintoinfiniteloops,
butthatwascorrected
20
Identifyingobstacles
positionandstoringitintoa
matrix
Robotwasprogramedtomovearoundthefieldandusingthepositionatwhich
obstacleswerefound,updatetheObstaclematrix.Bluetoothwasusedtoprinteachnewobstacleontotheconsole,andthe
completematrixeach5seconds.
Pass Mostdifficultieswereencounteredwhenimplementingformulathatwouldgivethepositioninthematrixofthe
obstacle,giventhecurrentrobotorientation,positionanddistance
readbysensor
E‐3:SystemTests
SystemTest#1:4/03/2011
Test:SendviaBluetoothinitiallocation1withdestinationx:3y:3,noobstacles,4surroundingblocks.
Result:Therobotwenttodestinationandwasabletopickup1blockontheway.Itdepositedatdestination.Cagedidnotopen.TherobotfollowedandLshapedpath.
Comments:Theblockwaspickedupduetotherobot“bumpingintoit”andnotbecauseofblockdetection.
SystemTest#2:4/03/2011
Test:SendviaBluetoothinitiallocation1withdestinationx:4y:4,oneobstacle,5surroundingblocks.
Result:Therobotinitiallyavoidedtheobstacle,butcollidedwithitlaterwhilesweepingnexttoit.Thissetofftheodometerandfailedthetest.
Comments:Therobotshouldbetoldtoavoidalargerareaaroundablockwhennavigatingandsweeping.Probablyaddsurroundingpointstoobstaclematrix.
P a g e | 40
SystemTest#3:4/04/2011
Test:SendviaBluetoothinitiallocation2withdestinationx:5y:4,twoobstacles,8surroundingblocks.
Result:Therobotavoidedbothobstaclesandtheywereaccuratelyrepresentedinthematrix.However,rightbeforearrivingtodestinationSlavewentoff.
Comments:Slavewentoffmostprobablybecauseofbatteries
SystemTest#4:4/04/2011
Test:SendviaBluetoothinitiallocation1withdestinationx:5y:4,twoobstacles,8surroundingblocks.
Result:Therobotpickup2blocksanddepositedthematthedestination,offbynearly10cm
Comments:Odometrycorrectionshouldbecalibrated
SystemTest#5:4/05/2011
Test:SendviaBluetoothinitiallocation3withdestinationx:4y:4,twoobstaclesatanangleof45degrees,8surroundingblocks.
Result:Therobotavoidedoneoftheobstaclesbutcollidedwiththeotherone.Noblockspicked.
Comments:Hardtoseeobstacleat45degrees.Perhapsdecreasesweepspeedorimprovefilter
P a g e | 41
GlossaryofTermsBlocks:Foamblocks(shouldbestackedatthedestination)theymightalsobereferredtoaspalletsorobjects.Obstacles:Cinderblocks(shouldbeavoided)Brick:NXTBrickSquare:a1footsquaredelimitedbygrid‐linesonthemaze
References[1]C.Y.Lee"Analgorithmforpathconnectionsanditsapplications",IRETrans.Electron.Comput.,vol.EC‐10,pp.3461961.[2]DaveParker“Clawwithgamecontroller”http://www.nxtprograms.com/claw_car/steps.html[3]DaveParker“Forklift”http://www.nxtprograms.com/NXT2/forklift/index.html