Beruflich Dokumente
Kultur Dokumente
RachelAbril,MonicaCaravias,KaranHanda,BryanLopez
May19,2015
ControlLawandTrajectoryDesign
Bothofourcontrollawsforthesteeringangleandthedriveforcecontainedfeedforwardandfeedback
terms.Foroursteeringanglewehad:
steer = FB + FFW
FB = K y/C af * (e + xla * ( + ss))
ss = ( mU x2a/(L * C ar) + b) *
FFW = L * + K ug(U x2)/g
K y = 15000N/m
xla = 15m
Thelookaheadfeedbackinthesteeringanglecontrol,whichissetbythexlaparameter,helpstoensure
stabilityandaidsinthereductionoftheheadingerror.Thefeedforwardtermallowsfortheprediction
ofsteeringangleforzerotrackingerror.The ss termisthesideslipneededtoopposetheheadingerror
insteadystate.
Forourdriveforcewehad:
F x = F FB + F FFW + F drag + F rr
F FB = K x * (U x,des U x)
F FFW = mAx,des
F drag = f dragU x2
F rr = 255Nf drag = 0.3638Kx = 3000N/(m * s)
Thedriveforceconsistsofthefeedbacktermdeterminedbyourdesiredandactualspeeds,the
feedforwardtermbasedonourdesiredacceleration,andthedragandrollingresistanceforces.
Tocalculatemaximumpossiblespeed,wedid(1)amaximumspeedpasslimitedbythecurvatureof
theroad,(2)aforwardspasstolimitlongitudinalacceleration,and(3)abackwardspasstolimit
longitudinaldeceleration.Inordertosmoothoutthelocalmaximaandminima,weusedthespline
functiontoroughlymatchthemaximumspeedtrajectory,asshownintheplotonthenextpage.This
splineresultedinthesmoothestentryintothefirstcorneroutofallthegroups.ChrisGerdes,c.
2015
Seetheappendixattheendofthereportforcontroller.mandgenerateSpeedTrajectory.mcode.
Results:Simulatedvs.ActualExperimentalData
Afterdesigningourtrajectoriesandcontroller,weperformedtestrunsontheAudiTTS,andcollected
thefollowingdata:LateralError,HeadingError,LongitudinalAcceleration,LateralAccelerationand
VehicleSpeed.Weplottedthisexperimentaldataalongsideoursimulateddatatocompare.
ComparisonofChangesMade
Ourfirstdesignwasfairlyminimal:weusedadesiredspeedprofilethatrampeduptothemaximum
allowablelongitudinalspeedbasedonthecoursescurvature,andasimplecontrollerwithboth
feedbackandfeedforwardterms,asoutlinedintheControlLawandTrajectoryDesignsection.In
oursimulation,wefoundthatwithaveryhighgain,thevehiclewouldtrackourdesiredparameters
moreclosely.Inpractice,however,thevehiclehadadifficulttimetrackingthespeedprofilewithsuch
ahighgain,makingtherideveryjerky.
Withthatinsight,onourseconditerationweloweredthecontrollersgainsignificantly.Wealso
includeddragandrollingresistancetermsinourcommandforcemodeltoloweroursteadystatespeed
error.Thesechangesdrasticallyimprovedthevehiclehandlingtheridewasmuchlessjerky,andupon
lateranalysis,showedasmallerlongitudinalspeederror.However,thesimplerampuprampdown
speedtrajectorycappedourhighestspeedatafairlylowvalue,andthevehiclewasmuchslowerthan
weenvisioned.
Forourfinaltest,wedecidedtofocusoureffortsonimprovingthespeedtrajectorybyfollowingthe
maximumpossiblespeedateachpointalongthetrack.Weimplementedthisbyensuringthatthe
vehiclewasoperatingatthehighestspeedpossiblegiventhreeconditions:thatthevehicledidnt
exceedthemaximumlateralaccelerationwhenturningacorner,didntexceedthemaximum
longitudinalaccelerationwhenspeedingupduringstartorwhencomingoutofaturn,anddidnt
exceedthemaximumlongitudinaldecelerationwhenslowingdownbeforeaturnorcomingtoastop.
Thisresultedinaspeedtrajectorywithsharppeakswheneachconditionwasinvoked.Tosmoothit
out,weappliedasplinefitusingMatlabssplinefunction.Wemadenochangestothecontroller
betweenthefinaltrialandtheprevioustrial.ThefinalspeedtrajectoryisshownintheaboveControl
LawandTrajectoryDesignsection.
ReflectionsonSimulationvs.Experiment
Inadditiontounderstandingthephysicalimpactsofchangingthegain,wefoundthatthesimulation
doesntnecessarilyunderstandthephysicalcapabilitiesofthecar.Asyoucanseeinoursimulation
resultsabove,thecarappearstospinoutofcontrolasitreaches0m/sattheendofthepath,even
thoughitisphysicallyimpossibleforthecartomoveatallat0m/s.Theexperimentalsoincludeda
lowerlevelcontrollerwhichtransformedournebulousumbrellaFcommandtermintoacombination
ofbrakeandthrottleforces,whichwediscoveredhadaverynoticeableimpactonthesmoothnessof
theride.Itwouldbeinterestingtoopenupthiscontrollerandseehowitinteractswiththecontroller
thatwecreatedforthisproject.Animprovementwecouldmaketoourspeedtrajectorywouldbeto
selectthelocalmaximaandminimaofthemaximumspeedtrajectoryforagivenpathandcreatingthe
splineforthosepoints,effectivelycreatingamoreinvolvedandintelligentsplinethatholdsreliablyfor
allpaths.
Appendix
controller.m
function[delta,FxCommand]=controller(e,dPsi,K,s,AxDes,UxDes,alphaF,alphaR,
Ux,beta,r,psi,posE,posN,pathLength)
%RelevantVehicleParameters
a=1.0441
b=1.4248
m=1.648e3
Cf=200000
Cr=200000
g=9.81
L=a+b
FzF=m*b*g/L
FzR=m*a*g/L
fdrag=0.3638
Fdrag=fdrag*Ux^2
Frr=255
%OurControler
%Gains
Kx=3000
Ky=15000
xla=15
Kug=(FzF/CfFzR/Cr)
Bss=(m*(Ux^2)*a/(L*Cr)+b)*K
delta_fb=(Ky/Cf)*(e+xla*(dPsi+Bss))
delta_ffw=L*K+Kug*((Ux^2)*K/g)
delta=delta_fb+delta_ffw%feedbackandfeedforward
FxCommand=Kx*(UxDesUx)+m*AxDes+Frr+Fdrag%includesfeedforwardterm
%FxCommand=Kx*(UxDesUx)
end
generateSpeedTrajectory.m
functionprof=generateSpeedTrajectory(path,veh)
disp('GeneratingSpeed')
%Ourcode:Startatrest,ramptillUx_des_max,keepconstant,thenrampdown
tillrest
prof.s=path.s
prof.Ux=zeros(size(prof.s))
prof.Ax=zeros(size(prof.s))
%Constants
g=9.81
%1.maximumspeedbasedonkappa
kappa=abs(path.K)
Ux_des(1)=0.01
Ux_des=zeros(size(kappa))
fori=2:length(kappa)
Ux_max=sqrt(0.3*g./kappa(i))%[m/s]solved:ay=kappa*Uxmax^2<=.3*g
Ux_des(i)=min(Ux_max,10)
end
ax_des_max=0.2*g
kappa_max=max(abs(path.K))
Ux_des_max=sqrt(0.3*g/kappa_max)
s_end=path.s(length(path.s))1%endofpath[m]%1tomatchupwithbike
simforplotting
M=length(path.s)
s=path.s
dUx_des=zeros(M,1)
prof.Ux(1)=.5
%forwardspass
fori=1:M1
ifimag(sqrt((prof.Ux(i))^2+2*ax_des_max*(s(i+1)s(i))))==0
Ux_f=sqrt((prof.Ux(i))^2+2*ax_des_max*(s(i+1)s(i)))
prof.Ux(i+1)=min(Ux_f,Ux_des(i+1))
else
prof.Ux(i+1)=0
end
end
%backwardspass
prof.Ux(M20)=0
forj=1:M20
i=Mj
ifimag(sqrt((prof.Ux(i))^2+2*ax_des_max*(s(i)s(i1))))==0
Ux_b=sqrt((prof.Ux(i))^2+2*ax_des_max*(s(i)s(i1)))
prof.Ux(i1)=min(Ux_b,prof.Ux(i1))
else
prof.Ux(i1)=0
end
end
prof.Ux(M19:M)=0
step=50
Ux_spline_prep=prof.Ux(1:step:length(prof.Ux))
s_spline=path.s(1:step:length(path.s))
Ux_spline=spline(s_spline,Ux_spline_prep,path.s)
%Lastpointshouldgotorest
prof.Ax=dUx_des
figure
%plot(path.s,Ux_des,'c')
plot(path.s,prof.Ux,'m')
holdon
%plot(path.s,Ux_spline,'k')
xlabel('Paths(m)')
ylabel('LongitudinalSpeedUx(m/s)')
title('DesiredSpeedvs.Path')
fori=1:M
ifUx_spline(i)>=0
prof.Ux(i)=Ux_spline(i)
else
prof.Ux(i)=0
end
end
plot(path.s,prof.Ux,'k')
legend('MaximumSpeed','Spline')
xlim([0225])
%calculatedesiredacceleration
fori=1:M1
prof.Ax(i)=(prof.Ux(i+1)^2prof.Ux(i)^2)/(2*(s(i+1)s(i)))
end
prof.Ax(M)=0
plotfixer
%figure
%plot(path.s,prof.Ax)
end