Intermediate Robotics Getting to the Next Level Guiding Question: How might I move the robot consistently, accurately, and predictably? – – – – Review basics (consistent x-y movement) Reference Points (mechanical stops, sensors) Videos (examples) Programming • WAIT block (simple sensors) • Loop/Switch blocks • Advanced blocks (Motor/Sensor/Math/etc.) • MY Blocks Reminder • KIDS DO THE WORK!!! • Encourage kids to ask questions, do research, experiment, discuss observations, etc. • “Mentor with questions” • Use simple exercises to demo key concepts/programming skills • Have fun!!! BOT BASICS (NXT Curriculum) • Bot calibration – 5 rotation test – 360° test • Initial Placement – X - Y position – angle • Mission mapping n = D/C n = (A/360)(2πd/C) Reference Points • Final position error depends upon: – initial placement (x, y, angle) – distance/angle measurements – bot calibration • Problem: long distances, multiple turns lead to large final position errors 2011 FLL Table Angle Errors 2 Degrees Left Error = ± 1.5” @ 50” 2 Degrees Right Positional Error Reduction Solution: identify “intermediate reference points” (keep MOVE distances short) Use: - mechanical stops (walls, other) - sensors Demo Videos (identifying reference points) • • • • 2011 SRES FLL - Supai Youtube (253 pts) ASU BEST Mohave Robotics Club Simple Sensors WAIT blocks (ultrasonic, light, sound, touch) Basic operation: move unlimited until sensor is triggered and stop SENSOR ISSUES: placement on bot limitations Challenges/Exercises (WAIT Blocks) • “closest to the wall” using ultrasonic – limitations??? • “find a line” (find multiple lines) – light sensor needs calibration – color sensor (no calibration • FLL challenges – FLL table (issues??) – FLL/Avnet challenges Discussion • Learning?? Moving with LOOP Block (vs WAIT Block) Sensors (ultrasonic) Logic Moving with LOOP Block II Multiple Sensors (with COMPARE block) Line Following (LOOP/SWITCH/SENSOR BLOCKS) Challenges • follow a line (or find a line and follow it) • use touch sensor to “square up to a wall” • FLL challenges (i.e. pill push) • FLL table challenges Discussion • Learning?? Advanced Blocks VARIABLE block •The variable block is a “bucket” where you can store information and retrieve it at a later time. •There are three types: Number, Text, and Logic Input MATH block •The math block allows the addition, subtraction, division or multiplication of two numbers. Output COMPARE block •The compare allows you to determine if one number is greater than, less than or equal to another number. Input Output (True or False) 4/9/2015 Advanced Programming - Tony Ayad 17 VARIABLES – how to create your own variables • To create your own variables 1. Select “File” Menu and "Define Variables" option 2. Type the name of the variable, then select its type. 4/9/2015 Advanced Programming - Tony Ayad 18 Data Hubs and Data Wires • Data Hub is another way of providing input data into a Block. • Most blocks have a tab at the bottom and when clicked the block expands to show its data "hubs" • The MOVE block has are several data hubs that correspond to its input fields Left Motor • Data wires connect data hubs; you create a data wire by “drawing it out” of a block’s data hub. Right Motor Other Motor Direction Steering Power Duration degrees Data Wire 4/9/2015 Next Action (brake or coast) Advanced Programming - Tony Ayad 19 Move Input Distance I (Variable & Math Blocks, Wiring) Input distance Convert distance to degrees & Input to MOVE block Distance-Power Example II (Variable & Math Blocks, Wiring) MY Blocks Condenses multiple blocks to a single block (a sub-routine) • multiple use of same coding sequence • reduces memory needed MY Block Example Select blocks Create MY Block Name Variables in MY Block Name Values Before After MY Block Use • Use for repeated operations – find a line – line following – etc. • Include variables into MY blocks (repeated operations with different parameters) • Where ever SCC Avnet Competition Tasks (located at trigger points): - raise flag - pill push - grab “Trophy” Complete course Issues: Line Geometry/Trigger Points are NOT predefined SCC Avnet TechGames • Show program build • Show videos Exercises • Create a MY Block – follow line & find trigger points – design your own challenge • Create MY block with 1 or more variables – follow line & use variable distance ultrasonic – design your own challenge Reminder • KIDS DO THE WORK!!! • Encourage kids to ask questions, do research, experiment, discuss observations, etc. • “Mentor with questions” • Use simple exercises to demo key concepts/programming skills • Have fun!!! Info Sources • http://engineering.asu.edu/k12outreach/fll/coaches – – – – NXT Programs = Robot Building Instructions Oregon FLL Video NXT Tutorial Introductory Robotics Curriculum Intermediate Robotics Instruction • Youtube.com (NXT programming) • books – Kelly, James “LEGO MINDSTORMS NXT-G Programming Guide”