USF Libraries
USF Digital Collections

Self-guided micro vehicle

MISSING IMAGE

Material Information

Title:
Self-guided micro vehicle an autonomous vehicle with gps navigation and 802.11b communications
Physical Description:
Book
Language:
English
Creator:
Guerra, Roberto J
Publisher:
University of South Florida
Place of Publication:
Tampa, Fla.
Publication Date:

Subjects

Subjects / Keywords:
Nmea
Motorola
M68hc11
Handyboard
Wifi
Lantronix
Xport
Dinsmore
Dissertations, Academic -- Electrical Engineering -- Masters -- USF   ( lcsh )
Genre:
government publication (state, provincial, terriorial, dependent)   ( marcgt )
bibliography   ( marcgt )
theses   ( marcgt )
non-fiction   ( marcgt )

Notes

Abstract:
ABSTRACT: To facilitate the learning of automatic navigation systems by engineering students an easy to obtain platform is useful. The topic of this thesis is the design and implementation of a basic self-guided vehicle that can be programmed and expanded by anyone possessing basic experience with the C programming language. The Self-Guided Micro Vehicle, (SGMV), uses off-the-shelf easy to obtain parts such as a toy R/C truck and the Handyboard to maximize availability of this technology to students.This thesis divides the SGMV design process by functionality. It starts by documenting the locomotion system, which was a modified R/C toy truck. Next, it describes the Microcontroller board and the Handyboard. Then it highlights the programming language, Interactive C, which makes multitasking systems easy for beginners. The sensor system was comprised of a GPS receiver, a solid state electronic compass and a wireless communications system.
Thesis:
Thesis (M.S.E.E.)--University of South Florida, 2005.
Bibliography:
Includes bibliographical references.
System Details:
System requirements: World Wide Web browser and PDF reader.
System Details:
Mode of access: World Wide Web.
Statement of Responsibility:
by Roberto J. Guerra.
General Note:
Title from PDF of title page.
General Note:
Document formatted into pages; contains 87 pages.

Record Information

Source Institution:
University of South Florida Library
Holding Location:
University of South Florida
Rights Management:
All applicable rights reserved by the source institution and holding location.
Resource Identifier:
aleph - 001681054
oclc - 62724657
usfldc doi - E14-SFE0001067
usfldc handle - e14.1067
System ID:
SFS0025388:00001


This item is only available as the following downloads:


Full Text

PAGE 1

Self-GuidedMicroVehicle:AnAutonomousVehiclewithGPSNavigationand802.11bCommunicationsbyRobertoJ.GuerraAthesissubmittedinpartialfulllmentoftherequirementsforthedegreeofMastersofScienceinElectricalEngineeringDepartmentofElectricalEngineeringCollegeofEngineeringUniversityofSouthFloridaMajorProfessor:WilfridoMoreno,Ph.D.ParisWiley,Ph.D.JamesLeew.Ph.D.DateofApproval:March25,2005Keywords:NMEA,Motorola,M68HC11,Handyboard,WiFi,Lantronix,XPort,DinsmorecCopyright2005,RobertoJ.Guerra

PAGE 2

DEDICATIONTomywifeandfamily.

PAGE 3

ACKNOWLEDGMENTSIwouldliketothankmyadvisorandMajorProfessor,DrWilfridoA.Moreno,forhisconstantencouragementthroughthedevelopmentofthisthesis.AdditionalthankstoDr.ParisWileyandDr.JamesLeewforparticipatingascommitteemembers.IamthankfulalsotowardtheDepartmentofElectricalEngineeringfortheopportunitytoteachandhelpmenanciallysupportmygraduatestudies.Finally,thankstomywifeandmyfamilyfortheirconstantsupportthroughthedevelopmentofthisthesis.

PAGE 4

TABLEOFCONTENTSLISTOFTABLESiiiLISTOFFIGURESivABSTRACTviCHAPTER1INTRODUCTION11.1ScopeoftheProjectandRequirements21.2TheoreticalBackground31.2.1AckermanSteeringLocomotion31.2.2Handyboard,InteractiveCandMultitasking61.2.3IEEE802.11bNetworkingandEmbeddedWebServers71.2.4TheMaximMAX3100SPIUART81.2.5TheGlobalPositioningSystemandtheNMEA0183Protocol91.2.6TheHallEectandtheDinsmore1655Solid-StateCompass13CHAPTER2IMPLEMENTATION152.1ASimpleRCVehicleastheLocomotionBase152.2TheHandyboardastheCentralProcessor172.3TheLantronixXPortBridgefromtheHandyboardtoaLocalNetwork192.4UsingtheBelkinF5D6130WirelessAPtoConnecttheTruckWirelessly232.5UsingaVirtualSerialPorttoConnectthePCApplicationtotheNet-work242.6UsingtheDeluoGPSandMAX3100forGeolocation262.6.1ImplementationofaSerialPortwiththeMAX3100262.6.2CharacterFetchingViaInterrupts272.6.3NMEA0183SentenceParsingRoutine282.6.4VehicleNavigation302.7UsingtheDinsmore1655toAligntheTruck312.7.1CompassElectricalConnections312.7.2AzimuthAngleCalculationRoutine322.7.3AligningtheTruckTowardstheTarget342.7.4Self-GuidedMicroVehicleDriving36CHAPTER3TESTINGANDRESULTS373.1TerrainHandlingofLocomotionBase373.2PilotingwiththeHandyboard373.3PerformanceoftheWirelessCommunicationsLink38i

PAGE 5

3.4PerformanceoftheGPSGeolocationSystem393.5QualityofNavigationwiththe1655Compass393.6FollowingaPolygonalRoutePlan40CHAPTER4CONCLUSION414.1Discussion414.2PossibleFutureImprovements414.3Conclusion42REFERENCES43APPENDICES44AppendixASGMVDimensions45AppendixBHandyboardPinoutDiagram46AppendixCHandyboardtruck.icProgramListing47AppendixDHandyboardgps adapter.icProgramListing51AppendixEHandyboarddrive module.icProgramListing57AppendixFHandyboardgps adapter navi.asmProgramListing65ii

PAGE 6

LISTOFTABLESTable1.Dierentialdriveactions3Table2.Ackermandriveactions4iii

PAGE 7

LISTOFFIGURESFigure1.Dierentialdrivelocomotion4Figure2.Ackermandrivelocomotion5Figure3.TheMITHandyboard6Figure4.LantronixXPort8Figure5.TheMAX3100IC9Figure6.GPSorbitingsatellites10Figure7.TriangulatingGPSuserposition11Figure8.GPSreceiverconnectedtolaptop11Figure9.SerialportmonitorshowingNMEAsentences12Figure10.DissectionoftheGPRMCNMEAsentence12Figure11.Lorentzforce13Figure12.Halleect14Figure13.TheDinsmore1655compass14Figure14.Locomotionbasettedwithelectronics16Figure15.R/Ctruckinternalconnections17Figure16.InteractiveCscreenshot18Figure17.ConcurrentfunctionsintheHandyboard19Figure18.XPortblockdiagram20Figure19.XPortinterfacingcircuit21Figure20.XPortcongurationcable21Figure21.XPortconnections22Figure22.TheBelkinF5D6130WAP23iv

PAGE 8

Figure23.UsingtheXPortwirelessly25Figure24.COMPortRedirectoruserinterface25Figure25.SchematicofMAX3100UARTcircuit27Figure26.Characterfetchinterruptroutine28Figure27.NMEAdecoderoutine29Figure28.Dinsmorecompasselectricalconnections31Figure29.CalculatingthefractionF=A/B33Figure30.Arctangentassemblyfunctionerror34Figure31.Calculatingtheangleerror35Figure32.SGMVdrivingitinerary36Figure33.802.11bwirelessrange38Figure34.GPSlocationuncertainty39Figure35.SGMVpath40Figure36.DimensionsoftheSelf-GuidedMicroVehicle45Figure37.Handyboardelectricalconnectors46v

PAGE 9

SELF-GUIDEDMICROVEHICLE:ANAUTONOMOUSVEHICLEWITHGPSNAVIGATIONAND802.11BCOMMUNICATIONSRobertoJ.GuerraABSTRACTTofacilitatethelearningofautomaticnavigationsystemsbyengineeringstudentsaneasytoobtainplatformisuseful.Thetopicofthisthesisisthedesignandimplementationofabasicself-guidedvehiclethatcanbeprogrammedandexpandedbyanyonepossessingbasicexperiencewiththeCprogramminglanguage.TheSelf-GuidedMicroVehicle,SGMV,useso-the-shelfeasytoobtainpartssuchasatoyR/CtruckandtheHandyboardtomaximizeavailabilityofthistechnologytostudents.ThisthesisdividestheSGMVdesignprocessbyfunctionality.Itstartsbydocument-ingthelocomotionsystem,whichwasamodiedR/Ctoytruck.Next,itdescribestheMicrocontrollerboardandtheHandyboard.Thenithighlightstheprogramminglanguage,InteractiveC,whichmakesmultitaskingsystemseasyforbeginners.ThesensorsystemwascomprisedofaGPSreceiver,asolidstateelectroniccompassandawirelesscommu-nicationssystem.Finally,thethesisdocumentstheprogramcodenecessaryforsuccessfulnavigationandexplainsthevericationprocess,wheretheSGMVwasrequiredtofollowasetofwaypoints,whichweredenedbylatitude-longitudecoordinates.vi

PAGE 10

CHAPTER1INTRODUCTIONUnmannedAutonomousVehiclesUAVisaverynecessaryapplicationofcontrolsystems,sensorsandarticialintelligence.Theyenhancetheabilitytocompletemissionsinplaceswherehumanbeingswouldnotnormallygo.Withmoredestinationsatourreach,suchasouterspace,warzones,andhealth-hazardousareas,autonomousmachinesbecometheonlyviableagentstofulllourinterestsinthoseterritories.Furthermore,thereisanincreaseddemandformobileroboticagentsthatfacilitatesurveillanceinthepost9-11U.S.A.[1].Autonomousvehicleplatformshave,todate,notbeenavailabletotheaveragestudent.Mostoften,thestudentmustbecomepartofawell-establishedroboticresearchlaboratorytobeabletoaccessanytypeofmobilerobotplatform.Therefore,engineeringstudents,whoareinterestedinautonomousvehicles,donteasilyhavetheopportunitytoimplementtheircontrolideas.Thepurposeofthisresearchwasthedevelopmentofaninexpensiveunmannedau-tonomousvehicle.ThevehiclewastermedtheSelf-GuidedMicroVehicle,SGMV.ThevehicleemployedGPSnavigation,asolid-statecompassandan802.11bcommunicationsystem.Uponcompletion,thisguidedvehiclewastobecomeaplatformforanyotheren-gineeringstudentorroboticisttoimplementnavigationschemesand/oraddsensorsforthevehicletoreacttoitsenvironment.TheSGMVusedano-the-shelfRCvehicleasitsmovingbaseandaHandyboardasitscentralprocessingunit.Additionally,aGPSreceiverandaDinsmorecompasswereemployedaslocationsensorsandaLantronixXPortalongwithaBelkinWirelessAccessPointwereemployedtoestablishawirelesslink.1

PAGE 11

