INTERMEDIATE programming LESSON: debugging Techniques: DISPLAY, LIGHT, Sound, Button Press… By Droids Robotics © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org,

Slides:



Advertisements
Similar presentations
BEGINNER EV3 PROGRAMMING Lesson
Advertisements

Parallel Beams INTERMEDIATE EV3 PROGRAMMING LESSON By Droids Robotics
BEGINNER EV3 PROGRAMMING LESSON By: Droids Robotics Topics Covered: Display Block.
Menu System ADVANCED EV3 PROGRAMMING LESSON By Droids Robotics
INTERMEDIATE PROGRAMMING LESSON By: Droids Robotics Turn Degrees My Block.
INTERMEDIATE PROGRAMMING LESSON By: Droids Robotics Debugging Techniques.
Intermediate Programming Lesson: Improving Robot Reliability in FLL
INTERMEDIATE PROGRAMMING LESSON By: Droids Robotics My Blocks Overview Step-by-Step Visual Guide to Creating a My Block with Inputs with Outputs.
Calibrating Color Sensors
By Droids Robotics Line Followers: Basic to Proportional ADVANCED EV3 PROGRAMMING LESSON © 2015 EV3Lessons.com, Last edit 4/5/
By Droids Robotics INTERMEDIATE PROGRAMMING LESSON BRICK BUTTONS AS SENSORS.
BEGINNER PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING Lesson
INTERMEDIATE PROGRAMMING LESSON
Branching Error (a.k.a. the VM Program Instruction Break Error)
INTERMEDIATE PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING Lesson
BEGINNER EV3 PROGRAMMING Lesson
Squaring or Aligning on a Line
By Sanjay and Arvind Seshan
INTERMEDIATE PROGRAMMING Lesson
By Sanjay and Arvind Seshan
By Sanjay and Arvind Seshan
BEGINNER PROGRAMMING LESSON
Mindsensors PSP-Nx Controller Simon Game
INTERMEDIATE PROGRAMMING Lesson
INTERMEDIATE PROGRAMMING LESSON
By Sanjay and Arvind Seshan
BEGINNER EV3 PROGRAMMING Lesson
Introduction to EV3Dev: Setup with Python
INTERMEDIATE PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING LESSON
BEGINNER PROGRAMMING Lesson
BEGINNER EV3 PROGRAMMING Lesson
BEGINNER EV3 PROGRAMMING Lesson
Gyro Turns © 2015 EV3Lessons.com, Last edit 12/19/2015.
INTERMEDIATE PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING LESSON
By Sanjay and Arvind Seshan
By Sanjay and Arvind Seshan
INTERMEDIATE PROGRAMMING LESSON
Gyro Move Straight & Gyro Wall Follow
BEGINNER PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING LESSON
By Sanjay and Arvind Seshan
BEGINNER EV3 PROGRAMMING Lesson
INTERMEDIATE PROGRAMMING LESSON
Using the Gyro Sensor and Dealing with Drift
By Sanjay and Arvind Seshan
By Sanjay and Arvind Seshan
LEGO MINDSTORMS and Raspberry Pi Communicator
Line Followers: Basic to Proportional
Lesson 6: aligning on Walls & MODELS
BEGINNER PROGRAMMING LESSON
BEGINNER PROGRAMMING Lesson
BEGINNER PROGRAMMING LESSON
Line Followers: Basic to Proportional
INTERMEDIATE PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING LESSON
INTERMEDIATE PROGRAMMING LESSON
By Sanjay and Arvind Seshan
Menu System.
BEGINNER EV3 PROGRAMMING Lesson
Advanced Programming Lesson: Parallel Beams
BEGINNER EV3 PROGRAMMING Lesson
BEGINNER EV3 PROGRAMMING Lesson
BEGINNER PROGRAMMING LESSON
BEGINNER EV3 PROGRAMMING Lesson
Presentation transcript:

INTERMEDIATE programming LESSON: debugging Techniques: DISPLAY, LIGHT, Sound, Button Press… By Droids Robotics © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

Why Debug? Debugging is a useful strategy to figure out where in your program something is going wrong or what went wrong Once your code starts to become long or complicated (e.g. using sensors), it can become hard to figure out where in the program you are The following slides show you some ways of knowing where you are in your program or knowing what values your sensors see You will see that these techniques can be VERY USEFUL to an FLL team Locate Error Think of Solution Fix Error Re-Test Program HURRAY! © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

Play Selected vs. Button Press Light, Sound and Display Different Techniques Play Selected vs. Button Press Very similar techniques Lets you try out smaller portions of code Play Selected requires bluetooth Button Press requires some care so you don’t jostle the robot when pressing the button Light, Sound and Display Very similar techniques Light and Sound are used in the same way Teams enjoy the sound more and it is easier to identify sometimes Display Block comes in handy for knowing what block is played if your robot gets stuck and if you want to see the sensor values © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

PLAY SELECTED Play selected is useful for running small parts of the program Use when you don’t want to wait for your robot to complete other parts of the program before getting to the part you want to see If you don’t have bluetooth built in the computer, we recommend that you purchase a bluetooth dongle (US $10-15) because it makes this type of debugging easier To use, highlight the parts of the program you want to run and pick the play button with the parentheses (>) © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

“WAIT FOR” BUTTON PRESS To place a Wait for Button Press block in your program, place a wait block into your program Go under brick buttons > compare > brick buttons, then choose which button needs to be pressed to continue the program Place these wait for button presses every block or two close to where the robot is not working correctly This can help you pinpoint which block is causing the robot to fail The robot will stop and “wait for you to press the button” © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

VISUAL ALERTS: BRICK STATUS LIGHT BLOCK Place these blocks at critical steps in your program You will then be able to visualize what block is playing and figure out where the error might be Brick status light blocks can be used for warnings Brick Status Light block © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

Now we know it’s between Move Inches and Spin Turn! SOUND ALERTs: SOUND BLOCK You can insert different sounds at intervals (about every 5 blocks or so, and then run the program again while listening for beeps. Once you pick Play Tone, select Play Type and pick “play once” These sounds can help you narrow down where in the program something is going wrong. Now we know it’s between Move Inches and Spin Turn! BEEP! Sound block © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

PRINT TO SCREEN: DISPLAY BLOCK Showing which block is playing on your robot Helps identify what block the robot is stuck on Seeing the sensor readings – to see what the robot sees! Move inches Light-1 100 © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

SAMPLE VIDEO ON NEXT SLIDE The video on the next slide is NOT intended as a solution to the Search Engine mission and isn’t even very good code to get there Instead, what you should look at is how debugging techniques were used during the run Wait for button press Sounds alerts Brick lights Sensor readings displayed on brick © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

SAMPLE VIDEO – CLICK TO PLAY © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

OTHER METHODS Recordings: You can record your runs with a camera. Then watch each run and observe what went wrong Comments: You can also use “comments” to help debug – we add comments to remember what older values were entered into a block. We watch the run and then adjust these values © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org

CREDITS This lesson was made by Nick Faber with help from Sanjay Seshan and Arvind Seshan from FLL Team: Not the Droids You Are Looking For. They are free to use and distribute. Please just give credit to the team and send a thank you note if you can. You can reach the Droids at: team@droidsrobotics.org More lessons: www.ev3lessons.com © 2014, Droids Robotics, v. 1.0, www.droidsrobotics.org, team@droidsrobotics.org