Squaring or Aligning on a Line - EV3Lessons.com | by...
-
Upload
vuongthuan -
Category
Documents
-
view
225 -
download
4
Transcript of Squaring or Aligning on a Line - EV3Lessons.com | by...
![Page 1: Squaring or Aligning on a Line - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/html5/thumbnails/1.jpg)
ADVANCEDEV3PROGRAMMINGLESSON
SquaringorAligningonaLineBySanjayandArvindSeshan
![Page 2: Squaring or Aligning on a Line - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/html5/thumbnails/6.jpg)
©2016EV3Lessons.com,Lastedit06/19/2016
WhatAligningShouldLookLike
![Page 7: Squaring or Aligning on a Line - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/html5/thumbnails/8.jpg)
©2016EV3Lessons.com,Lastedit06/19/2016
BasicSolution:MovingUntilLine
![Page 9: Squaring or Aligning on a Line - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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 - EV3Lessons.com | by ...ev3lessons.com/translations/en-us/advanced/Align.pdf · ADVANCED EV3 PROGRAMMING LESSON Squaring or Aligning on a Line By Sanjay](https://reader031.fdocuments.us/reader031/viewer/2022021820/5ade15c07f8b9ae1408de06f/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.