Fordemonstrationpurposes,theSGMVwasmadetofollowapre-plannedpolygonalitinerarywithlatitude-longitudecoordinatesasvertices.Duringthedemonstrationallperformancecharacteristicssuchaswirelesslinkrange,pilotingquality,batterydurationandGPSlocationqualityweremeasuredandreported.Althoughnotspeciedaspartofthisresearch,suggestionsforchangestotheSGMVwillbenotedthatwouldreducethecomplexity,cost,andimproveeciencyandexibility.1.1ScopeoftheProjectandRequirementsTheSelf-GuidedMicroVehicleisalow-costautonomousvehiclethatcombinesano-the-shelfremotecontrolledcar,anembeddedmicrocontroller,navigationsensorsandwirelesscommunicationequipment.Itisintendedtofulllthefunctionsofself-navigationthroughGPSpositioningandcompassdirectionandwirelesscommunicationthatutilizes802.11btechnology.Althoughthenalproductonlyincorporatedtheminimumsystemsrequiredtofullltheabovefunctions,theSGMViscapableofexpansioninordertoaccommodatenewfunctions.Futureresearchersshouldbeabletoeasilyaddnewmodules,withverylittleoverheadandlearningcurve,inordertoinvestigatenewcontrolstrategies.ThisthesiswilldocumentthetechnologiesusedintheimplementationoftheSGMV,thephysicalcongurationofthedevicesinvolvedandthesoftwarerequiredtoexecutethenavigationfunctions.Additionally,thisthesiswillbereleasedinthepublicdomainsothatanyonecanreproducetheproductandthisresearch.TherewillalsobeinstructionsonhowtoexpandtheSGMVtoaccommodatemorefunctions.ThenalthesiswillbereleasedinthepublicdomainsothatanyonecanreproducetheSGMV.ThisthesisalsocontainsinstructionsonhowtoexpandtheSGMVtoaccommodatemorefunctions.2

PAGE 12

1.2TheoreticalBackground1.2.1AckermanSteeringLocomotionThereexisttwomainkindsoflocomotionforwheeledvehicles.Oneisdierential-drive,andtheothertypeisAckermansteering.Dierential-drivelocomotionisaccomplishedbyplacingtwowheelsortanktracksateithersideofthevehicle.Eachwheelisdrivenindependently.Dependingonthedirectionthewheelsturn,thevehiclewillmoveinsomedenitedirection.Table1isasummaryofthedierential-drivelocomotionscheme. LeftWheel RightWheel VehicleMotion Forward Forward Straightforward Backward Backward Straightbackward Forward Backward Turnleftonadime Backward Forward Turnrightonadime Fastforward Slowforward Forward,turningleft Slowforward Fastforward Forward,turningright Still Still Nomotion Table1.DierentialdriveactionsFigure1illustratestheplacementofthewheelsandindicateshowthevehicleturnsindierentialdrivelocomotion.Ackermansteering,unlikedierential-drivesteering,involvesfourwheelsinsteadoftwo.Thetwobackwheelsturnwithhightorquetoprovidevehiclepropulsion.Thetwowheelsinthefrontafreespinningandcanswivelatwillabouttheverticalaxis,whichproducescurvatureinthedrivingpath.Ackermansteeringisusedbyallautomobilesandsomevariationsincludefront-wheeldriveandfour-wheeldrive.Bycombiningdriveandsteeringactionsseventypesofmotioncanberealized.Table2illustratessomeofthesemotions.Figure2illustratesthepositioningofthewheelsinAckermansteeringsystems.Dierential-drivelocomotionpresentsacriticaladvantageoverAckermansteering.Dierential-drivesystemscanspinonadime,meaningthatitcanchangeorientationwithoutchangingitslocation.Ackermansystemspresentminimumturnradius,whichaectsthemaximum3

PAGE 13

Figure1.Dierentialdrivelocomotion DriveWheels TurnWheels VehicleMotion Forward Straight Straightforward Forward Right Forwardright Forward Left Forwardleft Backward Straight Straightbackward Backward Right Backwardright Backward Left Backwardleft Still Any Nomotion Table2.Ackermandriveactions4

PAGE 14

Figure2.Ackermandrivelocomotion5

PAGE 15

curvatureintheirmotionanddenestheminimumphysicalspacerequiredtochangeorien-tation.However,Ackermansystemsaremorewidespreadandthereisaneedtoautomatetheexistingsystems,especiallyinfullsizeautomobiles.ThedecisiontomaketheSGMVanAckermansteeringsystemstemmedfromtheneedforstudentstograduatefrombeginnerrobotsthatusedierential-drivedrivesandbecomefamiliarwiththemoreuniversalsystem.1.2.2Handyboard,InteractiveCandMultitaskingThecentralprocessingunitfortheSGMVwaschosentobetheHandyboard[5].TheHandyboardisamicrocontrollerboardbasedontheMotorola68HC11[2]andwasdesignedbyFredMartinforthepurposeofteachingroboticstoengineeringandroboticsstudents.TheHandyboardispicturedinFigure3. Figure3.TheMITHandyboardTheHandyboardincludesconnectorsfordigitalandanalogsensorsandfor9Vmotors.ItcomesinstalledwithanalphanumericLCD,apiezobuzzerandabatterychargingsystem.CoupledwiththeoptionalExpansionBoard,auserhasaccesstodigitaloutputs,servooutputs,additionalanaloginputsandasonarrangesensorconnector.TheHandyboard,unlikeothermicrocontrollerboards,supportsInteractiveC,IC.IC,alsocreatedbyFred6

PAGE 16

Martin,isaC-likeprogramminglanguagethatgiveshigh-levelaccesstotheHandyboardhardwaresuchasthebuzzer,LCDdisplayandmotordrivers.Thesefunctionsarealsopossibleinothermicrocontrollersystems.However,withtheHandyboard,thefunctionsareavailableoutofthebox,withouttheneedforthirdpartylibrariesandcompilersthatmightnotbecompletelyadequate.InteractiveCisnotacompiledlanguagelikeC.Instead,itisabyte-code-interpretersystem.TheICcodeisconvertedintobyte-codesthattheHandyboardruntimekernelexe-cutes.Whilethismethodofoperationreducesexecutionspeed,itallowsforruntimechecks,whichpreventhangupsandsoftwarecrashes.InteractiveCisknownforitsstability,whichisafeaturemostwelcomedbybeginnerprogrammers.However,themostpowerfulfeatureofICiseasymultitasking.WithoutloadingspeciallibrariesorkernelstheHandyboardcanbeprogrammedtorunseveralprocessesconcurrently,whicheliminatesthepossibilitythatonefeatureoftheuserprogramwillpausetheprocessorandnotallowtheexecutionofotherfeaturesoftheuserprogram.Concurrentprocessescanco-existindenitelywhilecommu-nicatingwitheachother,stoppingorstartingeachother,orbeingcompletelyindependentofeachother.TheHandyboardwaschosenasthecontrollerfortheSGMVduetoitseaseofuse,stability,multitaskingabilityandthebigsupportnetwork,whichiscomprisedofalargegroupofHandyboardusers.1.2.3IEEE802.11bNetworkingandEmbeddedWebServersTheHandyboardnormallycommunicateswithaHostPCthroughaserialportinordertodownloadtheuserprogramcodeandtocommunicateduringruntime.InordertoimplementawirelesslinktheHandyboardserialportwasadaptedwithanEmbeddedWebServerfromLantronixandan802.11bAccessPointfromBelkin.TheLantronixXPort[4]servedasabridgebetweenastandardTCP-IPnetworkandstandardUARTserialportsthatareuniversallyfoundinmicrocontrollers.ApersonalcomputercanbeconnectedtotheLANandcommunicatewithmicrocontrollersserialportthroughasimpleTelnetconnection.IfanapplicationsuchastheInteractiveCIntegratedDevelop-mentEnvironmentneedstocommunicatetothemicrocontrollerthroughaserialportthere7

PAGE 17

areutilities,calledPortRe-directorsthatspawnavirtualserialportsothattheapplica-tionconnectstothemicrocontrollerthroughtheLAN.TheLantronixXPortispicturedinFigure4. Figure4.LantronixXPortOncetheMicrocontrollerwasgiventheabilitytocommunicatethroughtheLAN,theSGMVwasupgradedwith802.11btechnology,whichgavetheSGMVwirelesscapability.Chapter2describes,indetail,howtheWirelessnetworkwasarrangedforoptimumwirelessoperation.1.2.4TheMaximMAX3100SPIUARTOneoftheshortcomingsoftheHandyboard,whichneededtobexedbeforebeingabletocapturedatafromtheGPSreceiver,wasthattheHandyboarddoesnthaveenoughserialports.TheHandyboardcomeswithoneserialportthatisdedicatedforcommunicationwiththeHostPC.Nootherserialportsareavailablefordatacapture.AnextraserialportwasmanufacturedandconnectedtotheHandyboardfortheexclusiveuseofGPSdatacapture.ThekeyelementoftheextraserialportwastheMaximMAX3100chip.8

PAGE 18

TheMaximMAX3100chipiscompatiblewiththe68HC11SerialPeripheralInterface,SPI,andprovidesastandardUARTforthe68HC11.WithafewadditionalpartstheGPSreceiversserialportwasconnectedtotheMAX3100andtheHandyboard.Chapterrefchap:implementationdescribesthehardwarecongurationindetailaswellasthesup-portingsoftware.ApinoutdiagramoftheMaximMAX3100chipispresentedinFigure5. Figure5.TheMAX3100IC1.2.5TheGlobalPositioningSystemandtheNMEA0183ProtocolTheGlobalPositioningSystemGPSisasatellite-basednavigationsystemmadeupofanetworkof24satellitesplacedintoorbitbytheU.S.DepartmentofDefense.GPSwasoriginallyintendedformilitaryapplications.However,inthe1980sthegovernmentmadethesystemavailableforcivilianuse.GPSworksinanyweatherconditions,anywhereintheworldand24hoursaday.TherearenosubscriptionfeesorsetupchargesfortheuseofGPS[7].GPSsatellitescircletheEarthinuniformlyseparatedorbits.Eachsatelliteisawareofitsabsolutelocation,andisconstantlystreamingthatinformationataspecicchanneloftheGPSradioband1500Mhz.TheGPSsystemisillustratedinFigure6.WhenaGPSreceiveronlandtunestothesignalsfromatleast3satellites,itappliestimeofsignaltravelcalculationsandmeasuretheirdistancetothosesatellites.Through9

PAGE 19

Figure6.GPSorbitingsatellitestriangulation,thereceivercomputesitsabsolutepositionontheEarthssurface.Thepro-cedureisillustratedinFigure7.Untiltheyear2000theGPSservicetocivilianuserswasdegradedbytheSelectiveAvailabilityfeature,whichincreasedtheerrorofgeolocationto100meters.AfterSelectiveAvailabilitywasremoved,GPSerrorreducedto10meters.MostcommercialGPSreceiversincludeagraphicaldisplaytoshowthecoordinates,locationonamapandnavigationinformation.TheymayalsoincludeadataconnectorthatconnectstoaPCorotherequipment.TheconnectionisastandardRS-232serialportthatcanbeconnectedtoanypersonalcomputerorembeddeddevice.TheGPSreceiverstreamsitsgeolocationdatausingoneofseveralcommunicationprotocols,whichincludeGarmin,TrimbleorthestandardNMEA0183.AGPSreceivertolaptopconnectionisillustratedinFigure8.TheNMEA0183protocoldenestheserialportsettingsandtheformatofthedatastream.Theprotocoldictatesthattheserialportshouldbeoperatingat4800baud,8bits,noparityand1stopbit.Additionally,theGPSreceivermuststreamlocationdatain10

