An Introduction to VEX IQ Programming with Modkit

Slides:



Advertisements
Similar presentations
Robofest 2005 Introduction to Programming RIS 2.0 RCX Code.
Advertisements

Vex Robotics Introduction to Sensors. introduction to sensors Sensors assist robots in seeing and feeling the physical world through which they travel.
Available at: – Program Optical Quad Encoders in Autonomous Mode Program optical quad encoders in autonomous mode.
An Intro to Robots and Computer Programming
Computer Science 1620 Programming & Problem Solving.
Session 2  The Touch Sensor  The Colour Sensor.
© English Language Testing Ltd Taking the Password Knowledge with Reading and Writing Test.
HTML, Formatting Text and Images Lesson 2.
Line-Follower Challenge. 1. How does a light sensor work? Does the light sensor detect white or black as a higher amount of light reflectivity? Absorbance?
Testbed: Exercises.
What is RobotC?!?! Team 2425 Hydra. Overview What is RobotC What is RobotC used for What you need to program a robot How a robot program works Framework.
BEGINNER PROGRAMMING Lesson
Program ultrasonic range sensor in autonomous mode
GIRLS Robotic Camp. Let’s Begin Meet and Greet – Camp leaders introduce themselves – Students introduce themselves.
Available at: Lesson 3.6 – Program Line Follower in Autonomous Mode Program Line Follower in Autonomous Mode.
© English Language Testing Ltd Taking the Password with Reading and Writing Test.
Available at: Lesson 3.5 – Program Light Sensor in Autonomous Mode Program Light Sensor in Autonomous Mode.
Vex Robotics Program six: combining autonomous and radio control.
Rescue Robot Day 2 Exploring Computer Science Lesson 6-11.
Programming - Motion Intro to Robotics. Motors and Sensors Setup The first thing we need to do is tell ROBOTC that we have motors on our robot. Choose.
BEGINNER FLL PROGRAMMING WORKSHOP BY DROIDS ROBOTICS & EV3LESSONS.
Deriving Consistency from LEGOs What we have learned in 6 years of FLL by Austin and Travis Schuh © 2005 Austin and Travis Schuh, all rights reserved.
Vex Robotics program three: using motors and sensors together.
Casne.ncl.ac.uk Taking care of the CrumbleBot Please do NOT stress the robot's motors 1.Do NOT push the robot 2.Do NOT hold the.
Testbed Coding In this activity you will code different challenges for the Testbed. For each challenge a sample program is shown. Use what this sample.
LESSON 05 Using the Touch LED The Touch LED The purpose of this lesson is to introduce students to the Touch LED Sensor and how they can be used on a.
INTRODUCTION Robots have been part of our fantasy and science fiction for many years. In the last few decades robots have also become a reality of everyday.
Robotics Programming Wall Follow Line tracking for a set amount of time Line tracking for a distance.
LESSON 05 Using the Touch LED. LESSON 05 Using the Touch LED.
ROBOTC for CORTEX Teacher Training © 2011 Project Lead The Way, Inc. Automation and Robotics VEX.
How Do You Make a Program Wait?
Introduction to Programming in RobotC
VEX IQ Curriculum Smart Machines Lesson 09 Lesson Materials:
Camera Basics.
Intro CS – Screens and Variables
An Introduction to VEX IQ Programming with Modkit
Line-Follower Challenge
INTERMEDIATE PROGRAMMING LESSON
Deriving Consistency from LEGOs
VEX IQ Mix & Match Curriculum
Whistles & Bells A simple guide to the buttons on a camera.
By Sanjay and Arvind Seshan
Project Overview Introduction to Factory Automation Numerical Control
Under the direction of Susan Rodger
Touch Sensor.
Most Basic Programming
Programming Part 2 Mod Kit
Fractions are even parts of shapes & groups
Tenths are an Important Fraction
Automation and Robotics
Beginner Programming Lesson
BEGINNER PROGRAMMING Lesson
INTERMEDIATE PROGRAMMING LESSON
Better Line Following with PID
BEGINNER PROGRAMMING LESSON
An Introduction to VEX IQ Programming with Modkit
Beginner Programming Lesson
Holyoke Codes LEGO ROBOTICS
Line Following Behavior
Beginner Programming Lesson
An Introduction to VEX IQ Programming with Modkit
BEGINNER PROGRAMMING Lesson
INTERMEDIATE PROGRAMMING LESSON
Using screens and adding two numbers - addda.cbl
An Introduction to VEX IQ Programming with Modkit
An Introduction to VEX IQ Programming with Modkit
Introduction to Python
Chapter 1 Introducing Small Basic
Intro to Robotics It’s YOUR FUTURE.
Presentation transcript:

An Introduction to VEX IQ Programming with Modkit Robotics Lesson Materials: VEX IQ sensor car (per 2 students) Computer running Modkit (per 2 students) An Introduction to VEX IQ Programming with Modkit Lesson 05

Sensors What sensors have we used so far? What did they do, how did they work? Today we are working with the ‘color’ sensor again. Please remind students of the American spelling of ‘color’ versus ‘colour’ in Modkit. This is commonplace in most programming languages.

