line followers: basic to proportionalclassic.ev3lessons.com/advanced/linefollower.pdfchange how...
TRANSCRIPT
-
ADVANCEDEV3PROGRAMMINGLESSON
LineFollowers:BasictoProportionalBySanjayandArvindSeshan
-
ì Evaluateandcomparedifferentlinefollowers
ì Learntousetheconceptof“proportional”tocreateaproportionallinefollower
ì Prerequisites:BasicLineFollower,ColorLineFollower,ColorSensorCalibration,ProportionalControl,MathBlocks,DataWires
©2015EV3Lessons.com,Lastedit4/5/2015 2
LessonObjectives
-
©2015EV3Lessons.com,Lastedit4/5/2015 3
WhichProgramWorksBestforWhichSituation?
SmoothLineFollower• Almostthesameassimple• Turnsarelesssharp• Hastroubleonsharpcurves• Good forrookieteamsà needtoknow
loopsandswitches
SimpleLineFollower• Mostbasiclinefollower• Wigglesalotduetosharpturns• Good forrookieteamsà needto
knowloopsandswitches
ProportionalFollower• Usesthe“P”inPID• Makesproportional turns• Workswellonbothstraightandcurved
lines• Good forintermediatetoadvanced
teamsà needtoknowmathblocksanddatawires
3-StageFollower• Bestforstraightlines• Droidsdonot recommendthis.
Justlearntheproportional linefollower.
• Needtoknownestedswitches
Watchthevideosonthenext2slidestoseeallfour.
-
©2015EV3Lessons.com,Lastedit4/5/2015 4
CurvedLine:WatchVideos
SmoothLineFollowerSimpleLineFollower
Proportional Follower3-StageFollower
-
StraightLine:WatchVideos
©2015EV3Lessons.com,Lastedit4/5/2015 5
SmoothLineFollowerSimpleLineFollower
Proportional Follower3-StageFollower
-
ì Challenge1:Canyouwriteasimplelinefollower?Hint:ReviewBeginner:BasicLineFollowerlesson
ì Challenge2:Canyouwriteasmootherlinefollower?Hint:Changehowsharptheturnsareinasimplelinefollower.
ì Challenge3:Canyouwriteathree-stagelinefollowerwheretherobotmovesdifferent3differentways(left,rightorstraight)basedonthereadingfromthecolorsensor?
©2015EV3Lessons.com,Lastedit4/5/2015 6
3LineFollowerChallenges
-
ì CALIBRATE:ì TheprogramsusetheEV3ColorSensorinLightSensormodeì Youwillhavetocalibrateyoursensors.ì PleaserefertoIntermediate:ColorSensorCalibrationLesson
ì PORTS:ì TheColorSensorisconnectedtoPort3.ì Pleasechangethisforyourrobot.
ì WHICHSIDEOFTHELINE:ì Pleasetakenoteofwhichsideofthelinethecodeiswrittenfor
©2015EV3Lessons.com,Lastedit4/5/2015 7
ANoteAboutOurSolutions
-
Solution1:SimpleLineFollower
©2015EV3Lessons.com,Lastedit4/5/2015 8
-
Solution2:SmoothLineFollower
©2015EV3Lessons.com,Lastedit4/5/2015 9
-
Solution3:Three-StageLineFollower
©2015EV3Lessons.com,Lastedit4/5/2015 10
-
Challenge4:Canyouwriteaproportionallinefollowerthatchangestheangleoftheturndependingonhowfarawayfromthelinetherobotis?
Pseudocode:
1. ResettheRotationsensor(Onlyrequiredforlinefollowingforatotaldistance)
2. Computetheerror=Distancefromline=(Lightsensorreading– TargetReading)
3. Scaletheerrortodetermineacorrectionamount.Adjustyourscalingfactortomakeyourobotfollowthelinemoresmoothly.
4. UsetheCorrectionvalue(computerinStep3)toadjusttherobot’sturntowardstheline.
©2015EV3Lessons.com,Lastedit4/5/2015 11
Challenge4:ProportionalLineFollower
-
Solution:ProportionalLineFollower
©2015EV3Lessons.com,Lastedit4/5/2015 12
-
ì Youwillgetbetterresults
ì ….ifyourcolorsensorsareclosertotheground
ì ….remembertocalibrate
©2015EV3Lessons.com,Lastedit4/5/2015 13
Tips
-
©2015EV3Lessons.com,Lastedit4/5/2015 14
DiscussionGuide
SmoothLineFollower++--
SimpleLineFollower++--
ProportionalFollower++--
Three-StageLineFollower++--
Fillintheabovewithpositivesandnegativesofeachtechnique.Consider ifthelinefollowerisbestforcurvedorstraightlines.Consider iftherobotwillwigglealot.
-
ì ThistutorialwascreatedbySanjaySeshan andArvindSeshan
ì Morelessonsatwww.ev3lessons.com
©2015EV3Lessons.com,Lastedit4/5/2015 15
Credits
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.