PAGE 20

Figure7.TriangulatingGPSuserposition Figure8.GPSreceiverconnectedtolaptop11

PAGE 21

theformofNMEAsentences.Figure9showsaserialportmonitorthatdisplaysthedatastreamedbyaGPSreceiver. Figure9.SerialportmonitorshowingNMEAsentencesTherearemanydierentkindsofNMEAsentencesthataGPSreceivermaystream.TheNMEAsentenceusedinthenavigationoftheSelf-GuidedMicroVehicleistheGPRMCsentence.Thissentencesummarizesthelocationdata,UTCtime,speedanddirectioninonesingleline.UsingtheGPRMCsentencealoneispreferredoverusingseveralNMEAsentencesandmergingtheirdata.Figure10explainsthestructureofaGPRMCsentence. Figure10.DissectionoftheGPRMCNMEAsentenceTheSGMVusedassemblyroutinestointerceptanddecodeGPRMCsentencescomingfromtheGPSreceiver.MoredetailsonthissystemcanbefoundinChapter2.12

PAGE 22

1.2.6TheHallEectandtheDinsmore1655Solid-StateCompassTheSGMVusedasolid-stateelectroniccompasscalledtheDinsmore1655.The1655sensorexploitstheHallEecttodetecttheEarthsmagneticeld.TheHallEectisaresultoftheLorentzforce.TheLorentzforcedeectschargedparticlesthatowthroughamagneticeld.Theresultingforceisperpendiculartoboththespeedandthemagneticeld.Figure11illustratestheLorentzforceinteractionwithachargedparticle. Figure11.LorentzforceTheHallEectisthecombinedeectofmanychargedparticles,electronsorholes,beingpushedbytheLorentzforcewhileowingthroughaconductor.TheLorentzforcecausesthechargedparticlestoaccumulateonasinglesideoftheconductor.Thisbuildupofchargecreatesavoltagedierentialthatisproportionaltothemagneticeld.Figure12illustratestheHallEect.TheDinsmore1655[6]electroniccompassiscomposedoftwoHallEectsensingdevicesthatcanaccuratelymeasuretheEarthsmagneticeldintwoperpendiculardirections.EachHallEectdeviceinthe1655containsaHallEectsensorelementandanamplierthatconditionsthesmallsignalfromthesensor.Theamplierhasavoltagebiasof2.5V.Magneticeldsinonedirectiongenerateavoltageover2.5Vandmagneticeldsintheotherdirectiongenerateavoltageunder2.5V.Theconditionedsignalsfrombothsensors13

PAGE 23

Figure12.Halleectcanbeacquiredbyamicroprocessor,whichcancalculatetheangleofthecompassrelativetotheEarthsmagneticeld.Figure13illustratestheworkingoftheDinsmorecompass. Figure13.TheDinsmore1655compass14

PAGE 24

CHAPTER2IMPLEMENTATION2.1ASimpleRCVehicleastheLocomotionBaseAsimple7-functionR/Cvehicle,withafewmodications,servedasthelocomotionbaseoftheSelf-GuidedMicroVehicle.TheR/Cvehiclewaschosenforitsmechanicalandelectricalcharacteristics.Thevehicleneededtobeabletomoveovergrassanddirtwherethetestsweregoingtoensue.Therefore,avehiclewithbigwheelsandahightorqueall-wheeldrivewaschosenoveraracingtypevehiclewithsmoothtires.ThevehiclechosenpossessedaatbedthatwasanalmostperfecttfortheHandyboardmicrocontroller.Additionally,therewasplentyofspaceinandaroundthevehiclesbodytoattachtherestoftheelectronics.TheR/Cvehicle,equippedwiththecontrolelectronicsispicturedinFigure14.TheR/Cvehiclewasalsoselectedbecauseitwaseasytointerfacewiththemicrocon-troller.ItwasimportantthattheR/Cnotbeaproportionalcontrollersincetheinternalelectronicdesignprovedtoodiculttoanalyzeduetothepulsatingnatureofitssignals.AnON/OFFR/Cvehiclecontainssimplercircuit,whichwaseasiertoanalyzeandmodify.ItwasalsofoundthatthecontrolsignalscouldbedirectlygeneratedbythemicrocontrollersincetheywerecompatiblewithCMOS/TTLlogiclevels.IntheR/Cvehiclescontrolcircuit,thecontrollinesforForward,Backward,RightandLeftwerelocatedon4ofthepinsofa14-pinDIPchip.Thesepinswerede-solderedfromtheprintedcircuitboardandfournewwiresweresolderedintheirplace.Thesewires,alongwithagroundingwire,wereconnectedtoaDB9connectorabovethecontrolcircuit.ThepinsintheDB9connectorwereconnectedtotheHandyboardmotoroutputsaccordingto15

PAGE 25

Figure14.Locomotionbasettedwithelectronics16

PAGE 26

Figure15.Thevoltagedividercircuitswerenecessarybecausethespecicoutputportsgenerate9VinsteadofalogichighlevelV. Figure15.R/CtruckinternalconnectionsOncealltheconnectionswerecomplete,theHandyboardwasabletooperatethedrivingmotorandsteeringservowiththecommandsfdx,bkxandoxwherexis0fordrivingand1forsteering.2.2TheHandyboardastheCentralProcessorTheHandyboard,alongwithitsbattery,wasinstalledontheatbedatthebackoftheR/Ctruck.TheHandyboardwassecuredwithfour1-inchstandoholderswithitschargeportfacingtothebackofthetruck.Thisphysicalsetupallowedforbatterychargingthroughthechargeport.However,thesetupmadeitdiculttooperatetheON/OFFswitch.ThesetupalsomadetheboardsI/OportsandSPIconnectoraccessibleforeasyconnection.TheHandyboardwasresponsibleofcoordinatingandperformingallcalculationsandfunctionsoftheSGMV.Inaddition,theHandyboardsInteractiveCruntimekernelenabledmulti-tasking.TheInteractiveCIntegratedDevelopmentEnvironmentispresentedinFigure16.TheHandyboardwasresponsibleofcontrollingallfunctions,communicatingwithaPChostandperformingthecalculationsinvolvedinGPSnavigation.TheHandyboards17

PAGE 27

Figure16.InteractiveCscreenshot18

PAGE 28

multitaskingabilitywasveryusefulforrunningallthesefunctionsconcurrently.Specically,theconcurrenttasksthattheHandyboardperformedwere:1.GPSmessagedecoding2.azimuthtotargetcalculation3.pathplanninganddriving4.communicationswiththePChostFigure17describestherelationshipsbetweenconcurrentfunctions.Thesetasksarediscussedindetailintheircorrespondingchaptersections. Figure17.ConcurrentfunctionsintheHandyboard2.3TheLantronixXPortBridgefromtheHandyboardtoaLocalNetworkTheHandyboardwasbuilttocommunicatewiththePChostthroughitsserialport,whichwasastandardUARTsetat9600baud,8databits,noparitybitand1stopbit.ItsvoltagelevelswereTTL,to5V,notRS232,+15to-15V,whicharenormallyfoundinpersonalcomputerserialports.Duetothesesignalvoltagedierences,theHandyboard19

PAGE 29

requiredavoltageconvertertocommunicatetothepersonalcomputerdirectly.Thevoltageconverter,alsocalledadriver,isusuallytheMAX232ICoranequivalentchip.However,intheSGMVsetup,theHandyboardneededtobeconnectedtoaTCP/IPnetwork.Therefore,theHandyboardwasconnectedtoaLantronixXPort,whichprovidedaSerial-to-TCP/IPconverter.TheHandyboardsdownloadport,anRJ45jack,wasconnecteddirectlytotheXPortserialinterface.TheXPortsinternalblockdiagramisshowningure18. Figure18.XPortblockdiagramInordertoimplementaTCP/IPconnectorfortheHandyboardtheXPortwassolderedonacustomPCBthatwasdesignedtakingtheXportIntegrationGuide[4]asreference.Thepowersupplycircuitconnectedtoanexternalvoltagesource,regulateditto3.3VandfedtheXPortthroughitsVccpins.TheserialconnectioncircuitconsistedofanRJ45jackthatwasconnecteddirectlytotheXPortsserialI/Opins.TheHandyboardsjackandthecustomPCBsjackwereconnectedwithashort,4-wiretelephonecord.TheseconnectionsareillustratedinFigure19.However,beforeconnectingtheHandyboardtotheXPort,theXPorthadtobecong-uredtoworkwiththeHandyboardandthespeciclocalnetwork.Toaccomplishthis,a20

PAGE 30

Figure19.XPortinterfacingcircuitpersonalcomputerhadtobeconnectedtotheXPortthroughitsserialportandaserialsessionhadtobeestablishedwithaterminalemulatorsuchastheHyper-terminal.TheHandyboardalsoprovidedaserialadaptor.ThisadaptorbridgedbetweentheHandyboardsdownloadportandaPCserialportthroughtheappropriateconnectorsandconvertedtheTTLleveledsignalsintotheappropriatelyconvertedRS232signals.ThisadaptorwasusedtoconnecttheXPortstothehostPC.However,thetelephonecordhadtobemodiedasillustratedinFigure20. Figure20.XPortcongurationcable21

PAGE 31

InordertoenterthecongurationmodetheXPorthadtobesuppliedpowerandthreexcharactershadtobeenteredwithinaonesecondtimelapse.TheXPortrespondedwithadisplayofallthecongurationsettingsandaprompttochangethem.Withinthecongurationmode,thefollowingsettingswereappliedtotheXPort:Serverconguration:IP=192.168.2.102,Gateway=N,Netmask=8Channel1Conguration:9600baud,I/F=4C,Flow=0,Port=10001Allothercongurationsettingswereleftunchangedfromtheirfactorydefaultval-ues.ThecongurationsettingsenabledtheXPorttocommunicateinanetworkwithIP=192.168.2.xandtoserialdevicesat9600baud.OncetheXPortwascongureditwasconnectedtoalocalnetworkandtheHandyboard.TheHostPC,whichwasalreadyinthelocalnetwork,hadanIPaddressof192.168.2.103.TheHostPCranWindows2000andautilitycalledComPortRe-directorwasinstalled.ThecongurationsetupispresentedinFigure21. Figure21.XPortconnections22

PAGE 32

2.4UsingtheBelkinF5D6130WirelessAPtoConnecttheTruckWirelesslyAftercongurationtheHandyboardcouldcommunicatewiththeHostPCthroughalocalnetwork.Thenextstepwastoadd802.11bequipmentinordertomaketheSGMVwireless.WhileseveralnetworkcongurationsarepossibletomakeawirelesslinkfortheXPort,onlyonewasappropriateforthisapplication.SincetheXPortwasanembeddedserver,ithadtohaveastaticIPandalwaysbeconnectedtothenetwork.Additionally,sincetheSGMVisamobileplatform,theSGMVmovefurtherthanthe802.11brange,theconnectiontothePChostmaybelostsometimes.ThesolutionwastohavethewirelessnetworkestablishedintheSGMVratherthanonaxedlocationnearthePChost.Toaccomplishthis,awirelessaccesspointWAPwasacquiredandinstalledintheSGMV.Morespecically,theBelkinF5D6130WirelessAPwasacquiredduetoitssmallsizeandlowcost.Figure22presentsaphotographoftheBelkinWAP. Figure22.TheBelkinF5D6130WAP23

PAGE 33