The Colo(u)r sensor Remember the settings of the ‘color’ sensor: before programming, we need to choose how we will use the sensor: 3 colours, 12 colours or greyscale (like old black and white TVs and old movies). Note: the sensor is calibrated for fluorescent lighting (typical classroom lighting). How easy was it for the ‘color’ sensor to see the right colour? (Thinking of Lesson 04) Which mode of the sensor do you think would be best to follow a (black) line? (Greyscale) Revisit the ‘color’ sensor and related blocks in Modkit. ‘Color’-block: will tell us the colour name. ‘Color’-Hue: will give us a numerical value for what it sees. Example: all shades of blue under fluorescent lighting will give a value between 200 and 300. Values can be found at the end of the VEX IQ manual. In greyscale mode, this block is changed to ‘Greyscale %’ (values between 0 and 100).

Experiment: Black and White Values Full program provided as experiment-0.mk4v (same as lesson 04) As discussed, in our program we will use the ‘color’ sensor to see greyscales (black and white). Depending on the object that’s underneath we will get a number between 0 and 100. As not every black object is fully black and not every white object is perfectly white, we will run a little program on the robot to check which number our sensor sees. Experiment: run the program ‘experiment-0’ downloaded to a robot. (no need to explain or show this program to the students). Move the robot car over the track and check the values it shows on the robot’s lcd screen. Make sure to see what happens when the ‘color’ sensor is on the white paper and how the values changes as you gently move it across the black track. Our line tracking program will follow the right edge of a black line on a white piece of paper, so make sure to note the values for the following situations: The sensor sees mainly black (in the example program this will be 10) The sensor sees mainly white (in the example program this will be 30) The sensor is located on the edge of the track (in the example program this will be between 10 and 30)

Programming task: Line tracking Challenge You need to program the robot to…. Set up the robot car with the right sensors/ports. Use variables to set values for black and white. Write a program that will drive the car forward and follow the right hand edge of a black line on a white surface. This program is similar to the ‘Drive on Black’ program from lesson 4 (minus the Touch LED functions and with a more complex IF-statement). Guide the students through creating this program using conditional statements for black and white. Avoid too much hand holding, apart from a slightly more complex if-statement, they should be able to do this on their own. The next slides will reveal the programming steps.

Programming task: Line tracking Make sure the ‘color’ sensor is in greyscale mode.

Programming task: Line tracking We will use variables called ‘black’ and ‘white’ to inform the robot of our experimental data. Remind the students of this process. They can create a variable by clicking on the ‘New Variable’ block at the very bottom of interface. A variable name can be anything, but choose it sensibly (Black or White in our example). After entering it, 2 new blocks with that name will appear. One block just has the name, the other also has a field to put in some data.

Programming task: Line tracking The values of the ‘Black’ and ‘White’ variables are listed here as 10 and 30 respectively. The values will depend on the lighting in the classroom. Please refer back to the values of the experiment at the start of the lesson. We will define the values in the ‘Brain’ section of Modkit, but this can be done in any section.

Programming task: Line tracking The bulk of our program takes place in the drivetrain section. Remember the drivetrain setup blocks from lesson 1 (see blocks sheet lesson 1)? Since we need to give our robot enough time to make sure the ‘color’ sensor gets to output a value before we drive over the black line, we will limit the drive and turn speeds. The next slide reveals the full drivetrain program. Before showing and discussing the slide, discuss the 3 different actions we might need to take and when to take these (in plain English first, then translate to pseudo code). We are trying to follow the right hand edge of a black track on white paper. 1. Situation: our robot is too far to the right of the track. Sensor: it will mainly see white. Action to be taking: turn left. 2. Situation: our robot is too far to the left of the track. Sensor: it will mainly see black (too much black). Action to be taking: turn right. 3. Situation: our robot is on the right edge of the track. Sensor: it will mainly see just enough black (in between 1 and 2). Action to be taking: go forward. This is the tricky one as there are 2 conditions that need be fulfilled (not too much black, not too much white). Use the ‘and’ operator to combine them. Ensure enough time is taken so the students understand the logic of the decisions and not just the code. Try to get the students to write the code, if needed refer back to the blocks sheets for control (if-statements), operators (bigger than, smaller than,…) and drivetrain (Forward, turn,..)

Programming task: Line tracking Test the program and adjust values for black and white if needed and possibly also the speed settings of the drivetrain. Note how the accuracy will change. Please note: make sure you start the robot on the right hand edge of the line! Full program provided as LineTracking-0.mk4v

Summary Today you have: Learning objective: Learn how robots gather data from their environment. Learn to program a VEX IQ robot with drivetrain and ‘color’ sensor. Learn about the use of variables, conditional statements and repeat structures . Today you have: Learned how robots can gather data from different sensors. Learned to add the ‘color’ sensor to our robot. Programmed a robot to work autonomously. Learned how to use variables. Programmed a fully automatic car. End the lesson by a brief discussion on how our robot ‘sees’ and how accurate this is/isn’t.