Anda di halaman 1dari 73

BasicConceptsinControl

393R:AutonomousRobots
PeterStone
Slides Courtesy of
Benjamin Kuipers

GoodAfternoonColleagues

Arethereanyquestions?

Logistics
Readingresponses
NextweeksreadingsdueMondaynight
Braitenbergvehicles
Forward/inversekinematics
Aibojointmodeling

Nextclass:labintro(starthere)

ControllingaSimpleSystem
Considerasimplesystem:

=F(x,u)
x

Scalarvariablesxandu,notvectorsxandu.
Assumexisobservable:y=G(x)=x
F
Assumeeffectofmotorcommandu:
>0
u

Thesetpointxsetisthedesiredvalue.
Thecontrollerrespondstoerror:e=xxset

Thegoalistosetutoreache=0.

Theintuitionbehindcontrol
Useactionutopushbacktowarderrore=0
erroredependsonstatex(viasensorsy)

Whatdoespushingbackdo?
Dependsonthestructureofthesystem
Velocityversusaccelerationcontrol

Howmuchshouldwepushback?
Whatdoesthemagnitudeofudependon?

Caronaslopeexample

Velocityoraccelerationcontrol?
Iferrorreflectsx,doesuaffectxorx?
Velocitycontrol:ux(valvefillstank)
letx=(x)

=(x) =F (x,u) =(u)


x

Accelerationcontrol:ux(rocket)
letx=(xv)T

x
v

= =F (x,u) =
x
v
u
=x
=u
v

TheBangBangController
Pushback,againstthedirectionoftheerror
withconstantactionu

Errorise=xxset
e<0
e>0

u:=on x =F (x,on) >0


u:=of x
=F (x,of) <0

Topreventchatterarounde=0,
e<
e>+

u:=on
u:=of

Householdthermostat.Notverysubtle.

BangBangControlinAction

Optimalforreachingthesetpoint
Notverygoodforstayingnearit

Hysteresis
Doesathermostatworkexactlythatway?
Cardemonstration

Whynot?
Howcanyoupreventsuchfrequentmotor
action?
Aiboturningtoballexample

ProportionalControl
Pushback,proportionaltotheerror.

u=ke+ub

=F(xset,ub ) =0
setubsothat x

Foralinearsystem,wegetexponential
convergence.
t

x(t) =Ce

+xset

Thecontrollergainkdetermineshow
quicklythesystemrespondstoerror.

VelocityControl
Youwanttodriveyourcaratvelocityvset.
Youissuethemotorcommandu=posaccel
Youobservevelocityvobs.
Defineafirstordercontroller:

u = k (v obs v set ) + ub

kisthecontrollergain.

ProportionalControlinAction

Increasinggainapproachessetpointfaster
Canleadstoovershoot,andeveninstability

Steadystateoffset

SteadyStateOffset
Supposewehavecontinuingdisturbances:

=F(x,u) +d
x

ThePcontrollercannotstabilizeate=0.
Whynot?

SteadyStateOffset
Supposewehavecontinuingdisturbances:

=F(x,u) +d
x

ThePcontrollercannotstabilizeate=0.
ifubisdefinedsoF(xset,ub)=0
thenF(xset,ub)+d0,sothesystemchanges

Mustadaptubtodifferentdisturbancesd.

AdaptiveControl
Sometimesonecontrollerisntenough.
Weneedcontrollersatdifferenttimescales.

u = k P e + ub
b = k I e where
u

k I << kP

Thiscaneliminatesteadystateoffset.
Why?

AdaptiveControl
Sometimesonecontrollerisntenough.
Weneedcontrollersatdifferenttimescales.

u = k P e + ub
b = k I e where
u

k I << kP

Thiscaneliminatesteadystateoffset.
Becausetheslowercontrolleradaptsub.

IntegralControl
b = k I e
Theadaptivecontrollermeans
u
t

ub (t) =kI
Therefore

edt+u

u(t) = kP e(t) k I

e dt + u
0

TheProportionalIntegral(PI)Controller.

NonlinearPcontrol
Generalizeproportionalcontrolto
+
u=f (e) +ub where f M0
Nonlinearcontrollawshaveadvantages