AWAPisaninternetworkingdevicethatconnectswiredandwirelessnetworks.ThefunctionofaWAPistoexpandawirednetworkwithawirelessnetwork.WAPsareusuallyusedtocomplementawiredrouterinordertoaddwirelessconnectivitytothenetwork.IntheSGMVthewirednetworkexistedonlyinsidethephysicaltruck.TheonlytwodevicesinthenetworkweretheLantronixXPortandtheBelkinWirelessAccessPoint.BothdeviceswereconnectedbyacrossoverCAT5cable.ThecrossovercableallowedtheconnectionofthetwodeviceswithoutanEthernethubbetweenthem.TheWAPsIPaddresswassetat192.168.2.254,theSSIDsettotruckandthewirelesschannelsetto1,followingtheinstructionsprovidedinitsusermanual[9].ThePChostcouldconnecttotheSGMVwirelessnetworkwhenitcamewithinradiosignalrange,whichwasapproximately100meters.SincetheSGMVwasstrictlyanoutdoorsapplicationthePChostwasrequiredtobealaptopcomputerequippedwithawirelessnetworkcard.ThelaptopwassettoIP192.168.2.103inthewirelessnetworkcalledtruck.InordertotesttheTCP/IPconnectionapingtestwasperformedfromthePChost.Thecommandping192.168.2.102wastypedfromthecommandline.IftheconnectionwasoperativetheXPortwouldrespondtothepingrequest.2.5UsingaVirtualSerialPorttoConnectthePCApplicationtotheNetworkTheComPortRe-directorisaWindowsutilitythatallowsotherapplicationssuchastheInteractiveCIDEtotalktoserialdevicesonthelocalnetwork.ComPortRe-directorcreatedavirtualserialport,whichtheapplicationusedasaregularserialport.Together,theXPortandtheComPortRe-directoreectivelyallowedtheWindowsapplicationtocommunicatetoserialportdevicesonthelocalnetwork.ThiscongurationisillustratedinFigure23.TheComPortRe-directorwaslaunchedintheHostPC.ItwasconguredtoinstallvirtualCOM3andassociateittotheXPortataddress192.168.2.102,port10001.Figure24

PAGE 34

Figure23.UsingtheXPortwirelessly23isascreenshotoftheRe-directorsuserinterface.RefertotheComPortRe-directorUserGuide[4]forspecicinstructionsonhowthissetupwasaccomplished. Figure24.COMPortRedirectoruserinterfaceOncetheRe-directorwasconguredandtheHandyboardconnectedtothelocalnet-work,theInteractiveCdevelopmentenvironmentwaslaunchedontheHostPC.InteractiveCproperlyconnectedanddownloadedcodetotheHandyboard,whichveriedthesuccessfulcongurationoftheTCP/IPlink.25

PAGE 35

