Professional Documents
Culture Documents
Autonomous Landing
Unmanned Aerial Vehicle
FongJunWen
Departmentof
MechanicalEngineering
Inpartialfulfilmentofthe
requirementsfortheDegreeof
BachelorofEngineering
NationalUniversityofSingapore
Session2008/2009
AutonomousLandingUAV
Session2008/2009
Summary
ThisthesispresentsthesystemarchitectureforlandinganUnmannedAerialVehicle
(UAV)fromahoveringpositionwithouttheinterventionofahumanoperator.
Throughtheuseoffeedbackinformationfromaheightsensor,theUAVis
commandedtoperformcontrolleddescentwiththedesiredlandingparametersby
implementationoftheflightcontrollaws.
Theplantmodelofthesystemwasdeterminedinordertosimulatethesystem
usingMatlab,Simulink.Throughtheuseofsimulations,thevariablesofthe
controllersarevariedtodeterminethemostappropriategainsthatwillresultinthe
mostpreferredlandingprofile.
Inthisproject,theverticalcomponentwhichcontrolstheclimbanddescendsofthe
platformwasisolatedfromtheroll,pitchandyawthroughtheuseofajig.Therefore,
thiscurrentprojectonlycommandstheheightoftheplatformbutcanbefully
expandedtocommandtheroll,pitchandyawwithadditionsensorssuchasrate
gyro.
I|P a g e
AutonomousLandingUAV
Session2008/2009
Acknowledgement
Theauthorwouldliketoexpresshisappreciationtotheprojectsupervisor,
AssociateProfessorGerardLengSiewBing,fortheopportunitytoworkonthis
project,aswellasforhispatientguidanceinthevariousaspectsoftheproject.
Theauthorwouldalsoliketoextendhissincereappreciationtothefollowingpeople
fortheirassistanceduringthecourseofthisproject:
1. MrMuhamadAzfarbinRamli,GraduatestudentoftheCOSYlab,forhiskind
assistancetothevariousproblemsthatwasencounteredduringthecourse
ofthisproject.
2. MsAmyChee,MsPriscillaLee,MrChengKokSengandMrAhmadBinKasa,
StaffoftheDynamics&Vibrationlab,fortheirhelpandsupportwith
necessaryequipments.
3. MrRonaldTanHanRongforhissupportandassistanceduringthe
constructionphaseofthecoandereffectflyingsaucer.
II|P a g e
AutonomousLandingUAV
Session2008/2009
Contents
Summary .................................................................................................................................... I
Acknowledgement .................................................................................................................... II
ListofFigures ............................................................................................................................ V
ListofTables ............................................................................................................................ VI
ListofSymbols ........................................................................................................................ VII
1.
Introduction...................................................................................................................... 1
1.1.
Objective ................................................................................................................... 1
1.2.
Historicalbackground ............................................................................................... 1
2.
Theory............................................................................................................................... 3
2.1.
HelicopterAerodynamics.......................................................................................... 3
2.2.
PIDSystem ................................................................................................................ 4
3.
HardwareandSetup ........................................................................................................ 5
3.1.
UAVPlatform ............................................................................................................ 5
3.1.1.
CoanderEffectFlyingsaucer............................................................................. 5
3.1.2.
DraganflyerTiV................................................................................................. 6
3.2.
Testbedconstruction ............................................................................................... 7
3.3.
Sensorwithmounting............................................................................................... 8
3.4.
Microcontroller:BasicStamp.................................................................................... 8
3.5.
Communication......................................................................................................... 9
3.6.
Problemsencountered ........................................................................................... 10
3.6.1.
Pausewidth..................................................................................................... 10
3.6.2.
Trimmedsignal................................................................................................ 10
3.6.3.
LagtimebetweenPulseTrain......................................................................... 10
3.7.
4.
Programmingalgorithm .......................................................................................... 13
Experimentsconducted ................................................................................................. 14
4.1.
OperationoftheFutabaRFtransmitter ................................................................. 14
4.2.
ExperimentsonDraganflyer ................................................................................... 15
5.
ResultsandDiscussions.................................................................................................. 18
III|P a g e
AutonomousLandingUAV
Session2008/2009
5.1.
Testingandcalibrationofultrasonicsensor ........................................................... 18
5.2.
Determinerelationshipbetweenthrottleandthrust............................................. 19
5.3.
MeasurementofPWMsignalfromradiotransmitter............................................ 19
5.4.
Relationshipbetweenhelicoptercontrolsandpulsewidth ................................... 21
5.5.
Determinesystemplantmodel .............................................................................. 22
5.6.
SimulationsusingMatlab,Simulink ........................................................................ 23
5.6.1.
ZieglerNicholsmethod ................................................................................... 23
5.6.2.
ProportionalDerivativecontrol:TrialandErrormethod ............................... 23
5.7.
Flighttest ................................................................................................................ 24
5.7.1.
Flight1:Scheduledproportionalcontrol ........................................................ 24
5.7.2.
Flight2:Throttlereductionof20% ................................................................. 25
5.7.3.
Flight3:ProportionalDerivativecontrol ........................................................ 25
5.7.4.
Flight4:Hovertosetpoint ............................................................................. 26
5.8.
Analysiswithsimulatedplot ................................................................................... 27
5.8.1.
Comparingsimulationandactualplot............................................................ 27
5.8.2.
Rootlocusanalysis .......................................................................................... 27
6.
Conclusions..................................................................................................................... 30
7.
RecommendationsforFurtherWork ............................................................................ 31
7.1.
IntegratingcontrollerforRoll,PitchandYaw......................................................... 31
7.2.
Camerasystemtolocatelandingzone ................................................................... 31
References .............................................................................................................................. 32
AppendixI.
FiguresandTables ...................................................................................... 34
AppendixII.
Fourworkingstatesofarotorinaxialflight ............................................. 37
AppendixIII.
Coandereffect ............................................................................................ 39
AppendixIV.
ZieglerNicholstuningmethod................................................................... 40
AppendixV.
CoanderEffectflyingsaucerexperiment .................................................. 41
AppendixVI.
Autonomouslandingprogram(Basic) ....................................................... 45
IV|P a g e
AutonomousLandingUAV
Session2008/2009
ListofFigures
Figure1:(A)WakebehaviourOGE/IGE;(B)ThrustratioVsDistance .......................... 3
Figure2:BlockDiagramofPIDControlsystem ............................................................ 4
Figure3:ConstructionoftheCoanderEffectUAV ....................................................... 5
Figure4:FlightcontroloperationoftheDraganflyerVTi............................................ 6
Figure5:ConstructedTestbed ..................................................................................... 8
Figure6:UltrasonicdistancesensorattachedtoUAV ................................................. 8
Figure7:Communicationofcontrolsystem................................................................. 9
Figure8:Lagtimebetweenpulsetrain ...................................................................... 11
Figure9:Newcommunicationsystem........................................................................ 12
Figure10:Flowchartofautonomouslandingsystem................................................ 13
Figure11:ExperimentalsetuptomeasurePWMsignal............................................. 14
Figure12:Experimentalsetuptomeasuregeneratedthrust .................................... 15
Figure13:SystemplantmodelledinSimulink............................................................ 16
Figure14:(A)Ultrasonicsensorresults;(B)Percentageerrorbelow40cm .............. 18
Figure15:PlotofThrustVsThrottle........................................................................... 19
Figure16:PWMSignalsfromFutabatransmitter ...................................................... 19
Figure17:Sevenchannelsfromsinglepulsetrain ..................................................... 21
Figure18:(a)PlotofThrottleVsPulsewidth;(b)PlotofThrustVsPulsewidth ....... 21
Figure19:PlotsofRateofdescentVsPulsout ........................................................... 22
Figure20:Systemsplantmodel................................................................................. 23
Figure21:SimulationsusingZieglerNicholsmethod................................................. 23
Figure22:SimulationsusingPDcontrol ..................................................................... 24
Figure23:Resultsusingscheduledproportionalcontrol ........................................... 24
Figure24:Resultsusingthrottlereductionmethod................................................... 25
Figure25:ResultsusingPDcontrol:(a)Kp:1.0/Kd:1.0;(b)Kp:3.0/Kd:1.0.................. 25
Figure26:HoveringtosetpointusingPDcontrol...................................................... 26
V|P a g e
AutonomousLandingUAV
Session2008/2009
Figure27:Comparisonbetweensimulatedandactualplot....................................... 27
Figure28:Rootlocusplot ........................................................................................... 28
Figure29:ModelofCoandereffectUAVusingSolidworks........................................ 34
Figure30:TestbedmodelinSolidworks .................................................................... 34
Figure31:PinOutdiagramofRFtransmitter,FutabaSkysport6T6YG ..................... 35
Figure32:Modifiedwiringintotrainerport............................................................... 35
Figure33:Futabatransmittercontrolsdiagram......................................................... 35
Figure34:Serialcommunicationwithflowcontrol.................................................... 36
Figure35:DescriptionofPulsewidthVsChannel ...................................................... 36
Figure36:FlowvisualizationatvariousdescentvelocitiesusingShadowgraphy...... 37
Figure37:Flowacrossalimitingsurface .................................................................... 39
Figure38:ModificationtoPlatform ........................................................................... 41
Figure39:J.Naudinsexperimentalsetup.................................................................. 42
Figure40:Naudinsresult ........................................................................................... 42
Figure41:Experimentalsetupforairspeedmeasurement........................................ 43
Figure42:Variablesofexperiment............................................................................. 43
ListofTables
Table1:ZieglerNicholstuningchart .......................................................................... 40
Table2:Airspeedtestresults...................................................................................... 44
VI|P a g e
AutonomousLandingUAV
Session2008/2009
ListofSymbols
Altitude,displacementfromground
Altituderatechange
Error
or
Proportionalgain
Integralgain
Derivativegain
Integralcontrollerscaler
Derivativecontrollerscaler
Ultimateperiod
Controllertransferfunction
Openlooptransferfunction
Closedlooptransferfunction
Risetime
Peaktime
Settlingtime
Maximumovershoot
VII|P a g e
Introduction
Session2008/2009
1. Introduction
1.1.Objective
ThisprojectaimstodevelopanautonomouslandingsystemthatwillenableaUAV
tolandautonomouslywithouttheinterferenceofahumanoperator.Thescopeof
thisprojectwaslimitedtothealtitudecontrolonly,withouttheinterventionofthe
Roll,PitchandYawmotion.However,thedevelopedconceptsandcontrollawscan
alsobefurtherextendedtoencompassRoll,PitchandYawcontrolwithadditional
sensorssuchastherategyroorthetiltsensor.
Someotherobjectivesaretheselectionandtestingofasuitablealtitudesensor,the
implementationoftheflightcontrollawsusingtheProportionalIntegralDerivative
(PID)controller,thetuningofthePIDgainsusingvariousmethodsandlastlyaflight
demonstrationtovalidatetheautonomouslandingsystem.
1.2.Historicalbackground
TheconceptofUAVbeganduringtheAmericanCivilWar,whentheNorthandthe
Southattemptedtobombeachothersammunitiondepotbylaunchingballoons
carryingexplosivedevicewhichwouldbereleasedatacontrolledtiming.However,
theactualbeginningstartedduringWorldWarII,whenacompanyChanceVought
Aircrafthadproposedbuildingmissileswithlandinggear,inordertosavecost.
1|P a g e
Introduction
Session2008/2009
Recently,UAVsuchastheGlobalHawkandthePredator,haveachieved
considerablepopularity,whenitwasemployedtoprovideaerialsurveillanceaswell
asattackmissionsinAfghanistan.TherearemanyotherusefulapplicationsofUAV
suchashomelandsecurity,cropdustingandtrafficmonitoring.
UAVcanbeclassifiedundertwodistinctcategories,FixedwingandRotary.Some
examplesofRotaryUAVincludehelicopter,MicroAirVehicleandOrganicAir
Vehicle,whereastheGlobalHawkandPredatorrepresentsFixedwingaircraft.
AccordingtoReinHardt[2],thenextgenerationofUAVswillbesmallerinsize,more
affordable,easiertotrainandmoreprecisethantheexistingUAVs.Also,UAVsare
expectedtobecapableofdetectingnuclear,biological&chemicalweapons,looking
intodoublecanopyjunglesandprovidelowcost,reliablecommunicationsanddata
relayacrossthebattlefield.Inurbanbuiltupareas,whereairspaceisoftenlimited,
VerticalTakeOffandLanding(VTOL)UAVisoftenemployed.
TheremotepilotingofaVTOLUAVisaverychallengingtaskwhichrequiresgreat
operatorskillandattention[4].Furthermore,mostmaneuverswouldrequirethe
pilottomaintainfullvisualcontactwiththeUAVatalltimes,especiallyduringthe
landingphase.Inaddition,someotherfactorsthatmightaffecttheRemotecontrol
(RC)performancearepoorpositionalaccuracy,pooraltitudeaccuracyandpilot
fatigue[4].
2|P a g e
Theory
Session2008/2009
2. Theory
2.1.HelicopterAerodynamics
ThefourworkingstatesofarotorinaxialflightaredescribedinAppendixII.In
particular,thevortexringstateshouldbeavoidedduringdescentasitmightresult
inhighlyunsteadyflowwithnonlinearityasaffirmedbyYaggy&Mort(1963).This
unsteadinesscancausesignificantbladeflapping,uncommandeddropindescent
rate,lossofcontroleffectiveness,andexcessivethrustfluctuations.
Figure1:(A)WakebehaviourOGE/IGE;(B)ThrustratioVsDistance
Groundeffectcanalsoaffecttheperformanceofahelicopter.Figure1Ashowsthe
wakebehaviorfromahoveringstateInandOutofgroundeffectandfigure1B
showstheincreaseinthrustratioatdifferenthoveringheightastestedby
Fradenburgh(1972)andHayden(1976).Theseresultssuggestsignificanteffectson
hoveringperformanceforheightsoflessthanonerotordiameter,wherethereisa
sharpincreaseinthrust.
3|P a g e
Theory
Session2008/2009
2.2.PIDSystem
Figure2:BlockDiagramofPIDControlsystem
TheclassicalcontroltheorywithaclosedloopPIDcontrollerisusedtocontrolthe
altitudeoftheUAVasillustratedbytheblockdiagraminfigure2.Theultrasonic
sensorattachedtotheUAVprovidesrangefeedbackfortheclosedloopsystemand
itsdataisalsocapturedbythecomputerfordataloggingpurposes.Severalmethods
oftuningthegainsofthecontrollerareproposed.
4|P a g e
HardwareandSetup
Session2008/2009
3. HardwareandSetup
3.1.UAVPlatform
Forthisproject,arotarytypeplatformwasselectedasitisabletomaintaina
hoveringpositionbeforethelandingcommandisinitiated.Duringtheinitialstage,a
hovercraftwhichusescoandereffecttoproduceliftwasexplored.However,dueto
thenatureofthisproject,aswellastheproblemsencountered,itwaseventually
replacedwithanotherofftheshelfplatform,thedraganflyerVTi.
3.1.1. CoanderEffectFlyingsaucer
Thephenomenonwhichcausesflownearlimitingsurfacetofollowthegeometrical
shapeofthesesurfacesisknownastheCoandereffect.Accordingtoresearcher
JeanLouisNaudin,theVTOLplatformwasabletoattaingoodcontrol,stabilityand
thrustwhichiscomparableorevenbetterthanaconventionalRChelicopter.In
accordancewithhisbuiltplan,asimilarplatformwasmodelledusingCADsoftware,
SolidworksinAppendixI,figure29,andbuiltcarefullyasshowninfigure3.
Figure3:ConstructionoftheCoanderEffectUAV
5|P a g e
HardwareandSetup
Session2008/2009
However,subsequenttestsconductedontheplatformconcludedthatthecoander
effectwasunabletoproducesufficientliftaspromised.Detailedexperimentsthat
wereconductedtoverifythelift,aswellassomeminormodificationstotheUAV
areattachedtoAppendixVforreference.
3.1.2. DraganflyerTiV
TheflightcontrolsoftheDraganflyeroperatesolelyondifferentialthrustbetween
thefrontrearandleftrightmotor,wherebyanetresultantmomentcanbe
generatedalongtherollaxis(xaxis)orthepitchaxis(yaxis)toproducearollora
pitchmotionasshowninfigure4.
Figure4:FlightcontroloperationoftheDraganflyerVTi
Forinstance,topitchtheUAVup,thefrontmotorwillrotatefasterthantherear
motor.Anotheradvantageofthisplatformisthatnomechanicallinkageisrequired
asthereisnocontrolsurface.
6|P a g e
HardwareandSetup
Session2008/2009
3.2.Testbedconstruction
InordertoinvestigateandtunetheentireUAVsystem,differentjigswithdifferent
degreeoffreedom(DOF)arerequired.Forexample,inordertotunethePID
controllerfortherollmotion,atestbedwhichrestrictstheUAVmotiontotheroll
axisonlyisrequired.Generally,thePIDcontrollermustbetunedseparatelyforthe
individualroll,pitchandyawaxis[11].
Forthisproject,thePIDcontrollerthatmustbetunedisinthetranslationalz
direction,withreferencetofigure4.Therefore,atestbedwith1DOFinthe
translationalzdirectionisrequired.Thetestbeddesignismodelledusing
SolidworksasshowninAppendixI,figure30.Thedimensionoftheceilingframeis
modelledaccordingtotheactualdimensioninthelaboratory.TheUAVismounted
onacarbonfibrecrossbar,andthecrossbarisjoinedtotheverticalpolystyrene
supportsbyfourprismaticjoints,whichallowstranslationaldisplacementalongthe
verticalsupportsonly.Therefore,thissetupcaneffectivelyconstraintheUAVtothe
translationalzdirectionasshowninfigure5.
7|P a g e
HardwareandSetup
Session2008/2009
Figure5:ConstructedTestbed
3.3.Sensorwithmounting
ThePING)))Ultrasonicrangesensorisattachedtoamountingmadeofbalsawood
andhighdensityfoamisusedtoprotectthesensorfromimpactwiththeground.
Figure6:UltrasonicdistancesensorattachedtoUAV
3.4.Microcontroller:BasicStamp
8|P a g e
HardwareandSetup
Session2008/2009
ThemicrocontrollerBasicstampBS2pxandBS2pefromparallaxwasusedtoprocess
theinformationfromtheultrasonicsensorandtogeneratetherequiredsignal.
3.5.Communication
Figure7:Communicationofcontrolsystem
Figure7illustratestheoriginalcommunicationsofthelandingsystem.Tosimplify
theproblem,theconnectionbetweentheultrasonicsensorandthemicrocontroller
wasphysicallywired.Initially,asinglemicrocontrollerBasicstampBS2pxwasused
tocalculatethedistancefromtherangesensoraswellasprocessingthedataand
generatingthenecessarysignaltotheRadiofrequency(RF)transmitter.The
transmitterwillthenrelaythesignalstotheUAVviathetrainerport.
APinOutdiagramoftheFutabatransmitterisshowninAppendixI,figure31.In
ordertocontroltheUAVusingthemicrocontroller,thesixpinplugismodifiedand
onlythreeofthepinsareused:Pin2(PPMOut),Pin3(PPMIn)andPin7(Ground
shield).Pin2isusedtomonitorthesignalsgeneratedbythetransmitterandPin3is
usedtoreceivethesignalsfromthemicrocontrollerintothetransmitter.TheRadio
FrequencysignalisfinallytransmittedtothereceiveronboardtheUAV.
9|P a g e
HardwareandSetup
Session2008/2009
3.6.Problemsencountered
3.6.1. Pausewidth
Forbasicstampmicrocontroller,thecommandPAUSEwillcauseadelaywhereno
signalwillbetransmittedtothepin.However,thesmallestunitis1millisecond
whereasthepauserequiredbetweenchannelsisonly0.4ms.Toovercomethis
problem,anotherpulsesignalwassenttoanotherdummypin,whichwillresultin
aninduceddelaytotheactualpinthatisconnectedtothetransmitter.
3.6.2. Trimmedsignal
Itwasobservedthatthetrimmingsonthetransmitteraffectthesignalsthatare
generatedquitesignificantly.AppendixI,figure33showstheFutabatransmitter
withthetrimcontrol.Thus,theUAVattachedtothetestbedshouldbeproperly
trimmedtomaintainhoverbeforethegeneratedsignalsaremeasured.
3.6.3. LagtimebetweenPulseTrain
10|P a g e
HardwareandSetup
Session2008/2009
Figure8:Lagtimebetweenpulsetrain
Figure8ashowsthelagtimeof98msforthefulllandingprogramand8bshowsthe
reducedoroptimizedprogram,havingalagtimeof56ms.However,itisstillfar
fromthedelayrequiredof0.4ms.
Tosolvethisproblem,analternativecommunicationsystemisrequired.Figure9
showsthenewcommunicationsystemthatrequirestwomicrocontrollersto
operatesimultaneously.BS2pewasusedtocollectfeedbackdatafromthe
ultrasonicsensorandactsasthePIDcontrollertoprocessestheretrieveddata.Itis
alsoconnectedtothecomputerwhichwillsavetheinformationfordatalogging
purposes.AnothermicrocontrollerBS2pxwasconnectedtoBS2pethroughserial
communication.TheprimaryfunctionofBS2pxistogenerateregularpulsesof
signalstotheRFtransmitter.Thisisverycrucialaslonglagtimewillregisterasa
temporarylossoflinkwhichwillcausetheUAVtobecomeuncontrollableand
twitchesviolently.Therefore,thefasteststampBS2pxwithprocessingspeedofup
to19,000instructionspersecondwasemployedtoperformthisduty.
11|P a g e
HardwareandSetup
Session2008/2009
Figure9:Newcommunicationsystem
Uponfurtherinvestigation,itwasdeducedthattheultrasonicsensor,runningat
about20Hz,iscausingthelonglagtime.Thus,theusageoftwobasicstampscan
effectivelyisolatetheinherentlagtimeproblemthatiscausedbythesensor.
AppendixI,figure34showstheconnectionsbetweenthetwostampswithflow
control.OneofthelimitationsofStampisthatwhenitissendingorreceivingdata,
itcannotexecuteotherinstructionandviceversa.TheStampdoesnothaveaserial
bufferwhichispresentinothercomputers.Also,evenwhenrunningatthehighest
serialbaudrates,thereisinsufficienttimefortheStamptoreceivedata,processit
andexecuteanotherreceivingdatacommandintimetocatchthenextstreamof
data,unlesstherearesignificantpausesbetweendatatransmissions.Fortunately,
flowcontrolcanbeusedtoovercomethisproblemwherebythereceivercantellthe
senderwhenitisreadytoreceivethenextstreamofdata.Also,stampcanonly
transmitasinglebyteatatime.Therefore,thesignalthatwillbesentwasscaled
downby10inordertostaywithinthesinglebytelimitofvaluesbetween0255.
12|P a g e
HardwareandSetup
Session2008/2009
3.7.Programmingalgorithm
Figure10:Flowchartofautonomouslandingsystem
Theflowchartabovesummarizestheprogrammingalgorithmfortheentire
autonomouslandingsystem.Atimeoutfunctionisprovidedtoaccountforcases
wherelagtimeexceeds0.8ms.Insuchcases,thisfunctionwillgenerateasimilar
pulsetrainastheonebefore.Thisistoensurethatthereisaregulargenerationof
pulsesignaltopreventlossoflink.
Anotherconditionthatisusedinthisalgorithmistocheckwhetherthecalculated
distanceislessthan20cm.Ifitistrue,thethrottlewhichcorrespondstolandingis
initiatedinsteadofthePIDcontrolleroutput.
13|P a g e
Experiment
Session2008/2009
4. Experimentsconducted
4.1.
OperationoftheFutabaRFtransmitter
Figure11:ExperimentalsetuptomeasurePWMsignal
Experiment1:MeasurementofPWMsignalfromradiotransmitter
ThesignalsgeneratedbythetransmitterarePulseWidthModulation(PWM)signals.
ThisexperimentinvolvesthemeasurementofthePWMsignalgeneratedbythe
FutabaRFtransmitter,atdifferentsticksettings.Theequipmentthatwasusedin
thisexperimentisshowninfigure11.UsingaprobetotapthesignalfromPin2at
thetrainerport,therespectivepulsewidthatdifferentstickpositionscanbe
measuredusingadigitaloscilloscope(TectronixTDS3012).
14|P a g e
Experiment
Session2008/2009
4.2.
ExperimentsonDraganflyer
Figure12:Experimentalsetuptomeasuregeneratedthrust
Experiment2:DeterminerelationshipbetweenThrottleandThrust
Asimpleexperimentwassetuptoestimatethegeneratedthrustatdifferent
throttlesettingasshowninfigure12.TheUAVwasattachedtoaweightandthe
platformwasplacedontoadigitalweighingscale.Theresultantthrustcanbe
measuredbytheweighingscaleatdifferentthrottlepositions.Twodifferentsetups
aredesignedtomeasurethethrustgeneratedattwodifferentaltitudes.Thisisdone
toestimatethethrustgeneratedIGEandOGE.Theassumptionisthattheattached
weightandweighingscaledonotinterferewiththethrustgeneratedbytherotors.
Experiment3:Testingandcalibrationofultrasonarsensor
TheParallaxPING)))ultrasonicsensorisusedtomeasurethealtitudeoftheUAV.It
ischosenprimarilybecauseofitsavailabilityinthelaboratoryaswellasthesuitable
rangeof2cmto3mwhichsatisfytherequirementofthisproject.Also,itisfully
15|P a g e
Experiment
Session2008/2009
compatiblewiththemicrocontrollerBasicStamp.Inthisexperiment,theultrasonic
sensoristestedandcalibratedwiththeactualdistance.
Experiment4:Determinesystemplantmodel
Theaimofthisexperimentistodeterminetheplantmodelofthesystem.Froma
hoveringaltitudeof100cm,thethrottlewassteppeddownandtheheightvariation
datawasloggeddownusingthesoftwareStampPlotPro.Fromtheserawdata,the
rateofdescent(R.D)canbedetermined.Themagnitudeofthestepswasvariedand
thecorrespondingR.Dwasanalysedtodeterminethesystemsplantmodel.
Experiment5:SimulationsusingMatlab,Simulink
Usingthederivedsystemplantmodel,thesystemwasmodelledusingMatlab,
Simulinkasshowninfigure13.
Figure13:SystemplantmodelledinSimulink
Simulationsarecarriedouttoexaminethetheoreticaloutputresponseofthe
systemgivenastepdowninput.ThegainsforthePIDcontrollerarevariedto
determinethesystemresponse.ThetwomethodsoftuningthePIDcontroller,the
ZieglerNicholsmethodandtheTrialanderrormethod,wassimulated.
16|P a g e
Experiment
Session2008/2009
Experiment6:Flighttest
Flight1:ScheduledProportionalcontrol
Twodifferentvaluesofproportionalgainsareuseddependingontheheightofthe
UAV.Forheightofabove45cm,againof2.0isusedandforheightbelowthat,a
gainof1.0isused.Thisistoensurethattherateofdescentisreducedasit
approachestheground.
Flight2:Throttlereductionby20%
ThehoveringthrottleoftheUAVwasreducedby20%andtherateofdescentofthe
UAVwasinvestigated.
Flight3:ProportionalDerivativecontrol
ItwasdeterminedthataPDcontrollerissufficientastheintegraltermwhichwill
compensateforsteadystateerrorisnotrequiredinthisautonomouslanding
system.Theappropriateproportionalandderivativegainsthatareobtainedfrom
thesimulationsusingSimulinkareusedinthisexperiment.Also,theactualsystem
responsecanbecomparedwiththesimulatedresponse.
Flight4:Hoveraboutsetpoint
UsingsimilarPDcontroller,UAVwascommandedtohoveratadesiredsetpoint.
17|P a g e
ResultsandDiscussions
Session2008/2009
5. ResultsandDiscussions
5.1.
Testingandcalibrationofultrasonicsensor
Figure14:(A)Ultrasonicsensorresults;(B)Percentageerrorbelow40cm
ItwasobservedthatnocalibrationoftheultrasonicsensorisrequirediftheStamp
usedtoreceivethesensordataisBS2pe.However,calibrationisrequiredifthe
StampusedisBS2px.Referringtofigure14A,themeasuredistance(Blue)isfound
tobedeviatedfromtheactualdistance(Green).Sincethedeviationislinear,a
correctionfactorof0.408wasdeterminedempirically.Thecorrecteddistanceis
depictedbytheredline.Itwasalsoobservedthatthepercentageerrorincreases
significantlywhenthesensorwasbelow40cm.Subsequently,anothercorrection
factorof0.440wasdeterminedthesamewayfordistancebelowtherangeof40cm.
Thedifferenceinpercentageerrorplotisshowninfigure14B.
18|P a g e
ResultsandDiscussions
Session2008/2009
5.2.
Determinerelationshipbetweenthrottleandthrust
Figure15:PlotofThrustVsThrottle
Figure15showstherelationshipbetweenthethrottlestickpositionandthe
resultantthrustproducedbythefourrotors.Withthisestimation,theapproximate
throttlepositionthatisrequiredtodescendtheUAVofvaryingweightscanbe
calculatedaccordingly.
5.3.
MeasurementofPWMsignalfromradiotransmitter
Figure16:PWMSignalsfromFutabatransmitter
19|P a g e
ResultsandDiscussions
Session2008/2009
Figure16showsthePWMpulsetrainthatwascapturedbytheoscilloscope.Itwas
observedthatthetimespanforasinglepulsetrainis20msregardlessofthestick
configurationsandthereareatotalofsevenchannels.Also,thepausewidth
betweendifferentpulsesis0.4ms.However,thesynchronizationpulsevariesfrom
8.11msto8.83ms,dependingonthedifferentstickcombination.Thisisamore
accuraterepresentationofthesynchronizationpulseascomparedtotheconstant
valueof9msthatwasproposedbyKarWei[14].Theactualsynchronizationpulse
canbecalculatedasfollows:
Figure17showsthesevenpulsesthatarepresentinasinglepulsetrain.Eachof
thesepulsescorrespondstoachannelandtherefore,thereareatotalof7channels.
Channel1controlsaileron,channel2controlselevator,channel3controlsthrottle,
channel4controlsrudder,channel5controlsthermalintelligenceandlastly
channels6and7controlsthelandinggearswitchandflapknobwhicharenotused
inthisUAV.Also,therangeofpulsewidthforthethrottlecontrolismeasuredtobe
from0.74msto1.4ms.
20|P a g e
ResultsandDiscussions
Session2008/2009
Figure17:Sevenchannelsfromsinglepulsetrain
5.4.
Relationshipbetweenhelicoptercontrolsandpulsewidth
Figure18:(a)PlotofThrottleVsPulsewidth;(b)PlotofThrustVsPulsewidth
Sincethisprojectinvolvesthemanipulationofthethrottlecontrol,thedifferent
throttlepositionswhichcorrespondtothepulsewidthofchannel3isexaminedin
detail.TheresultofPercentagethrottleagainstPulsewidthisshowninfigure18a.
Usinginformationfromsection5.2,theplotofThrustagainstPulsewidthis
obtainedandplottedinfigure18b.Fromthisresult,therequiredthrustcanbe
generatedwiththecorrectpulsewidth.
21|P a g e
ResultsandDiscussions
Session2008/2009
Therestofthepulsewidthsfromotherchannelsthatcorrespondstothe2extremes
ofthestickpositionareplottedinAppendixI,figure35.Forinstance,fullaileron
rightcorrespondstoaminimumpulsewidthof0.78msandfullaileronleft
correspondstoamaximumpulsewidthof1.42ms.
5.5.
Determinesystemplantmodel
Figure19:PlotsofRateofdescentVsPulsout
Thedescentratesatdifferentstepthrottledowninshowninfigure19ac.Atotalof
threetrialsareconductedandresultsareplottedinfigure19d.Thesystemsplant
modelcanbederivedfromthegradientofthelinewhichisabout1.7.
Therelevantequationstoderivetheplantmodelareshownbelow:
22|P a g e
ResultsandDiscussions
Session2008/2009
where
canberepresentedby and
representedby
Laplacetransform
SinceKis1.7,theplantmodelcanberepresentedbytheblockdiagrambelow.
Figure20:Systemsplantmodel
5.6.
SimulationsusingMatlab,Simulink
5.6.1. ZieglerNicholsmethod
Figure21:SimulationsusingZieglerNicholsmethod
ThesimulatedresultsusingtheZieglerNicholsmethodisshowninfigure21.Both
resultsshowshighovershootwithcomparativelylongsettlingtime.
5.6.2. ProportionalDerivativecontrol:TrialandErrormethod
23|P a g e
ResultsandDiscussions
Session2008/2009
ThesimulationresultsusingthePDcontrollerisshowninfigure22.Thesettlingtime
ismuchmoreacceptablecomparedtothepreviousmethod.Thus,thismethodwill
beusedintheactualflighttest.
Figure22:SimulationsusingPDcontrol
5.7.
Flighttest
5.7.1. Flight1:Scheduledproportionalcontrol
Figure23:Resultsusingscheduledproportionalcontrol
Figure23showstheactualflightresultsusingscheduledproportionalcontrol
methodasdescribedearlier.Theresultisgoodwithfastsettlingtimeofabout1.7s
andcontrolledsmoothlanding.
24|P a g e
ResultsandDiscussions
Session2008/2009
5.7.2. Flight2:Throttlereductionof20%
Figure24:Resultsusingthrottlereductionmethod
Thelandingusingthrottlereductionof20%showssimilarlysmoothdescent.
However,theUAVhoverstoapointofabout20cmwhereitencountersground
effect.Asaresult,manualcontrolisrequiredtoforceittoland.
5.7.3. Flight3:ProportionalDerivativecontrol
Figure25:ResultsusingPDcontrol:(a)Kp:1.0/Kd:1.0;(b)Kp:3.0/Kd:1.0
ThesamegroundeffectisencounteredusingthePDcontrollerwithproportional
gainof1.0asshowninfigure25a.Forthiscase,theUAVhoveredtoaheightof
about40cmandrefusestodescendanyfurther.Thiscanbeovercomebyincreasing
25|P a g e
ResultsandDiscussions
Session2008/2009
theproportionalgainto3.0infigure25bwherethelandingissmoothwithquick
settlingtimeofabout1.3s.
5.7.4. Flight4:Hovertosetpoint
Figure26:HoveringtosetpointusingPDcontrol
UsingthesamePDcontrollerwithproportionalgainof3.0andderivativegainof1.0,
theUAViscommandedtoadesiredheightasshowninfigure26.Thecommandwas
initiatedataheightof35cmanditrisesquicklytothedesiredaltitudeafter1
oscillation.
Thetransientperformanceiscalculatedasfollows:
Risetime:
Peaktime:
(From0%to100%)
26|P a g e
ResultsandDiscussions
Session2008/2009
Settlingtime:
(Timetoreachandstaywithin5%limit)
Maximum%overshoot:
Thissystemcanbefurthertunedtoreduceovershootbyloweringtheproportional
gainandreducingthesteadystateerrorbyincludinganintegraltermintothe
controller.However,thesteadystateerrorisreasonableasitiswithinthe5%limit.
5.8.
Analysiswithsimulatedplot
5.8.1. Comparingsimulationandactualplot
Figure27:Comparisonbetweensimulatedandactualplot
Thesimulatedandactuallandingprofileisplottedforcomparisoninfigure27.The
redlineshowsthesimulatedplotusingMatlabandtherestoftheplotscorrespond
totheactualtestflightdata.Itcanbeconcludedthattheactualplotsfitthe
simulatedplotreasonablywell.
5.8.2. Rootlocusanalysis
Referringtofigure13,thetransferfunctionofthesystemisderivedas:
27|P a g e
ResultsandDiscussions
Session2008/2009
Assumingunityfeedback:
ProportionalDerivativeControl:
OpenLooptransferfunction:
ClosedLooptransferfunction:
TakingKp=3,Kd=1,K=1.7,
ClosedLooptransferfunction:
Theopenlooptransferfunctioncanalsobewrittenintheform:
wherezandparethezeroandpoleoftheopenlooptransferfunction.Asthegain
changes,thevaluesofthecloselooppoleswillchangeandthusthetransient
responseandstability.Therootlocusplotisaplotofthelociofthecloselooppoles
onthesplaneasthegainKvariesfrom0toinfinity.
Figure28:Rootlocusplot
28|P a g e
ResultsandDiscussions
Session2008/2009
ArootlocusisplottedusingMatlabasshowninfigure28.Theplotshowsastable
systemasalltheclosedlooppolesarelocatedonthelefthalfofthesplane.
29|P a g e
Conclusion
Session2008/2009
6. Conclusions
ThisthesishaspresentedacompletesystemtocontroltheheightofaUAVusing
feedbackcontrolfromanultrasonicsensor.Themethodofcommunicationbetween
thedifferentmicrocontrollersandtransmitterwerediscussedaswellassomeofthe
problemsthatareassociatedwiththecommunications.Differentmethodsoftuning
thePIDcontrolsystemwereexploredwiththeaidofsimulationsusingMatlab,
Simulink.Finally,actualtestflightsarecarriedouttovalidatetheautonomous
landingsystem.Alltheobjectivesofthisprojectwerewellmet.
30|P a g e
Recommendation
Session2008/2009
7. RecommendationsforFurtherWork
7.1.
IntegratingcontrollerforRoll,PitchandYaw
Inthisproject,aheightsensorisusedtoprovidefeedbackforthePIDcontrollerfor
altitudecontrol.However,thiscanbefurtherextendedtotheroll,pitchandyaw
motion.Inordertodoso,additionalsensorsarerequiredtoprovidefeedback
informationabouttheUAVsorientationorangularvelocity.Tiltsensorsorrategyro
canbeusedinsuchcasestoprovidecompensationfortheroll,pitchandyaw
motion.InthethesisbyKarWei[14],hehadsuccessfullyusedatiltsensorto
compensatefortherollandpitchmoment.
Anotheralternativemethodistoextracttherawdatadirectlyfromthethreepiezo
electricgyrothatarealreadypresentonthecircuitboardDraganflyerVTi.However,
thiswouldrequireknowledgeaboutthecircuitboardtopreventdamageonanyof
thecomponentsonit.
7.2.
Camerasystemtolocatelandingzone
AcamerasystemcanbeintegratedintotheUAVtolocatethelandingzonefrom
anotherposition.InthethesisbyZhikang[17],hehadusedcolorsegmentationto
segmentacoloredlandingzoneandapanandtiltcameratotrackontothetarget.
Finally,thepositionoftheUAVwascorrectedtothelandingzoneandsubsequently
landed.InordertocommunicatebetweenacomputerandaRFtransmitter,an
interfacePCTxbyEndurancewasused.
31|P a g e
References
References
[1] HaniphLatchman(2003,January17).BriefhistoryofUAVS.RetrievedMarch10,
2009,fromhttp://aln.list.ufl.edu/uav/UAVHstry.htm
[2] ReinHardtJ.R.,JamesJ.E.&FlanaganE.M.(1999).FutureEmploymentofUAVs,
JointForceQuarterly.RetrievedMarch10,2009,from
http://www.dtic.mil/doctrine/jel/jfq_pubs/0822b.pdf
[3] JoshuaHintze(2004,April).Autonomouslandingofarotaryunmannedaerial
vehicleinanoncooperativeenvironmentusingmachinevision.BrighamYoung
University,DepartmentofElectricalandComputerEngineering
[4] TeinHau,Tan(2008,May).AutopilotUnmannedAerialVehicle.National
UniversityofSingapore,DepartmentofMechanicalEngineering
[5] J.Gordon(2006).PrinciplesofHelicopterAerodynamics.CambridgeUniversity
Press.
[6] A.R.S.Bramwell,G.Done&D.Balmford(2000).BramwellsHelicopterDynamics.
ElsevierLtd.
[7] TomasB.Co(2004,February13).ZieglerNicholsMethod.Michigan
TechnologicalUniversity.RetrievedMarch11,2009,from
http://www.chem.mtu.edu/~tbco/cm416/zn.html
[8] J.L.Naudin(2007,February25).TheGFSUAVproject,ACoandereffectflying
saucer.RetrievedMarch11,2009,fromhttp://jlnlabs.online.fr/gfsuav/index.htm
[9] ChrisSmith(2009).TheAerodynamicsofaPingpongball.RetrievedMarch11,
2009,from
http://www.thenakedscientists.com/HTML/content/kitchenscience/exp/the
aerodynamicsofapingpongball/
32|P a g e
References
[10]
W.KlausandI.S.Martin(1999,May20).MisinterpretationsofBernoulli's
Law.UniversityFrankfurt,DepartmentofPhysics.RetrievedMarch11,2009,
fromhttp://user.unifrankfurt.de/~weltner/
[11]
WaiWeng,Kong&M.S.b.Zainal(2006).DesignandControlofaQuadRotor
FlyingRobotforAerialSurveillance.UniversitiTeknologiMalaysia,Centerfor
ArtificialIntelligenceandRobotic.
[12]
J.Martin,J.Williams,K.Gracey,A.Alvarez&S.Lindsay(2005,February).
BASICStampSyntaxandReferenceManualVersion2.2.RetrievedMarch11,
2009,fromwww.parallax.com
[13]
M.Azfar(2007).AerodynamicsandPropulsionofanIndoorUAV.National
UniversityofSingapore,DepartmentofMechanicalEngineering
[14]
KarWei,Chin(2007).FlightDynamicsandControlforanIndoorUAV.
NationalUniversityofSingapore,DepartmentofMechanicalEngineering
[15]
MartinHebel(2009).PrimertoUsingStampPlotPro,SelmaWareSolutions.
RetrievedMarch11,2009,from
http://www.selmaware.com/stampplot/index.htm
[16]
NickSacco(2002).HowtheDraganflyerFlies.RotoryMagazine.Retrieved
March11,2009,from
http://www.rctoys.com/pdf/draganflyer3_rotorymagazine.pdf
[17]
Zhikang,Lin(2008).Camerabasedvisionsystemforunmannedairvehicles
(UAVs)operations.NationalUniversityofSingapore,DepartmentofMechanical
Engineering
33|P a g e
AppendixI
AppendixI. FiguresandTables
Figure29:ModelofCoandereffectUAVusingSolidworks
Figure30:TestbedmodelinSolidworks
34|P a g e
AppendixI
Figure31:PinOutdiagramofRFtransmitter,FutabaSkysport6T6YG
Figure32:Modifiedwiringintotrainerport
Figure33:Futabatransmittercontrolsdiagram
35|P a g e
AppendixI
Figure34:Serialcommunicationwithflowcontrol
Figure35:DescriptionofPulsewidthVsChannel
36|P a g e
AppendixII
AppendixII. Fourworkingstatesofarotorinaxialflight
Figure36:FlowvisualizationatvariousdescentvelocitiesusingShadowgraphy
Figure36showsthefourworkingstatesofrotorinaxialflightandthedescriptions
ofeachstatearesummarizedbelow:
a)
NormalWorkingstate:
Thetipvorticesfollowsmoothhelicoidaltrajectories.Theflowishighlyperiodicwith
asmoothslipstreamboundaryfreeofanysignificantdisturbances.Thisstate
encompassesclimb,withthelimitbeingthehoveringstate.
b)
VortexRingstate:
Forlowrateofdescent,thetipvortexfilamentsareconvectedclosertotheplaneof
therotorbutalsomoveradiallyoutwardawayfromit.Athigherdescentrates,the
tipvorticescomeveryclosetotherotorplaneandconsiderableunsteadiness
becomesapparent.Thiscanbeseenbythecontortionsinthetipvortextrajectories
37|P a g e
AppendixII
andthelackofdistinctslipstreamboundary.Thisisclosetotheflowcondition
knownasthevortexringstate(VRS),wheretheaccumulationoftipvorticesinthe
rotorplaneresemblesconcentricsetsofvortexring.
c)
Turbulentwakestate:
Asthedescentrateincreasesfurther,thewakeabovetherotorbecomesturbulent
andaperiodic.Thisstaterepresentstheinitialreturntoasmoothflowwithawell
definedslipstreamboundary.Theflowissimilartothatassociatedwithabuffbody.
d)
Windmillbrakestate:
Atevenhigherdescentvelocities,amoredefiniteslipstreamboundarythatexpands
downstream(above)oftherotorisobservedonceagain.Inthisstate,thevortical
wakestructurereturnstoamoreregularhelicalstructure.Thisflowconditionis
knownasthewindmillbrakestatebecausetherotorextractsenergyfromtheflow
andbraketheflowvelocitylikeawindmill.
38|P a g e
AppendixIII
AppendixIII. Coandereffect
Thephenomenonwhichcausesflownearlimitingsurfacetofollowthegeometrical
shapeofthesesurfacesisknownastheCoandereffect.Itonlyoccurswhentheflow
isnotforcedtochangeitsdirectiontooabruptlyinordertopreventtheformation
ofturbulenceandseparation.Theclassicexampleisaflowacrossaflatplanewith
anadjacenthalfcylinderasshowninfigure37below.
Figure37:Flowacrossalimitingsurface
In37a,theflowinitiallyfollowsthesurfaceofthecylinderwhicheventually
separatesatsomepointonthecurvedsurface.Anothersimpleexampleis
demonstratedin5c,whenwaterisdrippeddownthebackofaspoon,itwilltendto
sticktothesurfaceandgetdeflected.Thisimportantbehaviourholdsforallflows
limitedbysmoothlycurvedsurfaceslikeaerofoils,streamlinedobstaclesandsails.
TheCoandereffectcanbeexplainedbyconsideringtheeffectsofviscosityofafluid.
In37b,duetoviscosity,somelayersoftheadjacentairattheendoftheflatsurface,
depictedbydots,arecarriedawaybythemainstreamflow.Asaresult,aregionof
lowpressureisformedwhichgiverisetoanetforcewhichwillpulltheflowtowards
thecurvedsurface.
39|P a g e
AppendixIV
AppendixIV. ZieglerNicholstuningmethod
Table1:ZieglerNicholstuningchart
whereKcistheproportionalgain
Iistheparameterthatscalestheintegralcontroller
Distheparameterthatscalesthederivativecontroller
KUistheultimategain
Kp,KiandKdaretheproportional,integralandderivativegains
ThetuningchartfollowsthePIDequation:
Inordertodeterminetheparameters,thefollowingstepsarecarriedout:
1. Setthecontrollertoproportionalcontrolonly.
2. StepincrementthecontrollergainKcandwaitforasteadystateoutputbefore
increasingbyanothersubsequentstep.
3. ThecriticalorultimategainKu,isthevalueofKcthatwillresultsinasustained
periodicoscillationintheoutput.
4. TheperiodofthisoscillationisknownastheultimateperiodPu.
5. TherespectiveKc,IandDcanbedeterminedfromtheultimategainand
ultimateperiodaccordingtothechartabove.
40|P a g e
AppendixV
AppendixV. CoanderEffectflyingsaucerexperiment
ModificationstoUAV
Figure38:ModificationtoPlatform
SomemodificationswerecarriedouttoimprovetheUAVaftertheinitialmotortest.
1. Themotoraswellasthepropellerarerealignedtoensurethatitwasinthe
horizontalplane.Thisisimportantasslightmisalignmentwillcausethepropeller
tooscillateandvibrateexceedinglywhenthemotorrotates.Thiswasdoneusing
acircularairbubble.
2. Thespacingbetweenthepetalandtheductwasreducedtoincreaseairflow.
3. Theairductwasdoublelayered.Thiswasdonetoimproveonitsrigidityto
maintainitscylindricalstructureduringflight.Astheinnerdiameteroftheduct
wasalsoreducedtoimproveontheairspeed,anyslightdeformationoftheduct
willcausethepropellertocollidewiththeduct.Lastly,theentranceandexitof
theductwaschamferedtoimproveairflow.
41|P a g e
AppendixV
J.L.NaudinExperiment
Experimentalsetup
AthrustexperimentdesignedbyJeanLouisNaudinwaspublishedonhiswebsite.
Figure39:J.Naudinsexperimentalsetup
Inhisexperiment,heusedablowertoblowacrossonepetaltosimulateairthat
movesthroughtheairductoverthesurfacesofthepetals.Aweightwasattachedto
theotheredgeofthepetalandwasplacedontoaweighingscale.Ananemometer
wasusedtomeasuretheairspeedatthedifferentlocationsofthepetal.
Results
Theresultthatwasobtainedfromhisexperimentisplottedinthegraphbelow:
Figure40:Naudinsresult
42|P a g e
AppendixV
Fromthisplot,itcanbededucedthataminimumairspeedof21m/sisrequiredat
theoutletoftheductedfaninordertogenerate533gofthrust,whichwasthe
overallweightofhisplatform.Inotherwords,thetakeoffthrustrequiredis533g.
Experimentconducted:Airspeedmeasurement
ExperimentalsetupandResults
Figure41:Experimentalsetupforairspeedmeasurement
Asimpleexperimentwasconductedtoverifytheairspeedatthedifferentpositions
ofthepetal,inordertodeducethethrustthatwouldbegeneratedaccordingto
Naudinsresult.
Figure42:Variablesofexperiment
43|P a g e
AppendixV
Theairspeedsatthethreelocations,using2differenttypesofpropeller,are
measuredandtheresultistabulatedbelow:
Table2:Airspeedtestresults
Predictedthrustiscalculatedusingequationthatwasderivedinhisexperiment:
Conclusion
Itwasobservedthatthe2bladepropellerwasabletoproducemorethrustthanthe
3bladepropeller.Themaximumthrustthatcouldbeproducedbyalltheeight
petalswasevaluatedtobeonly143.8g.Thiswasbarelysufficienttoliftoffthe
platformwhichhasanoverallweightof570g,withoutincludingothercomponents
suchasservosandsensors.Thus,theusageofthisplatformforthisprojectwas
ruledout.
44|P a g e
AppendixVI
AppendixVI. Autonomouslandingprogram(Basic)
Processor
Scheduledproportionalcontrol
'~~~~~~~~SENDER/PROCESSOR~~~~~~~~~~~~~~~~
'{$STAMPBS2pe}
'{$PBASIC2.5}
'{$PORTCOM8}
'~~~~~~~~~~~~~~~~~~SetPin~~~~~~~~~~~~~~~~~~
SOPIN1
'SerialOutPin
FCPIN0
'FlowcontrolPin
'~~~~~~~~~~~BaudrateSelect~~~~~~~~~~~~~~~~
#SELECT$STAMP
#CASEBS2PE
T4800CON16572
T9600CON16468
#CASEBS2PX
T4800CON17197
T9600CON16780
#ENDSELECT
BaudCONT9600
'~~~~~~~~~~~~~ThrottleConfig~~~~~~~~~~~~~~~
'tMinCON1600
'tMaxCON1800
tLandCON1400
tHoverCON1630
throttleVARWord
throtsendVARByte
'~~~~~~~~~~~~~~PIDVariables~~~~~~~~~~~~~~~~
setpointCON5
errorVARWord
pVARWord'Proportionalterm
'~~~~~~~~~~~~~~~~~PING)))Variables~~~~~~~~~~~~~~
cmConstantCON2260
cmDistanceVARWord
timeVARWord
PAUSE500
'ForPlotting
DEBUG"!SPAN0,200",CR'Altitudeaxis
DEBUG"!TMAX180",CR'Timeaxis
45|P a g e
AppendixVI
DEBUG"!PNTS4000",CR 'Datapointsperplot
DEBUG"!TITLAltituteLog",CR 'Titletheform
DEBUG"!SHFTON",CR'Plotshiftatmax
DEBUG"!TSMPOFF",CR
DEBUG"!SAVDON",CR
DEBUG"!SAVMON",CR
DEBUG"!NAMDPlotData.txt",CR
DEBUG"!NAMMPlotMsg.txt",CR
DEBUG"!PLOTON",CR'Enableplotting
DEBUG"!RSET",CR'ResetPlot
DO
PULSOUT15,5
'ToutfromPING)))
PULSIN15,1,time
'TintoPING)))>Timevariable
cmDistance=cmConstant**time 'DistancefromPING)))
DEBUGDECcmDistance,CR
'ForPlotting
error=setPointcmDistance
IFcmDistance>45THEN
'AugmentProportionalGains
p=2*error
ELSEIFcmDistance<45THEN
p=error
ENDIF
throttle=p+tHover
IFcmDistance<20THEN
throttle=tLand
ENDIF
throtsend=throttle/10
SEROUTSO\FC,Baud,[throtsend]
LOOP
46|P a g e
AppendixVI
ProportionalDerivativecontrol
'~~~~~~~~~~~~SENDER/PROCESSOR~~~~~~~~~~
'{$STAMPBS2pe}
'{$PBASIC2.5}
'{$PORTCOM8}
'~~~~~~~~~~~~~~~~~~SetPin~~~~~~~~~~~~~~~
SOPIN1'SerialOutPin
FCPIN0
'FlowcontrolPin
'~~~~~~~~~~~BaudrateSelect~~~~~~~~~~~~~~~~
#SELECT$STAMP
#CASEBS2PE
T4800CON16572
T9600CON16468
#CASEBS2PX
T4800CON17197
T9600CON16780
#ENDSELECT
BaudCONT9600
'~~~~~~~~~~~~~ThrottleConfig~~~~~~~~~~~~~~~
tLandCON1400
tHoverCON1730
throttleVARWord
throtsendVARByte
'~~~~~~~~~~~~~~PIDVariables~~~~~~~~~~~~~~~~
setpointCON5
'Setpoint
currentCON0 'Currenterror
previousCON1
'Previouserror
deltaCON2 'Changeinerror
errorVARWord(3)
'Errorarray
pVARWord'Proportionalterm
dVARWord'Derivativeterm
'~~~~~~~~~PING)))Variables~~~~~~~~~~~~~~~~~~
cmConstantCON2260
cmDistanceVARWord
timeVARWord
PAUSE500
DEBUG"!SPAN0,200",CR'Setforaltitudeaxis
DEBUG"!TMAX180",CR'Setfortimeaxis
47|P a g e
AppendixVI
DEBUG"!PNTS4000",CR'4000datapointsperplot
DEBUG"!TITLAltituteLog",CR'Titletheform
DEBUG"!SHFTON",CR'Allowplottoshiftatmax
DEBUG"!TSMPOFF",CR
DEBUG"!SAVDON",CR
DEBUG"!SAVMON",CR
DEBUG"!NAMDPlotData.txt",CR
DEBUG"!NAMMPlotMsg.txt",CR
DEBUG"!PLOTON",CR'Enableplotting
DEBUG"!RSET",CR'ResetPlot
DO
'ToutfromPING)))
PULSOUT15,5
PULSIN15,1,time 'TintoPING)))>Timevariable
cmDistance=cmConstant**time'DistancefromPING)))
DEBUGDECcmDistance,CR
error(current)=setPointcmDistance'Calculateerror
p=3*error(current)'ProportionalGain=3
error(delta)=error(current)error(previous)
d=error(delta)'DerivativeGain=1
throttle=p+tHover+dMIN1500MAX1800
IFcmDistance<20THEN
throttle=1420
ENDIF
throtsend=throttle/10
SEROUTSO\FC,Baud,[throtsend]
error(Previous)=error(Current)
LOOP
48|P a g e
AppendixVI
Signalgenerator
'~~~~~~~~~RECEIVER/SIGNALGENERATION~~~~~~
'{$STAMPBS2px}
'{$PBASIC2.5}
'{$PORTCOM5}
'~~~~~~~~~~~~~~~~~~SetPin~~~~~~~~~~~~~~~~~~
SIPIN0'SerialInPin
FCPIN1'FlowcontrolPin
PPPIN5'PausePin
TPPIN13'TrainerPin
'~~~~~~~~~~StampBaudrateSelect~~~~~~~~~~~
#SELECT$STAMP
#CASEBS2PE
T4800CON16572
T9600CON16468
#CASEBS2PX
T4800CON17197
T9600CON16780
#ENDSELECT
BaudCONT9600
'~~~~~~~~~~~~~~CALIBRATIONDATA~~~~~~~~~~~~~
ch1CON1115'AileronStick:(1775)LeftMid(1375)Right(975)
ch2CON1380'Elevator:(1725)UpMid(1400)Down(1025)
ch4CON1400'Rudder
ch5CON2100'Thermal
ch6CON1400
ch7CON1400
syncCON10305'Synchropulse
delayCON375'Pausepulse
lastdelayCON260
'~~~~~~~~VariablesfromSerialINPUT~~~~~~~~~~~~~
throttleVARByte
prevthrottleVARWord
throtgenVARWord
DO
SERINSI\FC,Baud,2,timeout,[throttle]'timeout:2units=0.8ms
throtgen=throttle*10
PULSOUTTP,ch1
PULSOUTPP,delay
PULSOUTTP,ch2
49|P a g e
AppendixVI
PULSOUTPP,delay
PULSOUTTP,throtgen
PULSOUTPP,delay
PULSOUTTP,ch4
PULSOUTPP,delay
PULSOUTTP,ch5
PULSOUTPP,delay
PULSOUTTP,ch6
PULSOUTPP,delay
PULSOUTTP,ch7
PULSOUTPP,delay
PULSOUTTP,sync
prevthrottle=throtgen'Storeslastsignal
LOOP
timeout:'Generatelastsignal
throtgen=prevthrottle
PULSOUTTP,ch1
PULSOUTPP,delay
PULSOUTTP,ch2
PULSOUTPP,delay
PULSOUTTP,throtgen
PULSOUTPP,delay
PULSOUTTP,ch4
PULSOUTPP,delay
PULSOUTTP,ch5
PULSOUTPP,delay
PULSOUTTP,ch6
PULSOUTPP,delay
PULSOUTTP,ch7
PULSOUTPP,delay
PULSOUTTP,sync
RETURN
50|P a g e