Top Banner
ADVANCED EV3 PROGRAMMING LESSON Line Followers: Basic to Proportional By Sanjay and Arvind Seshan
15

Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

May 17, 2019

Download

Documents

vuthien
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

ADVANCEDEV3PROGRAMMINGLESSON

LineFollowers:BasictoProportionalBySanjayandArvindSeshan

Page 2: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

ì Evaluateandcomparedifferentlinefollowers

ì Learntousetheconceptof“proportional”tocreateaproportionallinefollower

ì Prerequisites:BasicLineFollower,ColorLineFollower,ColorSensorCalibration,ProportionalControl,MathBlocks,DataWires

©2015EV3Lessons.com,Lastedit4/5/2015 2

LessonObjectives

Page 3: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

©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.

Page 4: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

©2015EV3Lessons.com,Lastedit4/5/2015 4

CurvedLine:WatchVideos

SmoothLineFollowerSimpleLineFollower

Proportional Follower3-StageFollower

Page 5: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

StraightLine:WatchVideos

©2015EV3Lessons.com,Lastedit4/5/2015 5

SmoothLineFollowerSimpleLineFollower

Proportional Follower3-StageFollower

Page 6: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

ì Challenge1:Canyouwriteasimplelinefollower?Hint:ReviewBeginner:BasicLineFollowerlesson

ì Challenge2:Canyouwriteasmootherlinefollower?Hint:Changehowsharptheturnsareinasimplelinefollower.

ì Challenge3:Canyouwriteathree-stagelinefollowerwheretherobotmovesdifferent3differentways(left,rightorstraight)basedonthereadingfromthecolorsensor?

©2015EV3Lessons.com,Lastedit4/5/2015 6

3LineFollowerChallenges

Page 7: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

ì CALIBRATE:ì TheprogramsusetheEV3ColorSensorinLightSensormodeì Youwillhavetocalibrateyoursensors.ì PleaserefertoIntermediate:ColorSensorCalibrationLesson

ì PORTS:ì TheColorSensorisconnectedtoPort3.ì Pleasechangethisforyourrobot.

ì WHICHSIDEOFTHELINE:ì Pleasetakenoteofwhichsideofthelinethecodeiswrittenfor

©2015EV3Lessons.com,Lastedit4/5/2015 7

ANoteAboutOurSolutions

Page 8: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

Solution1:SimpleLineFollower

©2015EV3Lessons.com,Lastedit4/5/2015 8

Page 9: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

Solution2:SmoothLineFollower

©2015EV3Lessons.com,Lastedit4/5/2015 9

Page 10: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

Solution3:Three-StageLineFollower

©2015EV3Lessons.com,Lastedit4/5/2015 10

Page 11: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

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

Page 12: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

Solution:ProportionalLineFollower

©2015EV3Lessons.com,Lastedit4/5/2015 12

Page 13: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

ì Youwillgetbetterresults

ì ….ifyourcolorsensorsareclosertotheground

ì ….remembertocalibrate

©2015EV3Lessons.com,Lastedit4/5/2015 13

Tips

Page 14: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

©2015EV3Lessons.com,Lastedit4/5/2015 14

DiscussionGuide

SmoothLineFollower++--

SimpleLineFollower++--

ProportionalFollower++--

Three-StageLineFollower++--

Fillintheabovewithpositivesandnegativesofeachtechnique.Consider ifthelinefollowerisbestforcurvedorstraightlines.Consider iftherobotwillwigglealot.

Page 15: Line Followers: Basic to Proportional - ev3lessons.comev3lessons.com/en/ProgrammingLessons/advanced/LineFollower.pdf · Smooth Line Follower + +--Simple Line Follower + +--Proportional

ì 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.