fhasverticalasymptote:boundederrore
fhashorizontalasymptote:boundedeffortu
Possibletoconvergeinfinitetime.
Nonlinearityallowsmorekindsofcomposition.

StoppingController
Desiredstoppingpoint:x=0.
Currentposition:x
Distancetoobstacle:

SimplePcontroller:

d =|x|+

=f (x)
v =x

Finitestoppingtimefor f(x) =k |x |sgn(x)

DerivativeControl
Dampingfrictionisaforceopposing
motion,proportionaltovelocity.
Trytopreventovershootbydamping
controllerresponse.

u=kP ekD e

Estimatingaderivativefrommeasurements
isfragile,andamplifiesnoise.

DerivativeControlinAction

Dampingfightsoscillationandovershoot
Butitsvulnerabletonoise

EffectofDerivativeControl

Differentamountsofdamping(withoutnoise)

DerivativesAmplifyNoise

Thisisaproblemifcontroloutput(CO)
dependsonslope(withahighgain).

ThePIDController
AweightedcombinationofProportional,
Integral,andDerivativeterms.
t

u(t) =kP e(t) kI

edtk e(t)
D

ThePIDcontrolleristheworkhorseofthe
controlindustry.Tuningisnontrivial.
Nextlectureincludessometuningmethods.

PIDControlinAction

But,goodbehaviordependsongoodtuning!
AibojointsusePIDcontrol

ExploringPIControlTuning

Habituation
Integralcontroladaptsthebiastermub.
Habituationadaptsthesetpointxset.
Itpreventssituationswheretoomuchcontrol
actionwouldbedangerous.

Bothadaptationsreducesteadystateerror.

u=kP e+ub
set =+khe where kh <<kP
x

TypesofControllers
Openloopcontrol
Nosensing

Feedbackcontrol(closedloop)

Senseerror,determinecontrolresponse.

Feedforwardcontrol(closedloop)

Sensedisturbance,predictresultingerror,respondto
predictederrorbeforeithappens.

Modelpredictivecontrol(closedloop)
Plantrajectorytoreachgoal.
Takefirststep.
Repeat.

Designopenandclosedloop
controllersformetogetout
oftheroom.

DynamicalSystems
Adynamicalsystemchangescontinuously
(almostalways)accordingto

=F(x) where x
x

Acontrollerisdefinedtochangethe
coupledrobotandenvironmentintoa
desireddynamicalsystem.

F(x,u)
x=
y = G(x)

u = H i (y)

F(x,H i (G(x)))
x=
(x)
x=

Twoviewsofdynamicbehavior
Time
plot
(t,x)

Phase
portrait
(x,v)

PhasePortrait:(x,v)space
Showsthetrajectory(x(t),v(t))ofthesystem
Stableattractorhere

InOneDimension

Simplelinearsystem

=kx
x

Fixedpoint
Solution

=0
x

x =0
kt

x(t) =x0 e

Stableifk<0
Unstableifk>0

InTwoDimensions
Often,wehavepositionandvelocity:
T

x =(x,v) where v=x


Ifwemodelactionsasforces,whichcause
acceleration,thenweget:

x
x
v
= = =

x
v x forces

TheDampedSpring
ThespringisdefinedbyHookesLaw:

F ma m&
x& k1 x

Includedampingfriction

m&
x& k1x k 2x&

Rearrangeandredefineconstants

&
& & 0

x
x
v
=

x

= =

v x bx cx

Node
Behavior

Focus
Behavior

Saddle
Behavior

Spiral
Behavior
(stable
attractor)

Center
Behavior
(undamped
oscillator)

TheWallFollower

(x,y)

TheWallFollower
Ourrobotmodel:
x
vcos

=y
=F (x,u) =vsin
x

u=(v)Ty=(y)T0.
Wesetthecontrollawu=(v)T=Hi(y)

TheWallFollower
Assumeconstantforwardvelocityv=v0
approximatelyparalleltothewall:0.

Desireddistancefromwalldefineserror:

and e
=y

e=yyset so e=y

Wesetthecontrollawu=(v)T=Hi(y)
Wewantetoactlikeadampedspring

e+k1 e
+k2 e=0

TheWallFollower
Wewantadampedspring:
Forsmallvaluesof

+k2 e=0
e+k1 e

= y
= vsin
e
v
e = y = vcos v

