today’s agenda 1.scribbler program assignment 1.project idea due next class 2.program...
TRANSCRIPT
Today’s Agenda
1. Scribbler Program Assignment1. Project idea due next class
2. Program demonstration due Wednesday, June 3
2. Attendance & lab pair groupings
3. Robots– Sensors– Input / Output
4. Lab 10 with Scribbler Robot
Dead Reckoning
isHARD
Move Forward indefinitelyPause for 5 secondsStop
Move Forward for 5 secondsPause for 0.2 seconds
• Flashes the right infrared (IR) emitter– If the center IR detector sees the IR light
reflected back, it reports an object on the right
• Flashes the left IR emitter• If the center IR detector sees the IR light
reflected back, it reports an object on the left
Obstacle Sensor
Scribbler’sHeadlights
If obstacle on left
turn right
Else
If obstacle on right
turn left
Else
go straight
Obstacle Sensor Tips
• Infrared light reflects best off of shiny, light-colored surfaces; it is absorbed by dull, dark colored surfaces
• The Obstacle sensors work best at detecting objects 3” to 8” away
• Obstacle sensors are far from perfect, have a backup plan in case of collision– Obstacle sensors do not work at very close
range (distances of 2 inches or less)
Stall SensorThe Scribbler’s
stall sensor can tell when the motors are running but the wheels are not turning freely 0 or 1(i.e. the Scribbler is stuck)
Go Forward until Stuck!
Move Forward indefinitely
Do While <Motor Not Stalled>{
Pause 0.2 seconds // Moving Forward
}Stop
END Program
Go Forward until Stuck!
Move Forward indefinitely
Do forever If <Motor Stalled> Then Stop End Program Else Pause 0.2 seconds // Moving
Forward
Stall Sensor Tips
• The Stall sensor detects if the robots has bumped against something– Navigation by bumping into things.
This is similar to a person entering a dark room and then trying to feel their way by touching or bumping slowly into things.
• The Stall sensor is Binary: there is no way to tell if the bump was on the left or right
Stall Sensor Tips #2
• The motor must be running for Scribbler to stall– Use Move Forward indefinitely– Move Forward for 1 second will not work
• Every time you issue a Move instruction, the Stall sensor resets itself– For best results, insert a short pause
after every Move instruction before checking the Stall sensor
• The Scribbler has three photoresistor light sensors on front of the robot– The center sensor looks straight ahead– The other two sensors look 30 degrees to each
side.
• Their positioning allows Scribbler to use its photoresistors to navigate towards or away from light
Light Sensors
Do forever
Pause for 0.2 seconds
If <Light from Ahead> Then Move Forward for 1 second Else If <Light from Left> Then Turn Left for 1 second
Else If <Light from Right> Then Turn Right for 1 second
Else // no light – do nothingEND
Follow theLight
Light Sensor Tips
• There appears to be a lot of leakage of light into the Scribbler robot– Use SCP’s Sensor Monitor to get a
feeling for Scribbler’s light sensor readings
• You can cover Scribbler completely with its white box to block out all light– The sensors should read near zero
• On the bottom of Scribbler are – two Infrared
Emitters and
– two Infrared Detectors
• These allow Scribbler to see a dark line on a light background
Line Sensors
Line Sensor Tips
• Line sensors are binary sensors: – 0 is white– 1 is black– Other colors are detected
as either white or black
• For best results, Use white paper with thick black lines (at least one inch)
• Line sensors are precisely positioned and work best on a smooth, hard, flat surface
Scribbler I/O
Input• Sensors
– Infrared obstacle sensor– Stall sensor– Three photoresistor
light sensors– Two infrared Line
sensors• Red reset button
Output• Motors &Wheels• Three LED’s• Speaker