2.6UsingtheDeluoGPSandMAX3100forGeolocationWhiletheabovesubchapterswererelatedtohardwareinstallation,congurationandde-ployment,thefollowingsubchaptersdiscussdesignandcoding.ImplementingtheSGMVfunctionsofGPSnavigationanddrivecontrolwerethemostchallengingpartofthisap-plication.ThesefunctionsrequiredCprogramming,assemblyprogrammingandelectronicdesign.TheGPSnavigationfunctionsintheSGMVwereaccomplishedbycapturingtheNMEAsentencesfromtheGPSreceiver,decodingthemandcalculatingthedirectiontothetarget.2.6.1ImplementationofaSerialPortwiththeMAX3100TherstproblemencounteredinthecaptureofGPSdatawasduetotheexistenceofonlyoneserialportintheHandyboard.Aspreviouslydiscussed,theHandyboardusedtheserialporttointeractwiththePCHostandtodownloadprogramcode.AsecondserialportwasaddedtotheHandyboardthroughtheuseoftheMAX3100chipfromMaximIC.ThischipisaUniversalAsynchronousReceiver/Transmitter,UART,whichiscompatiblewiththe68HC11SPIport.TheMAX3100datasheet[10]wasusedasareferencefortheelectronicdesign,whichincludedtheUARTchipplusafewelectroniccomponents.Figure25presentstheUARTcircuitfortheHandyboard.InordertoverifytheproperoperationoftheUARTcircuitthreetestshadtobecompletedsuccessfully:1.Theoscillatorcircuithadtooscillateat3.6MHz,2.TheHandyboardhadtobeabletoreadandwritetheMAX3100throughtheSPI,3.Thetransistorcircuithadtoinvertthesignalas:Vin=15V>>Vout=0VandVin=)]TJ/F15 10.909 Tf 8.485 0 Td[(15V>>Vout=5V:26

PAGE 36

Figure25.SchematicofMAX3100UARTcircuitTheHandyboardandtheMAX3100circuitworkedtogethertocaptureeverycharacterfromtheGPSreceiver.DuringinitializationtheHandyboardsentatwo-bytewordtoconguretheMAX3100sothatitcouldreceivecharactersat9600baud,8databits,noparityand1stopbit.Additionally,theMAX3100wasconguredtosendaninterruptsignalafteracharacterhadbeenreceived.2.6.2CharacterFetchingViaInterruptsTheinterruptsignalwascapturedbytheHandyboardsIC1line.AfterreceivinganinterrupttheHandyboardexecutedseveraltasks:1.performadatareadfromtheMAX3100,2.verifythatacharacterwasreceived,3.storethecharacterina128bytebuer,and4.performasentencedecodewhenaCarriageReturnCR,ASCIIcode0x13isreceived.27

PAGE 37

Thisprocesscanbevisualizedintheowchartingure26. Figure26.Characterfetchinterruptroutine2.6.3NMEA0183SentenceParsingRoutineWhenaCRcharacterisreceived,asentencedecoderoutineisstartedwithintheinterrupt.Thedecoderoutineveriesthatthesentencereceivedstartswith$GPRMCinordertocontinueitsoperation.Afterwards,theroutineparsesthesentenceandconvertsallthenumericinformationfromASCIItobinary.TherelevantinformationcontainedinthesentenceisUTCtime,latitude,longitude,speed,travelcourseanddate[8].Thenumericdataiscopiedtoothermemoryaddressesforotherroutinestoreadasrequired.Figure27presentstheparsingroutineinowchartform.28

PAGE 38

Figure27.NMEAdecoderoutine29

PAGE 39

NotethatdecimalfractionsintheGPRMCsentencearestoredintheirownmemorylocations.ItmustbedonethiswaysincetheHandyboardisslowwithoatingpointoperationsbutfastwithintegers.Theinterruptroutineandthedecodingroutinewereimplementedinasingleassemblyle,whichispresentedinAppendixF.2.6.4VehicleNavigationThenavigationroutine,navi,wasresponsibleofcalculatingtheappropriatecourseangletoreachthedesiredobjective.ThisroutinewaswritteninInteractiveCandexecutedinparallelwiththedrivingandcommunicationsroutinesthroughmultitasking.ThenaviroutinewaitsuntiltheGPS data readyagisraised,whichindicatesthattheNMEAsen-tencehasbeenparsedbytheinterruptroutine.Thisnormallyoccursonceeverysecond.TheGPScoordinatesandtargetcoordinateswereconvertedintotheir32-bitrepresenta-tions.Thisstepwasimportantinordertomakeallsubsequentcalculationsstraightforward.The32bitrepresentationwasobtainedas:latitude32=degrees60+minutes10000+decimalfractionNorthernlatitudeswereconsideredpositiveandsouthernlatitudeswereconsideredneg-ative.Westernlongitudeswereconsideredpositiveandeasternlongitudeswereconsiderednegative.Nextthedierencebetweenthelatitudesandlongitudeswerecalculatedtoobtainadeltavector.Thedeltavectorwasobtainedas:deltaX=latitudeTarget32)]TJ/F20 10.909 Tf 10.909 0 Td[(latitude32anddeltaX=longitudeTarget32)]TJ/F20 10.909 Tf 10.909 0 Td[(longitude32Afterthedeltavectorwascalculated,arectangulartopolarconversionwasperformed.TheroutineforvectorlengthwaswritteninInteractiveCandtheroutineforanglecal-culationwaswrittenin68HC11assemblyforperformancereasons.Theresultingradius30

PAGE 40

andanglecorrespondtothedistancetothetargetandtherequiredangleoftravel.Uponcompletionoftheconversionthenavi data readyagwasraisedforotherroutinestoread.2.7UsingtheDinsmore1655toAligntheTruckAsexplainedinthetheorysection,theDinsmore1655compassexploitstheHallEecttomeasuretheEarthsmagneticeldintwoperpendiculardirections.Thetwooutputvoltagesweredigitizedandthedirectionofthemagneticeldwascalculated.2.7.1CompassElectricalConnectionsTheDinsmorecompassoutputswereconnectedtotheHandyboardsanaloginputs2and3.ThecompassgroundandVccwereconnectedtothesensorpoweringportsoftheHandy-board.Figure28presentsadiagramofhowtheseconnectionsweremade. Figure28.Dinsmorecompasselectricalconnections31

PAGE 41

2.7.2AzimuthAngleCalculationRoutineTheHandyboardwasprogrammedwithroutinesthatcouldtransformthedigitizedcompasssignalsintotheanglefortheSGMVwithrespecttotheEarthsmagneticeld.Theroutine,dinsmore angle,combinedInteractiveCcodeandassemblycodeandeectivelycalculatestheangleofthemagneticeldwithrespecttothetruckby.1.ThesignalfromthesensorelementfacingforwardisdigitizedandstoredinvariableA.ThesignalfromsensorelementfacingeastisdigitizedinvariableB.2.128issubtractedfromAandBinordertocancelthe2.5Vbiasinthesensorelements.ThenAandBcontainsignednumbersandtheirsignscanbeusedtoinferthequadrantoftheangle.Thisquadrantissavedasavariable.3.TheabsolutevaluesofAandBarecalculatedandstoredbackinAandB.Thisstepisnecessarybecausethearctanassemblyroutinewouldonlyacceptapositiveargument.4.AandBarecompared.ThemaximumisstoredinAandtheminimumisstoredinB.Ifthevaluesareswitched,thenthecalculatedanglehastobereplacedwiththecomplementaryangle.ThisstepwasnecessarybecausethearctanassemblyroutinewouldonlytakeaB/Aratiothatislessorequalto1.5.TheA/BratioiscalculatedwiththeFDIVassemblyinstruction.ThemostsignicantbyteoftheratioissavedinvariableF.VariableFcontainsavaluebetween0and255,whichrepresentingtheratios0/256through255/256.ThecalculationoftheA/BratioispresenteddiagrammaticallyinFigure29.6.ThearctanassemblyroutinecalculatesthearctangentoftheratioF/256.Theanglereturnedrangesfrom0to45degrees.ThearctanroutineappliesaquadraticformulatoapproximatethearctangentfunctionwhereANGLE=976)]TJ/F20 10.909 Tf 10.909 0 Td[(FF=409632

PAGE 42

Figure29.CalculatingthefractionF=A/B33

PAGE 43

In8-bitarithmetic,whichwasoptimizedfortheHC11CPU,theanglecalculationisgivenas:ANGLE=244F>>10F2>>12::7Thex>>yoperationmeansxshiftedybitstotheright.Thisassemblyfunctionwascomparedtoatruearctangentfunction.Theangleerrorwaszerointheextremes0and255.Theerrorwas1degreewhenF=128,whichamountedtoamaximumerrorof2percent.Figure30presentstherelationbetweenthecalculatedandactualvalues. Figure30.Arctangentassemblyfunctionerror7.TheresultingangleneededtobeadjusteddependingonwhetherAandBwereswitchedandthequadrantdeterminedinstep2.Thenalanglerangedbetween0and359.2.7.3AligningtheTruckTowardstheTargetTheDinsmoresensorrequiresasignicantamountofprocessingworkinordertouseitsdata.Theanglecalculatedfromthesensordataisusedtoalignthetruckinanydirection.Thisalignmentisperformedbytheroutinealign angleangle.Thealign angleanglerou-tineusesthedinsmore anglefunctionandthemotorcontrolfunctionsoftheHandyboard.Theroutinedrivesandsteersthetruckinacontrolledwaytoalignthetruckinthedesireddirectiontowardsthetargetcoordinates.Theroutineworksasfollows:34

PAGE 44

1.TheSGMVmotorsstopfor1second,sincetheDinsmorecompasscantsenseaccu-ratelyundervibrationconditions.2.Theangleerror=dinsmore angletarget angleiscalculatedandadjustedtofallwithintherangeof-180and180degrees.Figure31presentsanillustrationofthecalculationobtainedfromequation8. Figure31.Calculatingtheangleerror3.Iftheerrorispositive,itmeansthatthetruckisalignedtotheleftofthetargetandarightturnisneededtocorrecttheangle.Iftheerrorisnegative,thetruckisalignedtotherightofthetargetandaleftturnisneededtocorrecttheangle.4.Thetruckissteeredleftorrightforanamountoftimeproportionaltotheangleerror.Thesteeringisperformedbydrivingforwardwhileactuatingthesteeringtoeithertheleftorright.5.Theerrorangleiscalculatedagainasdenedbyequation8.35

PAGE 45

6.Ifthemagnitudeoftheerrorangleisgreaterthansomearbitrarytolerancethentheprocessisrepeatedfromstep3.Otherwise,theroutineexits.2.7.4Self-GuidedMicroVehicleDrivingThenavigationtaskfortheSGMVsystemreliesonthealign angleanglefunctionandthecalculatedangle-to-targetfromthenavigationtask.Thefunctionandthevaluearethekeytosuccessfulmovementtowardthedesiredtarget.Thestatementalign angleangle to targetisinvokedassoonastheangle to targetisdeterminedbythenavigationtask.Afteralign-mentthevehicledrivesforwardfor10seconds.Theprocessisrepeateduntilthetruckentersthevicinityofthetarget.Whenthetruckreachesthetarget,thetargetisswitchedtothenextpairofcoordinatesinthepresetitinerary.ThisprocessisillustratedinFigure32. Figure32.SGMVdrivingitinerary36

PAGE 46

CHAPTER3TESTINGANDRESULTS3.1TerrainHandlingofLocomotionBaseTheSelf-GuidedMicroVehiclewastestedoutdoorsonagrasseld.TheSGMVcoulddrivestraightforwardandbackwardorturnleftandrightonthisterrain.Thetrucksspeedwasabout1meterpersecondanditsturningradiuswas50centimeters.TherewereafewproblemswiththeSGMVdriving.Sincetherewassomuchweightmountedonthetrucksbody,ifthetruckwasmovingbackwardandthenwassuddenlycommandedtodriveforwardthetruckwouldverylikelytipbackward.Thetippingwasonlymomentarybutshouldbeavoidedbynotdrivingbackwardandforwardsuddenly.Anotherproblemencounteredduringdrivingwasmechanicalvibration.Thevibrationpreventedoperationofthecompasswhiledriving.Thepresenceofvibrationduringmotionmadeitnecessarytostopthetruckforasecondbeforetakingacompassreading.3.2PilotingwiththeHandyboardTheHandyboardwassuccessfulincontrollingthetrucksdrivingmotorandsteeringservo.SincetheywerewiredtotheHandyboardsmotoroutputsthenativecommandsfd,bkandocouldbeusedtocontrolallofthetrucksfunctions.Moreover,sincetheHandy-boardhasnativePWMmodulationformotorsthemotorx,ycommandcouldbeusedtoregulatethepowertothewheels.Whenthepowerismodulated,thetruckcanbesettodriveatlowerthanfullspeed.However,thespeedcannotbecontrolledexactlyduetothetrucksnonlineardynamicsystemwithoutafeedbacksensor.Thesteeringsignalcouldalsobemodulatedbuttheresultingsteeringactionwasawk-ward.Ifthesteeringsignalwasmodulated,thesteeringwheelswouldstartshaking.There-37

PAGE 47

fore,itisrecommendedthatthesteeringwheelsbeoperatedinanON/OFFfashion.Thereasonforthiserraticbehaviorisstillundetermined.However,itmightbeduetoincorrecttimingofthePWMsignalortheapplicationofincorrectvoltages.3.3PerformanceoftheWirelessCommunicationsLinkThewirelesscommunicationlinkworkedasexpectedformostoperations.TheWirelesssys-tem,whichiscomposedoftheXPort,theBelkinWAP,thewirelesslaptopandRe-directorsoftwareworkedsuccessfullywhilelinkingtheHandyboardtoitsInteractiveCdevelopmentenvironment.Serialportoperationssuchasprogramdownloadingandinteractionwereper-formedsuccessfully.Alltheseoperationsweresuccessfuluntilthewirelessrangewasoutofreach,whichoccurredatapproximately300feetawayfromtheSGMV.ThislimitationisillustratedinFigure33. Figure33.802.11bwirelessrangeThewirelesslinkwasnotsuccessfulatperformingabootstraprmwaredownload.Apparently,thesignallatencyintroducedbytheTCP/IPnetworkcausesthebootstrapdownloadoperationtoterminateprematurely.Fortunately,rmwaredownloadisarareoperationthatneedstobeperformedonlywhenasystemcrashhasoccurredorwhenthebatteriesaredepleted.38

PAGE 48

3.4PerformanceoftheGPSGeolocationSystemTheGPSgeolocationsystem,whichiscomposedoftheGPSreceiver,theMAX3100cir-cuit,theNMEAdecoderandthenavigationroutineperformedexactlyasplanned.Uponpowerup,theGPSstartedstreamingNMEAsentences,whichtheHandyboardimmediatelystartedtofetch.TheGPStookafewsecondsuntilitstartedtrackingGPSsatellites.WhentheGPSreceiverstartedstreamingoutvalidxes,theHandyboarddecodedthepositionsuccessfully.Afterdecoding,thenavigationtaskcalculatedtheangletothetargetcor-rectly.TheoperationrepeatedeverytimetheGPSstreamedaGPRMCsentenceandtheangle-to-targetdatawasalwayscalculatedcorrectly.TheaccuracyofthexreportedbytheGPSreceivervariedfrom3metersto10meters.ThenavigationtasksthatareassignedtotheSGMVmusttakethiserrorintoaccount.TheusersshouldnotassignnavigationtasksthatwouldrelyonGPSaccuracyoflessthan10meters.ThissituationisillustratedinFigure34. Figure34.GPSlocationuncertainty3.5QualityofNavigationwiththe1655CompassTheSGMVsystemsuccessfullyaligneditselftoanydesiredangle.Thecontrolstrategywasverysimpleandworkedbutithasalotofroomforimprovement.Forexample,attimesit39

PAGE 49

takesupto6or7steeringactionstofullyalignthetrucktothedesiredangle.Veryoften,thesteeringactionovershootsthedesiredangle.Suchanon-optimalaligningprocedureslowsdowntheoveralldrivingoperation.3.6FollowingaPolygonalRoutePlanTheSGMVwasprogrammedtofollowarectangularpatharoundasoccereldintheUSFsportsarea.ThecoordinatesofthefourcornersofthesoccereldwereenteredintheHandyboardsmemoryandtheHandyboardwascommandedtoproceedtowardsthosetargetsinsequence.TheSGMVwassuccessfulatdirectingitselfthroughtherectangularpath.AlthoughthetruckhadtostopeveryvesecondstocheckitstravelangleandeverytimetheGPSxwaslost,whichaddedseveralsecondstothecompletiontime,itcompletedtheroutesuccessfully.BecauseofGPSerror,thetrucksometimesdriftedfromthetheoreticalpathlinebyupto5metersoneachside.Thetestendedwhenthetruckcompletedthepathtwice.TheactualpaththatthetruckfollowedisillustratedinFigure35. Figure35.SGMVpath40

PAGE 50

CHAPTER4CONCLUSION4.1DiscussionTheSelf-GuidedMicroVehiclecompletedthetasksitwascommandedtoperform.TheGPSdecodingperformedexactlyasplanned.However,theGPSreceivercouldhavebeenfasteratobtainingaxandbetteratmaintainingit.Theanglealigningoperationswerelessthanoptimal.Theseproblemscouldbesurpassedifothercontrolmethodswereemployed.TheSGMVasaplatformtolearncontrols,roboticsandcommunicationspossessesgreatpotential.WiththeexibleanduserfriendlyHandyboard,astudentcouldeasilyaddextrasensorsforavoidingcollisions.Inaddition,itwouldbeaninterestingupgradeifanetworkcamerawereaddedtotheLocalAreaNetworkoftheSGMV.4.2PossibleFutureImprovementsAsmentionedearlier,thebiggestimprovementareaisintheanglealigningfunction.Abettercontrolstrategy,orevenabettersensorwouldbenettheperformanceofthefunction.TheSGMVusesaNiCad1000mAhbatterytopowertheHandyboard,GPSreceiverandDinsmorecompass.Thisloadwearsoutthebatteryinjustonehour.Thistimeisenoughtimetocompleteanavigationmission,butitisnotenoughfordevelopment.ItisrecommendedthatthebatteryisupgradedtoahighercapacityNiMHorLithiumbattery.TheSGMVdoesnotpossesothersensorsthanGPSandcompasstonditsway.Inordertopreventcollisionswithobstacles,itisrecommendedtoinstallsensorsforthispurpose.Thevehiclepossessesan802.11bwirelessaccesspointwithmoredataratethanrequiredforHandyboardcommunications.Itispossibletomakeuseoftheexcessbandwidthwith41

PAGE 51

IPcamerasmountedonthetruckbody.Itisalsopossibletoupgradethe802.11bWAPwithan802.11gWAP,whichprovides5timesthedatarate.4.3ConclusionThedevelopmentoftheSGMVwasalaboriousundertakingthatproducedanunmannedautonomousvehicleexperimentationplatform.TheSGMVisdirectedatanotherengineer-ingstudentsthatwishtoexperimentwithroboticsthatprovidesausefulteachingtool.Bypublishingthedocumentation,tothegeneralpublic,futurestudentscanuseitasasteppingstonetomaketheirownUAVandimproveonit.Evenifonlypartofthesedesignsisusedasareferencetheywouldprovetobevaluableasastartingpointforotherdesigns.42

PAGE 52

REFERENCES[1]NationalStrategyforHomelandSecurity",OceofHomelandSecurity,.[2]TheM68HC11ReferenceManual",Motorola,Motorola,.[3]XPortIntegrationGuide",http://www.lantronix.com/pdf/WiPort IG.pdf,Lantronix,.[4]XPortUserGuide",http://www.lantronix.com/pdf/XPort UG.pdf,Lantronix,.[5]TheHandyboardTechnicalReference",http://www.handyboard.com/tech-docs/hbmanual.pdf,.[6]DinsmoreSensingSystemsGeneralInformation",http://www.robsonco.com/sensor-information.pdf,RobsonCompany2003.[7]GPSGuideforBeginners",http://www.garmin.com/manu-als/GPSGuideforBeginners Manual.pdf,Garmin.[8]GM-205GPSReceiverModuleUserGuide",http://www.deluo.com/sup-port/les/docs/EmtGPSUserGuide.zip,EvermoreTechnology.[9]BelkinF5D6130UserManual",http://web.belkin.com/sup-port/download/les/F1D6130 V2 manual uk.pdf,Belkin.[10]MaximMAX3100Datasheet",http://pdfserv.maxim-ic.com/en/ds/MAX3100.pdf,MaximIC2001.43

PAGE 53

APPENDICES44

PAGE 54

AppendixASGMVDimensions Figure36.DimensionsoftheSelf-GuidedMicroVehicle45

PAGE 55

AppendixBHandyboardPinoutDiagram Figure37.Handyboardelectricalconnectors46

PAGE 56

AppendixCHandyboardtruck.icProgramListing//Self-GuidedMicroVehicleHandyboardICCode//CRobertoGuerra,2005#use"gps_adapter.ic"#use"drive_module.ic"#use"scada.ic"inti;voidmain{//Centerofoverflowengineeringparkinglot//28d03.6085mN,82d25.1243mWset_target,03,6085,82,25,1243;init_gps;//startsaprocessthatbuffersanddecodesNMEAGPRMCsentencesinit_navigation;//startsaprocessthatcalculatesdelta[2],distance,angleandrisesaflagdriveport_init;//init_scada;gps_navi_ready=0;beep;while!gps_navi_ready{printf"%d:%d:%dn",gps.utc_hh,gps.utc_mm,gps.utc_ss;sleep.1;}//start_processitinerary,1;happytones;/*while{gps_avalon_align;}*/}voidgps_avalon_align{set_target_relative,0;//setthetarget200motthenorthofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadytones.,0.3,1;align_anglegps.delta_angle;set_target_relative,200;//setthetarget200motthewestofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadytones.,0.3,2;align_anglegps.delta_angle;47

PAGE 57

AppendixCContinuedset_target_relative-200,0;//setthetarget200motthesouthofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadytones.,0.3,3;align_anglegps.delta_angle;set_target_relative,-200;//setthetarget200mottheeastofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadytones.,0.3,4;align_anglegps.delta_angle;}voidset_target_avalon{//setsthetarget200mtothenorth,//waituntilnavigationdataisready,thenprintthedelta_angle//repeatwithwest,south,east.set_target_relative,0;//setthetarget200motthenorthofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadyprintf"%d",gps.delta_angle;beep;set_target_relative,200;//setthetarget200motthewestofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadyprintf"%d",gps.delta_angle;beep;set_target_relative-200,0;//setthetarget200motthesouthofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadyprintf"%d",gps.delta_angle;beep;set_target_relative,-200;//setthetarget200mottheeastofthetruckwait_gps_navi;//waitsuntilnavigationdataisreadyprintf"%dn",gps.delta_angle;beep;/*while{printf"%d",gps.angle_to_target;align_anglegps.angle_to_target;gas_forward;msleepL;}*/}48

PAGE 58

AppendixCContinued//Thisroutinechangesdestinationiftruckiswithin10metersoffdestinationvoiditinerary{intdestination_number=0;set_target_relative,0;while{ifgps_navi_ready{ifgps.deltanorm32<50L{ifdestination_number=0{move_target_meters,100;//set_target,03,6085,82,25,1243;//target0destination_number=1;}ifdestination_number=1{move_target_meters-100,0;//set_target,03,6085,82,25,1243;//target1destination_number=2;}ifdestination_number=2{move_target_meters,-100;//set_target,03,6085,82,25,1243;//target2destination_number=3;}ifdestination_number=3{set_target_relative00,0;//set_target,03,6085,82,25,1243;//target3destination_number=0;}}gps_navi_ready=0;}defer;}}voidhappytones{inti;fori=1000;i<=5000;i+=250tonefloati,0.05;}49

PAGE 59

AppendixCContinuedvoidtonesfloata,floatb,intc{inti;fori=0;i
PAGE 60

AppendixDHandyboardgps adapter.icProgramListing//GPSadapterICcode//CRobertoGuerra,2005//IncludethisICinyouraplication.//Initializeusinginit_gps//Settargetwithset_target//Usethegps_structgpstoaccessgpsdataandangle_to_target//dinsmore_angleworksifthedinsmorecompassisconnectedto//analog2Nandanalog3E//ThisICBcontainstheMAX3100drivers,IRQ-drivenbufferandNMEAdecoding.//andanglecalculationroutines.#use"gps_adapter_navi.icb"structgps_struct{//bytenumber//Modifiedbynmeadecodeingps_adapter.asmintutc_hh;//00intutc_mm;//02intutc_ss;//04intfix_valid;//06intlat_dd;//08Northispositiveintlat_mm;//10intlat_mmmm;//12intlon_dd;//14Westispositiveintlon_mm;//16intlon_mmmm;//18intspeed_knots;//20intspeed_mps;//22intcourse_degrees;//24N=0,E=90,S=180,W=270intdate_dd;//26intdate_mm;//28intdate_yyyy;//30//Modifiedbyset_target.Usedbynavigation.inttarget_lat_dd;//32inttarget_lat_mm;//34inttarget_lat_mmmm;//36inttarget_lon_dd;//38inttarget_lon_mm;//40inttarget_lon_mmmm;//42//Modifiedbynavigationprocess51

PAGE 61

AppendixDContinuedlongpos32[2];//44longtar32[2];//52longdelta32[2];//60delta=target-positionlongdeltanorm32;//78intdelta_angle;//82N=0,W=90,S=180,E=270};charmax3100buffer[128];//GPRMCsentencegetbufferedherestructgps_structgps;//globalgps_structobjectintgps_navi_ready;//indicatesthatthedelta,angle_to_target,deltanormvalueshavebeencalculated.//lowerittozeroandpollituntilitbecomes1.intdinsmore_array1[10];intdinsmore_array2[10];voidinit_gps{//Telltheassemblyroutinewherethebufferis.bfrptr=intmax3100buffer+2;//Telltheassemblyroutinewherethegps_structis.gps_struct_ptr=int&gps;//Enablethebufferinginterruptroutine.//ThebufferingroutineinvokesthedecodingafterCRLF.enable_buffer;}voidinit_navigation{//Activatethenavigationroutinestart_processnavigation,1;}//calculatestheangleofthevectorx,yrespectto,0.//Counterclockwisepositive.intangle32longx,longy{longvector[2];vector[0]=x;vector[1]=y;returnangle32asmint&vector[0];}//calculatestheangleofthevectorx,yrespectto,0.Counterclockwisepositive.intangle16intx,inty{intvector[2];vector[0]=x;52

PAGE 62

AppendixDContinuedvector[1]=y;returnangle16asmint&vector[0];}//MeasuresthecourseanglewiththeDinsmorecompass//N=0,E=90,S=180,W=270intdinsmore_angle{intangle;angle=angle16analog-128,analog-128-160;ifangle<0angle+=360;returnangle;}//checkswhentheflagisupandcalculatestheangletotargetvoidnavigation{while{ifgps_data_ready{ifgps.fix_valid{calc_delta_rec;calc_delta_pol;gps_navi_ready=1;}gps_data_ready=0;}defer;}}voidcalc_delta_rec{gps.pos32[0]=degrees2longgps.lat_dd,gps.lat_mm,gps.lat_mmmm;gps.pos32[1]=degrees2longgps.lon_dd,gps.lon_mm,gps.lon_mmmm;gps.delta32[0]=gps.tar32[0]-gps.pos32[0];gps.delta32[1]=gps.tar32[1]-gps.pos32[1];}voidcalc_delta_pol{gps.deltanorm32=norm32gps.delta32[0],gps.delta32[1];//N=0,W=90,S=180,E=270gps.delta_angle=angle32gps.delta32[0],gps.delta32[1];}53

PAGE 63

AppendixDContinuedlongnorm32longx,longy{floatx2=floatx;floaty2=floaty;returnlongsqrtx2*x2+y2*y2;}longdegrees2longintdd,intmm,intmmmm//N,Warepositive.S,Earenegative{returnlongdd*60+mm*10000L+longmmmm;}voidset_targetintlat_dd,intlat_mm,intlat_mmmm,intlon_dd,intlon_mm,intlon_mmmm{gps.target_lat_dd=lat_dd;gps.target_lat_mm=lat_mm;gps.target_lat_mmmm=lat_mmmm;gps.target_lon_dd=lon_dd;gps.target_lon_mm=lon_mm;gps.target_lon_mmmm=lon_mmmm;gps.tar32[0]=degrees2longlat_dd,lat_mm,lat_mmmm;gps.tar32[1]=degrees2longlon_dd,lon_mm,lon_mmmm;}intaverage_dinsmore_angle{inti;fori=9;i>1;i--{dinsmore_array1[i]=dinsmore_array1[i-1];dinsmore_array2[i]=dinsmore_array2[i-1];}dinsmore_array1[0]=analog-128;dinsmore_array2[0]=analog-128;returnangle16dinsmore_array1[0],dinsmore_array2[0];}voidmove_targetintlat_dd,intlat_mm,intlat_mmmm,intlon_dd,intlon_mm,intlon_mmmm{gps.target_lat_mmmm+=lat_mmmm;gps.target_lat_mm+=lat_mm;gps.target_lat_dd+=lat_dd;gps.target_lon_mmmm+=lon_mmmm;gps.target_lon_mm+=lon_mm;gps.target_lon_dd+=lon_dd;correct_target;54

PAGE 64

AppendixDContinuedgps.tar32[0]=degrees2longgps.target_lat_dd,gps.target_lat_mm,gps.target_lat_mmmm;gps.tar32[1]=degrees2longgps.target_lon_dd,gps.target_lon_mm,gps.target_lon_mmmm;}voidmove_target_metersintmeters_north,intmeters_west{//minutes/10000north=metersnorth*27/5//minutes/10000west=meterswest*27/5*coslatitudeintmmmm_west;mmmm_west=intfloatmeters_west*5.4*cosfloatgps.target_lat_dd*.017444;move_target,0,meters_north*27/5,0,0,mmmm_west;correct_target;}voidset_target_relativeintmeters_north,intmeters_west{gps.target_lat_mmmm=gps.lat_mmmm;gps.target_lat_mm=gps.lat_mm;gps.target_lat_dd=gps.lat_dd;gps.target_lon_mmmm=gps.lon_mmmm;gps.target_lon_mm=gps.lon_mm;gps.target_lon_dd=gps.lon_dd;move_target_metersmeters_north,meters_west;}voidcorrect_target{fix_dd_mm_mmmm&gps.target_lat_dd,&gps.target_lat_mm,&gps.target_lat_mmmm;ifgps.target_lat_dd>90gps.target_lat_dd=90;ifgps.target_lat_dd<-90gps.target_lat_dd=-90;fix_dd_mm_mmmm&gps.target_lon_dd,&gps.target_lon_mm,&gps.target_lon_mmmm;ifgps.target_lon_dd>180gps.target_lon_dd=180;ifgps.target_lon_dd<-180gps.target_lon_dd=-180;}voidrolling_adjustint*high_number,int*low_number,intdivisor{//if*low_numberistoohighif*low_number>=divisor{*high_number+=*low_number/divisor;*low_number=*low_number%divisor;}//iflat_mmmmisnegative55

PAGE 65

AppendixDContinuedif*low_number<0{*high_number+=*low_number+1/divisor-1;*low_number=*low_number+1%divisor+divisor-1;}}voidfix_dd_mm_mmmmint*dd,int*mm,int*mmmm{rolling_adjustmm,mmmm,10000;rolling_adjustdd,mm,60;if*dd>180*dd=180;elseif*dd<-180*dd=-180;}voidwait_gps_navi{gps_navi_ready=0;while!gps_navi_ready;}56

PAGE 66

AppendixEHandyboarddrive module.icProgramListing//ICmoduletodrivethe7functionR/Ccar.//needscompassfunctionsfromgpsadapter.ic//CRobertoGuerra,2005//dinsmore_anglereturns://N->0//W->90//S->180//E->270#definetolerance10#definesteerdelay300L#definestoppingdelay500L#defineturngain_initial4#defineturnbias_initial40//Outputport#defineoutput_port0x0e#definemotor1_power0x22#definemotor2_power0x23//forwardonpin9ofU10.Greenwire,pin6ofDB9#defineforwardbit16//backwardonpin10ofU10.Redwire,pin7ofDB9#definebackwardbit1//rightonpin2ofU10.Blackwire,pin8ofDB9#definerightbit2//leftonpin1ofU10.Whitewire,pin9ofDB9#defineleftbit32intangle_to_drive;intspeed_to_drive;intdebug;/*voiddriver_init{start_processdriver_process,1;}voiddriver_process{//modifythisroutinesothatthetruckstopsevery5seconds,//checksitsdirectionandcorrectsitifthedeviationismore//thantoleranceintgas,steer,angle;intturntime,rel_angle;driveport_init;57

PAGE 67

AppendixEContinuedwhile{//errorcorrectingloopwhile{//waitstillforonesecond,makingatonetone.0,0.05;msleepL;//measureorientation.North=0,East=90,etcangle=dinsmore_angle;//displayangleandangle_to_driveprintf"%d%dn",angle,angle_to_drive;//calculaterelativeanglerel_angle=angle-angle_to_drive;//makerel_anglebetween-180and180ifrel_angle<-180rel_angle+=360;if058

PAGE 68

AppendixEContinued{steer_center;gas_forward;msleepL;gas_stop;}}}*/voidalign_angle3intangle_to_align{//usethedrivesubroutinetoalignthetrucktothe//anglegiven.Calculatesanoptimumturntime_gainintrel_angle,turntime,turngain;intrel_angle_old,turntime_old;intinitial_steer=0;longstarttime;starttime=mseconds;rel_angle=wait_rel_angleangle_to_align;ifabsrel_angle0initial_steer=1;elseinitial_steer=-1;turntime=absrel_angle*turngain_initial;//+turnbias_initial;drivesignrel_angle,initial_steer,longturntime;turntime_old=turntime;rel_angle_old=rel_angle;rel_angle=wait_rel_angleangle_to_align;whileabsrel_angle>tolerance&&mseconds-starttime<5000L{printf"%dn",rel_angle;ifabsrel_angle-rel_angle_old<4return;//toolittleturnturngain=turntime_old/rel_angle-rel_angle_old;turntime=absrel_angle*turngain;//+turnbias_init;drivesignrel_angle*initial_steer,initial_steer,longturntime;turntime_old=turntime;rel_angle_old=rel_angle;rel_angle=wait_rel_angleangle_to_align;}}voidalign_angle2intangle_to_align{//usethedrivesubroutinetoalignthetrucktothe59

PAGE 69

AppendixEContinued//anglegiven.intrel_angle,turntime,turngain;intrel_angle_old,turntime_old;intinitial_steer=0;longstarttime;starttime=mseconds;rel_angle=wait_rel_angleangle_to_align;ifabsrel_angle0initial_steer=1;elseinitial_steer=-1;whileabsrel_angle>tolerance&&mseconds-starttime<5000L{turntime=absrel_angle*turngain_initial+turnbias_initial;drivesignrel_angle*initial_steer,initial_steer,longturntime;rel_angle=wait_rel_angleangle_to_align;}}voidalign_angleintangle_to_align{intrel_angle;rel_angle=wait_rel_angleangle_to_align;iftolerancetolerance{printf"%dn",rel_angle;ifrel_angle>tolerance{turntime=4*rel_angle+200;gas_forward;msleeplongturntime;gas_stop;rel_angle=wait_rel_angleangle_to_align;}ifrel_angle<-tolerance{turntime=-4*rel_angle+200;gas_backward;60

PAGE 70

AppendixEContinuedmsleeplongturntime;gas_stop;rel_angle=wait_rel_angleangle_to_align;}}steer_center;}voidalign_angle_leftintangle_to_align{intturntime,rel_angle;steer_left;msleepL;rel_angle=wait_rel_angleangle_to_align;whileabsrel_angle>tolerance{ifrel_angle>tolerance{turntime=4*rel_angle;gas_backward;msleeplongturntime;gas_stop;rel_angle=wait_rel_angleangle_to_align;}ifrel_angle<-tolerance{turntime=-4*rel_angle;gas_forward;msleeplongturntime;gas_stop;rel_angle=wait_rel_angleangle_to_align;}}steer_center;}intabsintx{ifx<0return-x;elsereturnx;}intsignintx{ifx>0return1;ifx<0return-1;return-x;61

PAGE 71

AppendixEContinued}intwait_dinsmore_angle{gas_stop;msleepL;returndinsmore_angle;}intwait_rel_angleintreference{intrel;rel=wait_dinsmore_angle-reference;ifrel>180rel-=360;ifrel<-180rel+=360;returnrel;}voiddriveport_init{pokeoutput_port,0;pokemotor1_power,128;pokemotor2_power,128;gas_stop;steer_center;}voiddriveport_test{driveport_init;drive,0,1000L;msleepL;drive-1,0,1000L;msleepL;drive,1,1000L;msleepL;drive,-1,1000L;msleepL;}voiddriveintgas,intsteer,longdelay{ifsteer==0steer_center;else{ifsteer>0steer_right;else{62

PAGE 72

AppendixEContinuedifsteer<0steer_left;}//msleepsteerdelay;}ifgas==0gas_stop;else{ifgas>0gas_forward;elseifgas<0gas_backward;}ifdelay>0L{msleepdelay;gas_stop;/*msleepstoppingdelay;steer_center;*/}}voidgas_forward{bit_clearoutput_port,backwardbit;bit_setoutput_port,forwardbit;fd;}voidgas_backward{bit_clearoutput_port,forwardbit;bit_setoutput_port,backwardbit;bk;}voidgas_stop{bit_clearoutput_port,forwardbit;bit_clearoutput_port,backwardbit;off;}voidsteer_right{bit_clearoutput_port,leftbit;bit_setoutput_port,rightbit;fd;}voidsteer_left63

PAGE 73

AppendixEContinued{bit_clearoutput_port,rightbit;bit_setoutput_port,leftbit;bk;}voidsteer_center{bit_clearoutput_port,leftbit;bit_clearoutput_port,rightbit;off;}voidmodulate_driveintgas,intsteer,intperiod,intduration{longstarttime;driveport_init;starttime=mseconds;ifabsgas==abssteer{whilemseconds-starttimeabssteer{whilemseconds-starttime
PAGE 74

AppendixFHandyboardgps adapter navi.asmProgramListing*ICbinarydriverfortheGPSadapter.*CRobertoGuerra,2005*IRQ-MAX3100-BUFFER*ltr*capturedletter*ltrctr*counterofletterwithinbuffer*variable_bfrptr*addressofbuffer'sfirstcharacter*subroutine_initialize_module*initializestheSPI,theMAX3100,theTIC3interrupt*subroutine_enable_buffer*clearstheTIC3flag,setstheTIC3mask*subroutine_disable_buffer*clearstheTIC3mask*subroutine_max3100*sends16bitsfromACCDandreceives16bitstoACCD*max3100_buffer*itiscalledeverytimeTIC3goesto1*catchesacharacterandeitherbuffersit*orprocesses/resetthebuffer*GPRMCDECODER*GPRMCstr*"$GPRMC"stringtocomparetobuffer*temp*temporary16-bitword*variable_gpsstructptr*addressoffirstelementofpointergps_struct*variable_gps_data_ready*flagthatinformsthattheNMEAstringhasbeendecoded*subroutine_process_gprmc*ifbuffercontainsaGPRMCsentence,decodesitand*fillsallelementsofgps_struct,includingangle_to_target*compare_strings*comparestwostrings,pointedbyIXandIYrespectively*skip_comma*movesIXtooneplaceafterthenextcomma*get_number*capturesamulti-digitnumberstartingatIX*untilanondigitisfound*VECTORANGLECALCULATION*M0,M1,M2,M3,N0,N1,N2,N3*longnumbertempsMandN*bits*bytetostorelogicbits65

PAGE 75

AppendixFContinued*angle*calculatedangle*subroutine_angle32asm*calculatestheangleofthelong[2]pointedbyACCD*subroutine_angle16asm*calculatestheangleoftheint[2]pointedbyACCD*normalize32*duplicatesthesignedlongsMandNasmanytimesaspossible*MNsl32*shiftsMandNtotheleftoneplace*calc_angle*calculatestheangleofthevectorM0,N0signedbytes*subroutine_atan8*takesthearctanofACCB/256unsignedandreturnsangleinACCDorgMAIN_START********************************************IRQ-MAX3100-BUFFER**ICDriversfortheMAX3100SPIUART.*InterruptdrivenDigitalinput7/TIC3*Buffersseparatedsentences.*Raisesatheflag"sentence_ready"*Requiresinitializationofbufferpointer*InitializesSPIsystem,MAX3100on*CanbeswitchedONandOFFwithbuffer_enable,buffer_disable*RefertotheHC11manualandtheMAX3100datasheet*******************************************REGBASEequ$1000PORTDequ$1008DDRDequ$1009TCTL2equ$1021TMSK1equ$1022TFLG1equ$1023SPCRequ$1028SPSRequ$1029SPDRequ$102ATIC3INTequ$BFEAltr:fcb$AAltrctr:fcb$00variable_bfrptr:fdb$0000variable_bfrlen:66

PAGE 76

AppendixFContinuedfdb$0000variable_sentence_ready:fdb$0000subroutine_initialize_module:*setupinterruptvectorldd#max3100_bufferstdTIC3INT*setupSPIldaa#$2FstaaPORTDldaa#$38staaDDRDldaa#$50staaSPCR*setupMAX3100ldd#$e40cbsrmax3100*setupinterruptcontrolregistersldx#REGBASE*TIC3,fallingedgebsetTCTL2,x%00000010bclrTCTL2,x%00000001*TIC3flagclearbclrTFLG1,x%11111110*TIC3mask,disabledatfirstbclrTMSK1,x%00000001rtssubroutine_enable_buffer:pshxldx#REGBASEbclrTFLG1,x%11111110bsetTMSK1,x%00000001pulxrtssubroutine_disable_buffer:pshxldx#REGBASEbclrTMSK1,x%00000001pulxrts*sendsACCDtomax3100andreceivesonACCDmax3100:ldx#REGBASEbclrPORTD,x%00100000clear~SSbit5ofPORTD67

PAGE 77

AppendixFContinuedstaaSPDRsendhighbytetoslavebrclrSPSR,x$80*loopuntiltransfercompleteldaaSPDRcaptureslave'shighbytestabSPDRsendlowbytetoslavebrclrSPSR,x$80*loopuntiltransfercompleteldabSPDRcaptureslave'slowbytebsetPORTD,x%00100000raise~SSbit5ofPORTDrts*checksforcharacterandloopsuntilallmax3100bufferisemptymax3100_buffer:ldx#$1000bclrPORTD,X%00100000clear~SSbit5ofPORTDclrSPDR,XsendhighbytetoslavebrclrSPSR,X$80*loopuntiltransfercompleteclrSPDR,XsendlowbytetoslavebrclrSPSR,X$80*loopuntiltransfercompleteldaaSPDR,Xcaptureslave'slowbytebsetPORTD,X%00100000raise~SSbit5ofPORTDstaaltrcmpa#13beqCRcmpa#10beqLF*normalprocessingofaletter,addstringterminationldxvariable_bfrptrldabltrctrabxstaa0,Xclr1,Xincbcmpb#127bhsbfrexitltrctr'smaxvalueis127stabltrctrbrabfrexit*ifR=,resetltrctrCRclrltrctrbrabfrexit*ifR=,raiseflagLFldd#1stdvariable_sentence_readyjsrsubroutine_process_gprmc68

PAGE 78

AppendixFContinuedbfrexitldx#REGBASEbclrTFLG1,x%11111110rti********************************************GPRMCDECODER**$GPRMC,071358.000,A,2548.4648,N,08017.4962,W,000.0,000.0,120204,000.0,W*09*0123456789012345678901234567890123456789012345678901234567890123456789012*01234567*******************************************utc_hhequ0utc_mmequ2utc_ssequ4validequ6lat_ddequ8lat_mmequ10latmmmmequ12lon_dddequ14lon_mmequ16lonmmmmequ18knotsequ20mpsequ22courseequ24date_ddequ26date_mmequ28datyyyyequ30tlatddequ32tlatmmequ34tlammmmequ36tlondddequ38tlonmmequ40tlommmmequ42pos32equ44tar32equ52del32equ60deln32equ78delangequ82GPRMCstr:fcc"$GPRMC"temp:fdb$0000variable_gps_struct_ptr:fdb$0000variable_gps_data_ready:69

PAGE 79

AppendixFContinuedfdb$0000subroutine_process_gprmc:pshxpshyldxvariable_bfrptrldy#GPRMCstrldaa#6jsrcompare_stringsbeqprccontjmpprcexitprccontldyvariable_gps_struct_ptrjsrskip_commaldaa#2jsrgetnumberstdutc_hh,yldaa#2jsrgetnumberstdutc_mm,yldaa#2jsrgetnumberstdutc_ss,yjsrskip_commaldd#0stdvalid,yldaa0,xcmpa#'Abneinvalidincvalid+1,yinvalid:jsrskip_commaldaa#2jsrgetnumberstdlat_dd,yldaa#2jsrgetnumberstdlat_mm,yinxldaa#4jsrgetnumberstdlatmmmm,yjsrskip_commaldaa0,xcmpa#'Nbeqnorthldd#0subdlat_dd,y70

PAGE 80

AppendixFContinuedstdlat_dd,yldd#0subdlat_mm,ystdlat_mm,yldd#0subdlatmmmm,ystdlatmmmm,ynorthjsrskip_commaldaa#3jsrgetnumberstdlon_ddd,yldaa#2jsrgetnumberstdlon_mm,yinxldaa#4jsrgetnumberstdlonmmmm,yjsrskip_commaldaa0,xcmpa#'Wbeqwestldd#0subdlon_ddd,ystdlon_ddd,yldd#0subdlon_mm,ystdlon_mm,yldd#0subdlonmmmm,ystdlonmmmm,ywestjsrskip_commaldaa#3jsrgetnumberstdknots,y*1knot=0.5144meterspersecond=132/256mpsldab#132multabclrastdmps,yjsrskip_commaldaa#3jsrgetnumberstdcourse,yjsrskip_commaldaa#2jsrgetnumber71

PAGE 81

AppendixFContinuedstddate_dd,yldaa#2jsrgetnumberstddate_mm,yldaa#2jsrgetnumberaddd#2000stddatyyyy,yldd#1stdvariable_gps_data_readyprcexitpulypulxrts*theroutinebelowcomparesthestringspointedat*byIXandIY.Thenumberofcharactersisgivenby*ACCA.Uponreturn,stringequalityisreflectedby*CCR.ZconditioncodeandACCA=0.*IXandIYpointtothedifferingcharacters.compare_strings:ldab0,xcmpb0,ybnecmpexitinxinydecabnecompare_stringscmpexitrts*movesIXtooneplaceafterthenextcomma.*IfIXpointsatacommaalready,IXwillbeincrementedby1.skip_comma:ldaa0,xinxcmpa#',bneskip_commarts*capturesamulti-digitnumberstartingat0,x,endingwiththe*lastcharacter0-9.IXgetsincrementedtothenextnondigitchar.*TheroutinecapturesuptoACCAunsignedchars.getnumber:clrtempclrtemp+1loopmcmpa#0blsnodig72

PAGE 82

AppendixFContinuedldab0,xsubb#'0blonodigcmpb#10bhsnodigpshapshblddtemplsldlsldadddtemplsldstdtemppulbclraadddtempstdtemppuladecainxbraloopmnodiglddtemprts********************************************VECTORANGLECALCULATION*******************************************Mzmb4Nzmb4bitsfcb$00anglefdb$0000*Argument:pointertoarraylong[2]*Calculatestheangleofx,yandreturnsitsubroutine_angle32asm:pshxxgdxldd0,x73

PAGE 83

AppendixFContinuedstdMldd2,xstdM+2ldd4,xstdNldd6,xstdN+2jsrnormalize32jsrcalc_anglelddanglepulxrts*Argument:pointertoarrayint[2]*Calculatestheangleofx,yandreturnsitsubroutine_angle16asm:pshxxgdxldd0,xstdMldd#0stdM+2ldd2,xstdNldd#0stdN+2jsrnormalize32jsrcalc_anglelddanglepulxrts*duplicatesM0,M1,M2,M3andN0,N1,N2,N3repeatedlyuntil*itcan'tbeduplicatedanymorewithoutdataloss.normalize32:*testingwhetherthenumbersarenormalizableloopnclrbitsldaaMlslaeoraM74

PAGE 84

AppendixFContinued*a1intheMSBmeansthatMisnormalized.Storeitin'bits'staabitsldaaNlslaeoraN*a1intheMSBmeansthatNisnormalized.Oritwith'bits'orabitsanda#$80cmpa#$80beqnormalizedjsrMNsl32braloopnnormalized:rts*shiftleftM0,M1,M2,M3andN0,N1,N2,N3MNsl32:lddMlsldstdMlddM+2lsldstdM+2ldaaM+1adca#0staaM+1*shiftleftN0,N1,N2,N3lddNlsldstdNlddN+2lsldstdN+2ldaaN+1adca#0staaN+1rts*calculatestheangleofthevectorM0,N0signedbytescalc_angle:*takenoteofthequadrant*takeabsolutevalueofM0andN0clrbitsldaaMbplMposldaabitsoraa#%1staabits75

PAGE 85

AppendixFContinuednegMMpos:ldaaNbplNposldaabitsoraa#%10staabitsnegNNpos:*makethevectorfitinthe0-45degreeoctant*takenoteoftheoctantldaaMcmpaNbhiMhigherbloMlowerldd#45braMNsameMlower:ldaabitsoraa#%100staabitsldaaMldabNstabMstaaNMhigher:*makethefraction:N0->IX,M0->ACCD.quotient->IXldaaMclrbxgdxldaaNclrbfdivxgdxtabclra*takethearctangentjsrsubroutine_atan8MNsame:stdangle*nowwehavecalculatedtheangleinthefirstsector*take'bits'andadjusttheangleaccordingtotheoctant*adjustangleaccordingtoquadrantandsectorldaabitscmpa#0beqsector0cmpa#1beqsector176

PAGE 86

AppendixFContinuedcmpa#2beqsector2cmpa#3beqsector3cmpa#4beqsector4cmpa#5beqsector5cmpa#6beqsector6cmpa#7beqsector7sector0:bradonesector1:ldd#180subdanglestdanglebradonesector2:ldd#360subdanglestdanglebradonesector3:ldd#180adddanglestdanglebradonesector4:ldd#90subdanglestdanglebradonesector5:ldd#90adddanglestdanglebradonesector6:ldd#270adddanglestdanglebradonesector7:ldd#270subdanglestdangle77

PAGE 87

AppendixFContinuedbradonedone:rts*takestheunsignedfractionalvalueACCB/256andcalculatesthe*arctangentindegrees.Result-45inACCD.subroutine_atan8:*-f*f/4096=-f^2+976*f/4096=-f^2/*16+244*f/*4pshbtbamultabclralsrblsrblsrblsrbstdtemppulbldaa#244multabclralsrblsrbsubdtemprts78


xml version 1.0 encoding UTF-8 standalone no
record xmlns http:www.loc.govMARC21slim xmlns:xsi http:www.w3.org2001XMLSchema-instance xsi:schemaLocation http:www.loc.govstandardsmarcxmlschemaMARC21slim.xsd
leader nam Ka
controlfield tag 001 001681054
003 fts
005 20060215071156.0
006 m||||e|||d||||||||
007 cr mnu|||uuuuu
008 051221s2005 flu sbm s000 0 eng d
datafield ind1 8 ind2 024
subfield code a E14-SFE0001067
035
(OCoLC)62724657
SFE0001067
040
FHM
c FHM
049
FHMM
090
TK145 (Online)
1 100
Guerra, Roberto J.
0 245
Self-guided micro vehicle
h [electronic resource] :
b an autonomous vehicle with gps navigation and 802.11b communications /
by Roberto J. Guerra.
260
[Tampa, Fla.] :
University of South Florida,
2005.
502
Thesis (M.S.E.E.)--University of South Florida, 2005.
504
Includes bibliographical references.
516
Text (Electronic thesis) in PDF format.
538
System requirements: World Wide Web browser and PDF reader.
Mode of access: World Wide Web.
500
Title from PDF of title page.
Document formatted into pages; contains 87 pages.
3 520
ABSTRACT: To facilitate the learning of automatic navigation systems by engineering students an easy to obtain platform is useful. The topic of this thesis is the design and implementation of a basic self-guided vehicle that can be programmed and expanded by anyone possessing basic experience with the C programming language. The Self-Guided Micro Vehicle, (SGMV), uses off-the-shelf easy to obtain parts such as a toy R/C truck and the Handyboard to maximize availability of this technology to students.This thesis divides the SGMV design process by functionality. It starts by documenting the locomotion system, which was a modified R/C toy truck. Next, it describes the Microcontroller board and the Handyboard. Then it highlights the programming language, Interactive C, which makes multitasking systems easy for beginners. The sensor system was comprised of a GPS receiver, a solid state electronic compass and a wireless communications system.
590
Adviser: Dr. Wilfrido Moreno.
653
Nmea.
Motorola.
M68hc11.
Handyboard.
Wifi.
Lantronix.
Xport.
Dinsmore.
690
Dissertations, Academic
z USF
x Electrical Engineering
Masters.
773
t USF Electronic Theses and Dissertations.
4 856
u http://digital.lib.usf.edu/?e14.1067