180 likes | 193 Views
In this lab work, you will create and show your program for a robot that uses a light sensor to follow a line. Learn how to calibrate the sensor and explore reverse engineering. Homework assignments and postings included.
E N D
Robotics Light sensor. Calibration. Reverse engineering challenge. Lab work: Create and show your program. Add light sensor (different orientations). Robot moves with light. Robot follows line. Homework: Postings.
Light sensor • Detects ambient (surrounding) light • Calibration establishes minimum and maximum values • Set block at specified level and comparison (greater or less than) and sensor returns true if and only comparison is true. • Can be set to generate light and (therefore) measure the reflection.
Light sensor blocks • Wait for light to be more (or less) than specified levelOR • Sense light (and keep going). • Data links inputs: • Port • Level • Less or more • Generate light or not • Data links outputs: • Intensity (scale 0 to 100) • Raw scale (0 to 1024)
Calibration • There are default values, but it is HIGHLY RECOMMENDED that you set those values based on actual room conditions. • 2 ways • Connected to computer using Tools/Calibrate Sensors • Create calibration code/phase in program • Gives chance to place robot (light sensor) on minimum • Gives chance to place robot (light sensor) on maximum
Calibration procedure using computer • Connect NXT to computer • Tools/Calibrate Sensors downloads a program • On NXT, follow instructions • Place with sensor on minimum value, press Enter • Place with sensor on maximum value, press Enter
Calibration block on NXT • Download program with calibration block. • NOTE: requires use of touch sensor • Aside: need to ‘mesh’ your reading of program with assumptions on actions.
Wait for left button on NXT Calibrate minimum value position robot position robot
Use calibrated value and enter key Need to abort program using button
Reverse engineering test • Shine beam of light • Place robot (with light sensor) • Program: intensity going to power. Motors are turning…
What does the robot do? • Guess • Try it!
Lab • Your program involving sound and bump/touch sensor.
Lab exercises • Add light sensor to basic robot • Write, download and test calibration program • Write, download and test “sense and display” program (two variations shown) • calibrated scaled value versus raw value. • button versus time • Follow line • Note: program for this given in Mindstorms program
Homework • Postings • Examine links on AI • [Start] thinking about your library research project.