Substitute,andassumev=v0isconstant.

v 0 + k1 v 0 + k 2 e = 0

Solvefor

TheWallFollower
+k2 e=0
Togetthedampedspring
e+k1 e
Wegettheconstraint
v 0 + k1 v 0 + k 2 e = 0

Solvefor.Plugintou.

v 0

v
k 2 = H i (e,)
u = =
1 e

k
v 0

ThismakesthewallfolloweraPDcontroller.
Because:

TuningtheWallFollower
+k2 e=0
Thesystemis
e+k1 e
2
Criticaldampingrequires k1 4k2 =0
k1 = 4k2
Slightlyunderdampedperformsbetter.
Setk2byexperience.
Setk1abitlessthan

4k2

AnObserverforDistancetoWall
Shortsonarreturnsarereliable.
Theyarelikelytobeperpendicularreflections.

Alternatives
ThewallfollowerisaPDcontrollaw.
AtargetseekershouldprobablybeaPI
controllaw,toadapttomotion.
Cantrydifferenttuningvaluesfor
parameters.
Thisisasimplemodel.
Unmodeledeffectsmightbesignificant.

ZieglerNicholsTuning
Openloopresponsetoaunitstepincrease.
disdeadtime.Tistheprocesstimeconstant.
Kistheprocessgain.

TuningthePIDController
Wehavedescribeditas:
t

u(t) =kP e(t) kI

edtk e(t)
D

Anotherstandardformis:
t

(t)
u(t) = P e(t)
+ TI e dt + TD e

0
ZieglerNicholssays:
1.5 T
P=
K d

TI = 2.5 d

TD = 0.4 d

ZieglerNicholsClosedLoop
1. DisableDandIaction(purePcontrol).
2. Makeastepchangetothesetpoint.
3. Repeat,adjustingcontrollergainuntil
achievingastableoscillation.

ThisgainistheultimategainKu.

TheperiodistheultimateperiodPu.

ClosedLoopZNPIDTuning
AstandardformofPIDis:

u(t) = P e(t)
+ TI

ForaPIcontroller:
P = 0.45 K u

ForaPIDcontroller:

P = 0.6 K u

e dt + TDe(t)
0
t

Pu
TI =
1.2
Pu
TI =
2

Pu
TD =
8

SummaryofConcepts
Dynamicalsystemsandphaseportraits
Qualitativetypesofbehavior
Stablevsunstable;nodalvssaddlevsspiral
Boundaryvaluesofparameters

Designingthewallfollowingcontrollaw
TuningthePI,PD,orPIDcontroller
ZieglerNicholstuningrules
Formore,Google:controllertuning

Followers
Afollowerisacontrollawwheretherobot
movesforwardwhilekeepingsomeerror
termsmall.

Openspacefollower
Wallfollower
Coastalnavigator
Colorfollower

ControlLawsHaveConditions
Eachcontrollawincludes:
Atrigger:Isthislawapplicable?
Thelawitself:u=Hi(y)
Aterminationcondition:Shouldthelawstop?

OpenSpaceFollower
Moveinthedirectionoflargeamountsofopen
space.
Wiggleasneededtoavoidspecular
reflections.
Turnawayfromobstacles.
Turnorbackoutofblindalleys.

WallFollower

Detectandfollowrightorleftwall.
PDcontrollaw.
Tunetoavoidlargeoscillations.
Terminateonobstacleorwallvanishing.

CoastalNavigator
Joinwallfollowerstofollowacomplex
coastline
Whenawallfollowerterminates,makethe
appropriateturn,detectanewwall,and
continue.
Insideandoutsidecorners,90and180deg.
Orbitabox,asimpleroom,orthedesks.

ColorFollower
Movetokeepadesiredcolorcenteredin
thecameraimage.
Trainacolorregionfromagivenimage.
Followanorangeballonastring,ora
brightlycoloredTshirt.

ProblemsandSolutions

Timedelay
Staticfriction
Pulsewidthmodulation
Integratorwindup
Chattering
Saturation,deadzones,backlash
Parameterdrift

UnmodeledEffects
Everycontrollerdependsonitssimplified
modeloftheworld.
Everymodelomitsalmosteverything.

