squaring or aligning on a line - ev3 lessons · 2020. 7. 5. · ì learn how to get your robot to...
TRANSCRIPT
![Page 1: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/1.jpg)
ADVANCEDEV3PROGRAMMINGLESSON
SquaringorAligningonaLineBySanjayandArvindSeshan
![Page 2: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/2.jpg)
ì Learnhowtogetyourrobottosquareup(straightenout)whenitcomestoaline
ì Learnhowsquaring(alsoknownasaligningonaline)canhelptherobotnavigate
ì Learnhowtoimproveinitialcodeforaligningbyrepeatingatechnique
ì PracticecreatingausefulMyBlock
ì Prerequisites:MyBlockswithInputs&Outputs,DataWires,ParallelBeams,ParallelBeamsSynchronization
©2016EV3Lessons.com,Lastedit06/19/2016
LessonObjectives
![Page 3: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/3.jpg)
ì MoveSteeringletsyoucontrolbothmotorsatthesametime
ì Whatifyouwanttomoveorstoponemotoratatime?ì UsetheLargeMotorBlock
©2016EV3Lessons.com,Lastedit06/19/2016
Review:MotorMovements
LargeMotorBlock LargemotorblockinONmode/OFFmode
![Page 4: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/4.jpg)
ì Aligningonalinehelpstherobotnavigateì Robotsgetangledastheytravelfartheror
turn(theerroraccumulates)ì Aligningonalinecanstraightenoutarobot.ì Aligningcantellarobotwhereitiswhenit
hastotravelfar
ì ExampleGoal:YourrobotmustdeliveranobjectonlyinsideasmallENDarea.Thedistancebetweenstartandendis8feetì Doyouthinkyourrobotcantravel8feetand
continuetobestraight?
©2016EV3Lessons.com,Lastedit06/19/2016
WhyAlignonaLine?
Start
8ft
![Page 5: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/5.jpg)
Challenge:Maketherobotstraightenout(align/squareup)
©2016EV3Lessons.com,Lastedit06/19/2016
ThreeEasyStepstoAlign
STEP1:Startbothmotors
STEP2:Stoponemotorwhenthesensoronthecorrespondingsideseestheline
STEP3:Stopmovingthesecondmotorwhenthesensoronthatsideseestheline
Hints:UseaLargeMotorBlock,UseParallelBeams,UsetheLargeMotorBlock (Thisslideisanimated)
![Page 6: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/6.jpg)
©2016EV3Lessons.com,Lastedit06/19/2016
WhatAligningShouldLookLike
![Page 7: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/7.jpg)
©2016EV3Lessons.com,Lastedit06/19/2016
NotesAboutOurSolution:
ì Oursolutionuses2ColorSensors(connectedinPorts1and4).
ì Oursolutionassumesthatthecolorsensoronport1isnexttothewheelonmotorportBandcolorsensoronport4isnexttothewheelonmotorportC.
ì Youshouldadjusttheportsasneeded
ì YourcolorsensorsshouldNOTbeplacedrightnexttoeachother(Seeredboxesbelowinrobotimage.Thesearethecolorsensors.)
![Page 8: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/8.jpg)
©2016EV3Lessons.com,Lastedit06/19/2016
BasicSolution:MovingUntilLine
![Page 9: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/9.jpg)
ì Whenyouhavetwoormorebeamsyoudonotknowwheneachbeamwillfinish.
ì Ifyouwantedtomoveafterthealignfinishesyoumighttrytoaddamoveblockattheendofoneofthebeams.ì Note:ThiswillnotworkbecauseEV3codewillplayyourmoveblock
withoutwaitingfortheotherbeamtofinish.ì Solution:Youneedtosynchronizeyourbeams.Tolearnmoreabout
synchronizationandsolutionsgototheAdvancedEV3Lessons.comLessononSyncBeams
ì TheproblemofsynchronizationcanalsobesolvedbymakingaMyBlockoutofthealigncode(refertoMyBlocklessoninIntermediate)ì MyBlocksalwayswaitforbothbeamstofinishbeforeexiting
©2016EV3Lessons.com,Lastedit06/19/2016
Note:Synchronization&ParallelBeams
![Page 10: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/10.jpg)
ì Whatdoyounoticeaboutthesolutionwejustpresented?ì Therobotisn’tquitestraight(aligned)attheendofit.ì Bothcolorsensorsareontheline,buttherobotstopsatan
angle.
ì ChallengeContinued:Thinkabouthowyoucanimprovethiscodesothattherobotendsstraighter
©2016EV3Lessons.com,Lastedit06/19/2016
ImprovingYourAlignCode
![Page 11: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/11.jpg)
ì Youwillgetbetterresultsì ….ifyourcolorsensorsareabout4mm-12mmfromtheground
(seeColorSensorPlacementLessoninRobotDesignLessons)ì ….ifyoudon’tcomeatthelineatsteepanglesì ….ifyoukeepyourcolorsensorsspreadapart
©2016EV3Lessons.com,Lastedit06/19/2016
TipsforSuccess
![Page 12: Squaring or Aligning on a Line - EV3 Lessons · 2020. 7. 5. · ì Learn how to get your robot to square up (straighten out) when it comes to a line ì Learn how squaring (also known](https://reader033.vdocuments.site/reader033/viewer/2022051608/603bbe49bfa86924022131cc/html5/thumbnails/12.jpg)
ì ThistutorialwascreatedbySanjaySeshan andArvindSeshan
ì Morelessonsatwww.ev3lessons.com
©2016EV3Lessons.com,Lastedit06/19/2016
Credits
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.