Robotics Light sensor. Calibration. Reverse engineering challenge. Lab work: Create and show your...

18
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.

Transcript of Robotics Light sensor. Calibration. Reverse engineering challenge. Lab work: Create and show your...

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

Tools menu

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 valueposition

robotposition robot

Need to abort program using button

Use calibrated value and enter key

Use raw value (0 to 1024) and time

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.