Ifunmodeledeffectsbecomesignificant,
thecontrollersmodeliswrong,
soitsactionscouldbeseriouslywrong.

Mostcontrollersneedspecialcasechecks.
Sometimesitneedsamoresophisticatedmodel.

TimeDelay
t1

t2

now

Attimet,
Sensordatatellsusabouttheworldatt1<t.
Motorcommandstakeeffectattimet2>t.
Thelagisdt=t2t1.

Tocompensateforlagtime,
Predictfuturesensorvalueatt2.
Specifymotorcommandfortimet2.

PredictingFutureSensorValues
Later,observerswillhelpusmakebetter
predictions.
Now,useasimplepredictionmethod:
Ifsensorsischangingatrateds/dt,
Attimet,wegets(t1),wheret1<t,
Estimates(t2)=s(t1)+ds/dt*(t2t1).

Uses(t2)todeterminemotorsignalu(t)that
willtakeeffectatt2.

StaticFriction(Stiction)
Frictionforcesopposethedirectionofmotion.
Weveseendampingfriction:Fd=f(v)
Coulomb(sliding)frictionisaconstantFc
dependingonforceagainstthesurface.
Whenthereismotion,Fc=
Whenthereisnomotion,Fc=+

Extraforceisneededtounstickanobjectand
getmotionstarted.

WhyisStictionBad?
Nonzerosteadystateerror.
Stalledmotorsdrawhighcurrent.
Runningmotorconvertscurrenttomotion.
Stalledmotorconvertsmorecurrenttoheat.

Whiningfrompulsewidthmodulation.
Mechanicalpartsbendingatpulsefrequency.

PulseWidthModulation
Adigitalsystemworksat0and5volts.
Analogsystemswanttooutputcontrolsignals
overacontinuousrange.
Howcanwedoit?

Switchveryfastbetween0and5volts.
Controltheaveragevoltageovertime.

Pulsewidthratio=ton/tperiod.(3050sec)
ton
tperiod

PulseCodeModulatedSignal
Somedevicesarecontrolledbythelength
ofapulsecodesignal.
Positionservomotors,forexample.
0.7ms
20ms
1.7ms

20ms

IntegratorWindUp
SupposewehaveaPIcontroller
t

u(t) = kP e(t) k I

e dt + u

Motionmightbeblocked,buttheintegralis
windingupmoreandmorecontrolaction.

u(t) = k P e(t) + ub
b (t) = kI e(t)
u
Resettheintegratoronsignificantevents.

Chattering
Changingmodesrapidlyandcontinually.
BangBangcontrollerwiththresholdssettoo
closetoeachother.
Integratorwindupduetostictionnearthe
setpoint,causingjerk,overshoot,andrepeat.

DeadZone
Aregionwherecontrolleroutputdoesnot
affectthestateofthesystem.
Asystemcaughtbystaticfriction.
Cartpolesystemwhenthependulumis
horizontal.
Cruisecontrolwhenthecarisstopped.

Integralcontrolanddeadzonescancombine
tocauseintegratorwindupproblems.

Saturation
Controlactionscannotgrowindefinitely.
Thereisamaximumpossibleoutput.
Physicalsystemsarenecessarilynonlinear.

Itmightbenicetohaveboundederrorby
havinginfiniteresponse.
Butitdoesnthappenintherealworld.

Backlash
Realgearsarenotperfectconnections.
Thereisspacebetweentheteeth.

Onreversingdirection,thereisashorttime
whentheinputgearisturning,butthe
outputgearisnot.

ParameterDrift
Hiddenparameterscanchangethebehaviorof
therobot,fornoobviousreason.
Performancedependsonbatteryvoltage.
Repeateddischarge/chargecyclesagethebattery.

Acontrollermaycompensateforsmall
parameterdriftuntilitpassesathreshold.
Thenaproblemsuddenlyappears.
Controlledsystemsmakeproblemshardertofind

UnmodeledEffects
Everycontrollerdependsonitssimplified
modeloftheworld.
Everymodelomitsalmosteverything.

Ifunmodeledeffectsbecomesignificant,
thecontrollersmodeliswrong,
soitsactionscouldbeseriouslywrong.

Mostcontrollersneedspecialcasechecks.
Sometimesitneedsamoresophisticatedmodel.