Using the NXT Light Sensor. 2 Connect One Light Sensor – 1 From My Files use Left / Right NXT buttons and get to View menu and push Orange button. From.

Slides:



Advertisements
Similar presentations
Each team has their own: a.Laptop computer b.LEGO NXT robot c.USB cable d.Light paper on the table to test the robot Sit Down in Teams of 2.
Advertisements

Getting started with LEGO NXT Mindstorms software This is intended to be a short introduction to the LEGO Mindstorms software and programming the LEGO.
Proportional, Integral, Derivative Line Following October 5, 2013.
Jason Howard. Agenda I. How to download robotc II. What is tele-op used for? III. How to build a basic tele-op program IV. Getting the robot to drive.
EducateNXT Enter the name “Sound Graphing” for your experiment. Real-time Data Logging Click the Switch to NXT Data Logging icon in the top-left corner.
Add and Use a Sensor & Autonomous For FIRST Robotics
Follow The Guidelines Introductory Presentation. Opening Activity Make a prediction about how light sensors will use thresholds. Keep in mind: We used.
Squaring or Aligning on a Line
EIGHTH GRADE ROBOTICS KITTATINNY REGIONAL HIGH SCHOOL MR. SHEA Introduction to Programming
From the NXT top menu Connect desired hardware as indicated Enter a command in the box indicated from the menu provided Repeat for all 5 boxes.
An Intro to Robots and Computer Programming
Reviewing Common Blocks for St. Agnes Elementary School Teachers by Jenny Chang Feb. 26th, 2007 USC & University Neighborhood Outreach Robotics STEM program.
LEGO Mindstorms NXT Programming We will be using the Common Palette for our Robots This is how you download your program onto the brick Drag and drop a.
Testbed: Exercises.
Loops and Switches. 1. What kind of blocks are these? 2. Name two kinds of controls that can be specified to determine how long a loop repeats. 3. Give.
Robotics- Basic On/Off Control Considerations. On/Off Control Forms the basis of most robotics operations Is deceptively simple until the consequences.
BEGINNER PROGRAMMING Lesson
GIRLS Robotic Camp. Let’s Begin Meet and Greet – Camp leaders introduce themselves – Students introduce themselves.
Adapted for STLP Camp ‘09 Mobile Robots Why do robots need to move?
Robot Sensors Kevin Watson and Rich Petras. Overview ➲ Sensors ● Micro Switch ● Gyro ● Encoders ➲ Command Sequencing ➲ PID Control.
Reactive robots UPNA The Public University of Navarra Material for pupils & students.
Human Vision Robot (Light Sensor) Vision White/Light: 100 Black/Dark: 0 Colors:
Using Waits, Loops and Switches WAIT please!. Waits, Loops and Switches Pre-Quiz 1. In programming, what is a loop? When is a loop useful? 2. How can.
ICE at Georgia Tech Robots and Artificial Life Forms An NXT Zoo! Mr. Michaud
Sentry System Multiple Sensors
By Droids Robotics Line Followers: Basic to Proportional ADVANCED EV3 PROGRAMMING LESSON © 2015 EV3Lessons.com, Last edit 4/5/
Conditions and loops Day 4 Computer Programming through Robotics CPST 410 Summer 2009.
Lego MindStorm An Introduction to Blocks. Blocks Blocks are used to give instructions to your robot. There are many types of blocks You can use the blocks.
Castor Bot. Now, we will begin creating a robot Log onto your computer On your screen, click on the website labeled “castor bot” Your building instructions.
Find the Mindstorms Icon on the computer.. To start a new program click go.
By Eric Greene RMS / I. S. 192 Q. Smart Start Question How would you get the robot to flirt with disaster by touching the edge of the “table” as many.
Robotics NXT-G: variables, file Rotation sensor Lab: Use buttons to hit specific ball. Homework: Postings. Start planning mapping the room.
LEGO® MINDSTORMS® NXT Move Block.
Programming 101 The Common Palette Content provided by Connor Statham (9 th Grade Student) Formatting by Shannon Sieber.
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.
How to make a Line Follow program Using EV3 software and an NXT light sensor.
Automation and Robotics.  First you select the platform type so that you can use Natural Language PLTW.
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.
MEH108 - Intro. To Engineering Applications KOU Electronics and Communications Engineering.
Lego Mindstorm Robots 9797 kit.  Students will learn how to identify how to detect a change in a condition.  Students will learn where and how to identify.
Forward Until Near Stop when near a wall.
© 2006 Carnegie Mellon Robotics Academy Designed for use with the LEGO MINDSTORMS ® Education NXT Software and Base Set #9797 Sentry System Two-Way Communication.
Robotics Training For The Riverside Robotics Society
Deriving Consistency from LEGOs
Mindstorms EV3 Programming
Understanding Communication with a Robot? Activity (60 minutes)
Follow The Guidelines.
By Sanjay and Arvind Seshan
Mindstorms EV3 Programming
Touch Sensor.
Mindstorms EV3 Programming
Loops and Switches Pre-Quiz
Module F: Presentation Understanding Robot Fundamentals
Introductory Presentation
INTERMEDIATE PROGRAMMING LESSON
Better Line Following with PID
BEGINNER PROGRAMMING LESSON
Follow The Guidelines Light Sensor
An Introduction to VEX IQ Programming with Modkit
Beginner Programming Lesson
Line Following Behavior
Introductory Presentation
Storing Values as Variables
By Sanjay and Arvind Seshan
Introductory Presentation
SENSORS.
INTERMEDIATE PROGRAMMING LESSON
By Sanjay and Arvind Seshan
LEGO MINDSTORMS NXT PROGRAMMING
Presentation transcript:

Using the NXT Light Sensor

2 Connect One Light Sensor – 1 From My Files use Left / Right NXT buttons and get to View menu and push Orange button. From View menu use Left / Right NXT buttons and get to Reflected Light menu. From Reflected Light menu use Left / Right NXT buttons to find correct port and push the Orange button.

3 Connect One Light Sensor - 2 Discuss types of readings Example – Compare the floor with the blue tape

Light Sensor Practice 1 Make the robot move forward and stop on the blue tape line.

Light Sensor Practice 1 Here are a couple of methods, both equally right

Light Sensor Practice 2 Make the robot go back and forth between two blue lines of tape. Whether to make the robot back up or turn around is the programmer’s choice.

7 Help the Robot Escape a Box - 1 Could we use the light sensor and our turns to help the robot escape from a mostly closed box? Set up a pattern of blue tape that looks something like this:

8 Help the Robot Escape a Box - 2 Write a program so the robot: Moves Forward Finds the blue border, Turns away And repeats the process until it escapes out the opening From starting anywhere inside the box.

9 Help the Robot Escape a Box - 3 Here’s a program that can work, many others will, too.

Escaping the infinite Spirograph… 1 Some boxes and programmed turn combinations will make the robot get stuck in a pattern: an infinite Spirograph. To get out of this situation: Connect a random value to the steering command for the robot’s turn away from the blue line. This will make each turn different. It will result in some missed opportunities, but also avoids repeated missed escape opportunities.

Escaping the infinite Spirograph… 2 random control added to the turn in this program.

12 Lines as Guides How might we use a line to make the robot go where we want it to?

13 Lines as Guides How might we use a line to make the robot go where we want it to? Need to develop some method to select one action from several options.

14 New Tool for Decisions

15 New Tool for Decisions This view is good for Either / Or decisions

16 New Tool for Decisions This view is good for Multiple Choice

17 More Decisions

18 Body Forward mat

19 Line Following – one approach

Smooth it Out Once line following has been attained and the robots are waddling around the room on their blue lines, challenge the students to smooth out the robot’s motion. Hint: motor power and braking decisions might make a difference.

Audible Feedback -1 To make line following more interesting: connect a data line from the light sensor’s output block to the volume control of a sound block Set the sound block to play a tone for about 1/100 th of a second In both sides of the bang bang line following program Fair warning… this could get loud.

Audible Feedback -2 Here’s an example

23 Line Following – one approach The value we choose for the decision is called the Threshold Value. In this case it = 50

Another Approach… Instead of turning the motors on or off to move along the line, could we make the robot move forward along the line? And correct for errors if it drifted off the line? Perfectly on line  both motors run at 50% power

Another Approach… Perfectly on line  both motors run at 50% power As robot drifts off the line  run motors at different powers to drive it back to the line’s edge Instead of turning the motors on or off to move along the line, could we make the robot move forward along the line? And correct for errors if it drifted off the line?

Take a closer look Edge of line should give a light sensor reading of about 50 Light sensor = 50

Take a closer look Light sensor = 50 Light sensor = 30 Light sensor = 70 Threshold Value = 50 Actual Values

Define the Error Light sensor = 50 Light sensor = 30 Light sensor = 70 Threshold Value = 50 Actual Values Error = Threshold - Actual Error = - 20 Error = 0 Error = 20

How to control the robot’s motors Light sensor = 50 Error = 0 Light sensor = 30 Error = 20 Light sensor = 70 Error = -20 Threshold Value = 50 Actual Values Start with motors going forward at some power level Watch the light sensor values Measure Error = Threshold – Actual Raise or Reduce each Motor’s Power based on the Error

Pseudocode – One Approach Light sensor = 50 Error = 0 Light sensor = 30 Error = 20 Light sensor = 70 Error = -20 Threshold Value = 50 Actual Values Define Variables MotorPower = 50% Threshold = 50 Error = 0 Start Loop Error = Threshold – Actual LeftMotor = MotorPower – Error RightMotor = MotorPower + Error End Loop Desired power = 50%

Sample Proportional Program

Pseudocode – Stronger Light sensor = 50 Error = 0 Light sensor = 30 Error = 20 Light sensor = 70 Error = -20 Threshold Value = 50 Actual Values Improve Responsiveness by Multiplying the Error Define Variables MotorPower = 50% Threshold = 50 Error = 0 Gain (Kp) = 1 (use 1 at first to make sure we did not break the program) Start Loop Error = Threshold – Actual LeftMotor = MotorPower – (Error x Gain) RightMotor = MotorPower + (Error x Gain) End Loop

Sample Proportional with Gain Program

Error ↑ means RightMotor Power ↑ And LeftMotor Power ↓ Forcing the robot back towards the line’s edge while still going forward Another Perspective ↑↓ ↑ ↓

Error ↓ means RightMotor Power ↓ And LeftMotor Power ↑ Forcing the robot back towards the line’s edge while still going forward Another Perspective ↑↓ ↑ ↓

Other Improvements Beyond using proportional control can also: Add the old Error and new Error each loop and use that growth to control the motor power levels This tells how far off the line the robot has drifted (integration) Watch the Error change between each loop and use that to control motor power levels This tells how fast the error is being corrected (differentiation)

37 More Complex Line Following Learn how to combine all three methods in Mr. Jim Sluka's Tutorial on PID Controller for Mindstorms PID = Proportional, Integral, Derivative

Use More than One Light Sensor Follow the line with one sensor Use the other for control

Use More than One Light Sensor Stop when this one reaches the line

Example

Using the NXT Light Sensor