Presentation based on Robotics with the BoeBot Parallax
Presentation based on: “Robotics: with the Boe-Bot" Parallax, Inc. www. parallax. com 599 Menlo Drive Suite 100 Rocklin, CA 95765 1
Copyrights and Trademarks This documentation is copyright 2004 by Parallax, Inc. By downloading or obtaining a printed copy of this documentation or software you agree that it is to be used exclusively with Parallax products. Any other uses are not permitted and may represent a violation of Parallax copyrights, legally punishable according to Federal copyright or intellectual property laws. Any duplication of this documentation for commercial uses is expressly prohibited by Parallax, Inc. Duplication for educational use is permitted subject to the following conditions: Parallax grants the user a conditional right to download, duplicate, and distribute this text without Parallax's permission. This right is based on the following conditions: the document, or any portion thereof, may not be duplicated for commercial use; it may be duplicated only for educational purposes when used solely in conjunction with Parallax products, and the user may recover from the student only the cost of duplication. BASIC Stamp, Stamps in Class, and Board of Education are registered trademarks of Parallax, Inc. If you decide to use the names BASIC Stamp, Stamps in Class, and/or Board of Education on your web page or in printed material, you must state that "BASIC Stamp is a registered trademark of Parallax, Inc. , " "Stamps in Class is a registered trademark of Parallax, Inc. , " and/or "Board of Education is a registered trademark of Parallax, Inc. , " respectively, upon the first appearance of the trademark name. Other brand product names are trademarks or registered trademarks of their respective holders. 2
What's New In Robotics ü New Servos • Adjustable potentiometer • Faster, quieter, draw less power ü New Board of Education • Power Switch • Jumper ü New Wheels and Tires ü New Whiskers ü New Infrared Emitters ü New Text – v 2. 0 3
Select the Servo Power Supply ü New jumper - connects servo power to either • Vin – Battery Voltage • Vdd – Regulated 5 V supply ü Select Vin for use with 4 AA batteries ü Pull jumper off pins, then push onto Vin pin 4
Center the Boe-Bot Servos ü Plug the battery pack into the BOE • Note the correct polarity ü Plug the servos in to the BOE • Important!! Black wire closest to breadboard! ü Turn the switch to Position 1 ü Enter and Run "Center. Servo. P 12. bs 2" pg. 65 ü Repeat for "Center. Servo. P 13. bs 2" pg. 66 5
Center the Boe-Bot Servos ü Move the switch to Position 2 ü If the servos do not stay still, adjust them with your Parallax screwdriver • Do not push too hard • Use the Phillips end ü Adjust each servo so it stays completely still 6
Build the Boe-Bot ü Build the robot by following instructions from your manual (pages 85 -99) 7
Build the Start/Reset Indicator ü Brownout • Batteries drop below 5. 2 V • Brownout detector circuit resets the BASIC Stamp • Program starts over from beginning ü Low Battery Indicator • Add speaker to Boe-Bot • "Beep" first thing in program ü If Boe-Bot beeps during navigation, must have reset ü Thus batteries are low 8
Test the Low Battery Indicator ü Run "Start. Reset. Indicator. bs 2" ü Test by pressing the Reset button on the BOE ü Should beep each time reset DEBUG CLS, "Beep!!!" FREQOUT 4, 2000, 3000 ' Display while speaker beeps. ' Signal program start/reset. DO DEBUG CR, "Waiting for reset…" PAUSE 500 LOOP ' DO. . . LOOP ' Display message ' every 0. 5 seconds 9
Servo Positioning ü Direction • Determined by the width of the pulse ü Distance • Each pulse causes the servo to rotate a small amount ü Speed • Maximum at 1. 3 and 1. 7 ms. • Decreases as approaches 1. 5 ms Pulse Width Direction of Rotation PULSOUT Period 1. 3 ms Clockwise 650 1. 5 ms Stopped 750 1. 7 ms Counter-clockwise 850 10
Controlling Distance ü Run "Boe. Bot. Forward. Three. Seconds. bs 2" ü Follow the instructions on p. 118 to make the Boe-Bot go half as far forward ü Add code to make the Boe-Bot go backward, left, and right, as shown on pages 119 -120 FOR counter = 1 TO 122 PULSOUT 13, 850 PULSOUT 12, 650 PAUSE 20 NEXT 11
EEPROM Navigation ü Run "EEPROMNavigation. bs 2" p. 141 ü Modify the DATA directive to make your own motion sequence • DATA "FFFBBLFFRFFQ" F = Forward, B = Backward, L = Left, R = Right, Q = Quit address instruction ' ' DATA DO VAR Byte Address: 0123456789 ||||| "FLFFRBLBBQ" READ address, instruction address = address + 1 SELECT instruction CASE "F": GOSUB Forward CASE "B": GOSUB Backward CASE "L": GOSUB Left_Turn CASE "R": GOSUB Right_Turn ENDSELECT LOOP UNTIL instruction = "Q" 12
Tactile Navigation with Whiskers Activities: ü Building and Testing the Whiskers • Page 154 -165 • See also wiring diagram next slide 13
Build the Whisker Circuit 14
Testing the Whiskers ü Run "Test. Whiskers. bs 2" p. 160 ü Press on each whisker and examine the Debug Terminal output. ü Each whisker should display 1 when not pressed, 0 when pressed. ü Position the whisker wires to make good contact with the headers DEBUG "WHISKER STATES", CR, "Left Right", CR, "------" DO DEBUG CRSRXY, 0, 3, "P 5 = ", BIN 1 IN 5, " P 7 = ", BIN 1 IN 7 PAUSE 50 LOOP 15
Navigation With Whiskers ü Run "Roaming with Whiskers. bs 2" ü Compare with pushbuttons exercise from the previous day DO IF (IN 5 = 0) AND (IN 7 = 0) THEN GOSUB Back_Up GOSUB Turn_Left ELSEIF (IN 5 = 0) THEN GOSUB Back_Up GOSUB Turn_Right ELSEIF (IN 7 = 0) THEN GOSUB Back_Up GOSUB Turn_Left ELSE GOSUB Forward_Pulse ENDIF LOOP ' Both whiskers detect obstacle ' Back up & U-turn (left twice) ' Left whisker contacts ' Back up & turn right ' Right whisker contacts ' Back up & turn left ' Both whiskers 1, no contacts ' Apply a forward pulse ' and check again 16
Navigation with Infrared Headlights Activities: ü Understanding Infrared Object Detection ü Building and Testing the IR Circuit ü Object Detection and Avoidance in Real-Time 17
Using Infrared Headlights to See the Road ü IR reflect off obstacles ü IR LED emits light in infrared region (780 nm) ü Detector shows "0" if detects IR, "1" otherwise ü Detector tuned to 38, 500 Hz only 18
Building and testing the IR Pairs ü Run "Test. Left. Ir. Pair. bs 2" ü Follow directions on p. 223 to test right IR pair 19
How the IR Test Program Works ' Robotics with the Boe-Bot - Test. Left. Ir. Pair. bs 2 ' Test IR object detection circuits, IR LED connected to P 8 ' and detector connected to P 9. ' {$STAMP BS 2} ' {$PBASIC 2. 5} ir. Detect. Left DO VAR Bit FREQOUT 8, 1, 38500 ir. Detect. Left = IN 9 DEBUG HOME, "ir. Detect. Left = ", BIN 1 ir. Detect. Left PAUSE 100 LOOP 20
Object Detection and Avoidance ü Run "Roaming. With. Ir. bs 2" IF (ir. Detect. Left = 0) AND (ir. Detect. Right = 0) THEN GOSUB Back_Up GOSUB Turn_Left ELSEIF (ir. Detect. Left = 0) THEN GOSUB Back_Up GOSUB Turn_Right ELSEIF (ir. Detect. Right = 0) THEN GOSUB Back_Up GOSUB Turn_Left ELSE GOSUB Forward_Pulse ENDIF ü Place the Boe-Bot on the floor ü Your Boe-Bot should roam around avoid objects 21
Fast IR Roaming ü Run "Fast. IRRoaming. bs 2" ü Again the Boe-Bot should roam around avoid objects ü Observe: How does this behavior differ from that of "Roaming. With. Ir. bs 2"? IF (ir. Detect. Left = 0) AND (ir. Detect. Right = 0) THEN pulse. Left = 650 pulse. Right = 850 ELSEIF (ir. Detect. Left = 0) THEN pulse. Left = 850 pulse. Right = 850 ELSEIF (ir. Detect. Right = 0) THEN pulse. Left = 650 pulse. Right = 650 ELSE pulse. Left = 850 pulse. Right = 650 ENDIF 22
Understanding Filter Sensitivity 23
Testing Distance Detection ü Run "Test. Left. Frequency. Sweep. bs 2" ü Place the Boe-Bot in front of some obstacle (Wall, book, etc) ü Observe the readings change as you move the Boe-Bot closer to and further away from the obstacle 24
Boe-Bot Shadow Vehicle ü Follow the detailed instructions on p. 259 -260 ü In summary: • • Run "Following. Boe. Bot. bs 2" Place a sheet of paper in front of your Boe-Bot Move the paper around The Boe-Bot should follow the paper at a constant distance ü If the Boe-Bot backs away instead, contact the instructor for assistance. Your right/left servos are probably reversed. 25
Boe-Bot Follow-the-Leader ü Place sticky notes on the back of all Boe-Bots ü Now select two or three Boe-Bots from the class to be "Leader" Boe. Bots ü Create "Leader" Boe-Bots by following the instructions on p. 263 ü All other Boe-Bots keep the previous program, "Following. Boe. Bot. bs 2" ü The "Shadow" Boe-Bots will follow the "Leader" Boe-Bots ü See how many Boe-Bots will follow in a row, like a train 26
Following a Stripe ü Create Stripe-Following Boe-Bots ü Follow the instructions on pp. 264 -271 ü Make sure to point IR pairs downward as detailed in text 27
Focus on Proportional Control ü The Boe-Bot will follow a moving object by maintaining a constant distance from it. The amount of correction is directly proportional to the error. That is, the Boe-Bot will speed up or slow down a varying amount, depending on how far away the object is. Distance Reading Meaning Left Wheel PULSOUT Wheel Direction Robot motion 0 Far Away 650 Clockwise Backward fast 2 Desired distance 680 Clockwise Backward slow 5 Very close 750 Stopped 820 Counterclockwise Forward slow 850 Counterclockwise Forward fast 28
Proportional Control Block Diagram Desired Distance Measured Distance Boe-Bot is… What to do… Error Output Adjustment Left Servo Output Robot Motion 2 4 A bit too close Go backward 2– 4 = -2 -35 * -2 = -70 750 + (-70) = 680 Backwards slow 2 5 Much too close Go backward 2 -5 = -3 -35 * -3 = -105 750 + (-105) = 645 Backwards fast 2 1 Much too far away Go forward ? ? 2 2 A bit too far away ? ? ? 29
The End We hope you enjoyed this Educator's Course Don't hesitate to contact us for any reason! 30
- Slides: 30