Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X#...

15
By Droids Robo,cs Line Followers: Basic to Proportional ADVANCED EV3 PROGRAMMING LESSON © 2015 EV3Lessons.com, Last edit 4/5/2015 1

Transcript of Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X#...

Page 1: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

By  Droids  Robo,cs  

Line  Followers:  Basic  to  Proportional  

ADVANCED  EV3  PROGRAMMING  LESSON  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

1  

Page 2: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Lesson  Objectives  

1.  Evaluate  and  compare  different  line  followers  

2.  Learn  to  use  the  concept  of  “propor,onal”  to  create  a  propor,onal  line  follower  

Prerequisites:  Basic  Line  Follower,  Color  Line  Follower,  Color  Sensor  Calibra,on,  Propor,onal  Control,  Math  Blocks,  Data  Wires  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

2  

Page 3: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Which  Program  Works  Best  for  Which  Situation?  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

Smooth  Line  Follower  •  Almost  the  same  as  simple  •  Turns  are  less  sharp  •  Has  trouble  on  sharp  curves  •  Good  for  rookie  teams  à  need  to  know  

loops  and  switches  

Simple  Line  Follower  •  Most  basic  line  follower  •  Wiggles  a  lot  due  to  sharp  turns  •  Good  for  rookie  teams  à  need  to  

know  loops  and  switches  

ProporAonal  Follower  •  Uses  the  “P”  in  PID  •  Makes  propor,onal  turns  •  Works  well  on  both  straight  and  curved  

lines  •  Good  for  intermediate  to  advanced  

teams  à  need  to  know  math  blocks  and  data  wires  

3-­‐Stage  Follower  •  Best  for  straight  lines  •  Droids  do  not  recommend  this.    

Just  learn  the  propor,onal  line  follower.  

•  Need  to  know  nested  switches  

Watch  the  videos  on  the  next  2  slides  to  see  all  four.  

3  

Page 4: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Curved  Line:  Watch  Videos  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

Smooth  Line  Follower  Simple  Line  Follower  

Propor,onal  Follower  3-­‐Stage  Follower  

4  

Page 5: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Straight  Line:  Watch  Videos  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

Smooth  Line  Follower  Simple  Line  Follower  

Propor,onal  Follower  3-­‐Stage  Follower  

5  

Page 6: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

3  Line  Follower  Challenges  

ì  Challenge  1:  Can  you  write  a  simple  line  follower?  Hint:  Review  Beginner:  Basic  Line  Follower  lesson  

ì  Challenge  2:  Can  you  write  a  smoother  line  follower?  Hint:  Change  how  sharp  the  turns  are  in  a  simple  line  follower.  

ì  Challenge  3:  Can  you  write  a  three-­‐stage  line  follower  where  the  robot  moves  different  3  different  ways  (le[,  right  or  straight)  based  on  the  reading  from  the  color  sensor?  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

6  

Page 7: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

A  Note  About  Our  Solutions  

ì  CALIBRATE:  ì  The  programs  use  the  EV3  Color  Sensor  in  Light  Sensor  mode  ì  You  will  have  to  calibrate  your  sensors.  ì  Please  refer  to  Intermediate:  Color  Sensor  Calibra,on  Lesson  

ì  PORTS:    ì  The  Color  Sensor  is  connected  to  Port  3.      ì  Please  change  this  for  your  robot.    

ì  WHICH  SIDE  OF  THE  LINE:  ì  Please  take  note  of  which  side  of  the  line  the  code  is  wri^en  

for  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

7  

Page 8: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Solution  1:  Simple  Line  Follower  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

8  

Page 9: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Solution  2:  Smooth  Line  Follower  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

9  

Page 10: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Solution  3:  Three-­‐Stage  Line  Follower  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

10  

Page 11: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Challenge  4:  Proportional  Line  Follower  

Challenge  4:  Can  you  write  a  propor,onal  line  follower  that  changes  the  angle  of  the  turn  depending  on  how  far  away  from  the  line  the  robot  is?  

Pseudocode:  

1.  Reset  the  Rota,on  sensor  (Only  required  for  line  following  for  a  total  distance)  

2.  Compute  the  error  =  Distance  from  line  =  (Light  sensor  reading  –  Target  Reading)  

3.  Scale  the  error  to  determine  a  correc,on  amount.  Adjust  your  scaling  factor  to  make  you  robot  follow  the  line  more  smoothly.  

4.  Use  the  Correc,on  value  (computer  in  Step  3)  to  adjust  the  robot’s  turn  towards  the  line.  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

11  

Page 12: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Solution:  Proportional  Line  Follower  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

12  

Page 13: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Tips  

ì  You  will  get  be^er  results    

ì  ….if  your  color  sensors  are  closer  to  the  ground  

ì  ….if  you  shield  your  color  sensors  

ì  ….remember  to  calibrate  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

13  

Page 14: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Discussion  Guide  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

14  

Smooth  Line  Follower  +  +  -­‐  -­‐  

Simple  Line  Follower  +  +  -­‐  -­‐  

ProporAonal  Follower  +  +  -­‐  -­‐  

Three-­‐Stage  Line  Follower  +  +  -­‐  -­‐  

Fill  in  the  above  with  posi,ves  and  nega,ves  of  each  technique.    Consider  if  the  line  follower  is  best  for  curved  or  straight  lines.    Consider  if  the  robot  will  wiggle  a  lot.  

Page 15: Line%Followers:%Basic%to% ProportionalSmooth"Line"Follower" + + X# X# Simple"Line"Follower" + + X# X# ProporAonal"Follower" + + X# X# ThreeBStage"Line"Follower" + + X# X# Fill#in#the#above#with#posi,ves#and#negaves#of#each#technique.##Consider#if#the#line#

Credits  

ì  This  tutorial  was  created  by  Sanjay  Seshan  and  Arvind  Seshan  from  Droids  Robo,cs.  ì  Author’s  Email:  team@droidsrobo,cs.org  

ì  More  lessons  at  www.ev3lessons.com  

©  2015  EV3Lessons.com,  Last  edit  4/5/2015  

                          This work is licensed under a 

Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

15