ORTOP NXT Robotics Techniques Workshop 2012 “Opening doors to the worlds of science and technology for Oregon’s youth” 6/22/12 NXT Robotics Techniques 2012 1 Goals • Audience: Rookie and experienced coaches and mentors • Build confidence using more advanced navigation techniques • Gain experience with 3 motor robot and missions • You should have already attended NXT workshops I & II and/or coached a team in 2011 tournament 6/22/12 NXT Robotics Techniques 2012 2 Instructor Contacts • Ken Cone • kencone@gmail.com • 503-415-1465 • Jim Ryan • james.r.ryan@intel.com • 971-215-6087 • Terry Hamm • Terry.hamm@gmail.com • (503) 720-5157 • Roger Swanson • swanson@hevanet.com • 503-297-1824 • Dale Jordan • Dale_A_Jordan@msn.com 6/22/12 NXT Robotics Techniques 2012 3 Agenda • Robot Design – Building strong structures – Gears – Motors • Navigation – Going straight – Turning accurately • Sensors – Light sensor and calibration – Distance sensor • Mission Planning & The Buoy Mission • Next Steps 6/22/12 NXT Robotics Techniques 2012 4 Robot Design • What engineering problems are we trying to solve? – Understanding each mission – Building a robot to move objects around on a playing field – Other ideas? • Observe workshop robot noting: – – – – – 6/22/12 Complexity Sensors – location with respect to wheels Control panel Beam & pin structural design What differences exist between this robot design and others you have seen? NXT Robotics Techniques 2012 5 Engineering Design Process Define the Problem Research the Problem Redesign Develop Possible Solutions Communicate Test and Evaluate Choose the Best Solution Create a Prototype 6/22/12 NXT Robotics Techniques 2012 6 Building Strong Structures – Note: parts are all pinned together using Technic pins & beams – Here are three cross bracing examples • Note: 3-4-5 Pythagorean theorem – Ref: Minnesota High Tech Kids • http://www.hightechkids.org/for-teams/coacheslibrary – 2 inch drop test 6/22/12 NXT Robotics Techniques 2012 7 Gears • Gears – Spur Gear (show example) • instructor holds beam • class person turns axles and feels torque on other axle • tactile feedback = learning about gears and torque – Gear Ratio and Speed • turn the large gear one complete turn • How may revolutions does the small gear turn? • Is gear ratio the same as the ratio of gear teeth? 6/22/12 NXT Robotics Techniques 2012 8 Gears • Gears & Pulleys – Worm Gears (show example) • one way transfer of power – Crown & Bevel Gears • turn 90 degrees – Spur Gears • change direction & change torque – Note gears used on workshop robot fork lift 6/22/12 NXT Robotics Techniques 2012 9 Robot Design • Three motor base – Level, square – Screen location • Attachments – Soda can pusher – Fork 6/22/12 NXT Robotics Techniques 2012 10 Robot Design • Mission Attachments – – – – – – – Measure all mission items Grabbers – e.g. to catch food factor truck & trailer Pushers/pullers – e.g. food factor fish Caribiners /hooks - locks onto item Carts – for collecting or delivering mission items Use of 3rd motor – for a grabber or fork lift Can we group missions together using one attachment? • Mission Planning – Use a chart/drawings to show attachments used on each mission, more on this topic in the next segment. – Any questions on robot design? 6/22/12 NXT Robotics Techniques 2012 11 ORTOP FLL Workshop 3 Navigation Sometimes the robot does not go where you want it to. Has this ever happened to you? In this segment, let’s explore basic robot move and turn accuracy. Here is an example mission… 6/22/12 NXT Robotics Techniques 2012 12 Mission: Insert Stent into Artery Moves: • • • • • • • 6/22/12 NXT Robotics Techniques 2012 Start box to ball Turn left 40 deg Ball to black line Turn left 70 deg Follow black line for 5 sec Can this mission run successfully 5 times?? What factors influence move and turn accuracy? 13 Navigation • Let’s do a simple “Going Straight” lab test to understand how the robot moves: – Tape down 2 pieces of paper on the table, 2 feet apart – Draw a starting line on one paper – Create a simple program to move 2 feet then stop – Run speeds at 20, 50, 90 – Use a “soda can pusher” or similar attachment on the front of the robot – Run test 5-10 times – Mark a large dot where front “can pusher” arm stops – Begin test now 6/22/12 NXT Robotics Techniques 2012 14 Navigation • Going Straight test: – Run test 5-10 times, record results – Draw box around landing points – What does the box tell us? • Goal: To understand how the robot moves – its accuracies and inaccuracies • We can then compensate for inaccuracies with other techniques – Examples: use a wide fork for the buoy mission, or a wide soda can pusher 6/22/12 NXT Robotics Techniques 2012 15 Navigation • Theory - The S curve inaccuracy: – A Move block rotates both wheels to the programmed position using built-in rotation sensors as feedback – If one wheel slows down, the other wheel slows down, causing the robot to move in a lazy S curve • Did you observe this in your going straight lab tests? 6/22/12 NXT Robotics Techniques 2012 16 Navigation • Compensation for navigational errors – “reset to zero” • Use mechanical means – Angled corners (back into a corner) – Wall follower (wheel) – Back against a wall • Use sensors – Light & touch to “reset to zero” and re-establish the exact robot location 6/22/12 NXT Robotics Techniques 2012 17 Navigation • Variables that affect going straight: – Starting box position – Speed – Battery charge – Tire size – Motor friction, gear backlash (Google these terms) – NXT software tries to keep both wheels moving at same rate – What is distinct about the last two variables? 6/22/12 NXT Robotics Techniques 2012 18 Navigation • Turning Accuracy <<<Move block slider >>> – Lets review two types of turns • Spin Turn – Position Move block slider all the way to the LEFT or RIGHT – A spin turn uses 2 wheels, one forward, one backward - robot “spins” around center point between the wheels 6/22/12 NXT Robotics Techniques 2012 19 Navigation • One Wheel Turn – Use Move block, turn one motor off – One wheel moves, one is stationary – robot turns around the stationary wheel One wheel turned off • Which turn is more accurate? • Where could we use the spin turn? 6/22/12 NXT Robotics Techniques 2012 20 Navigation • Extra Credit – Program a move-turn sequence – Use “spin” turns and “one-wheel” turns – Place a pencil mark where robot stops – Run program 5-10 times and collect data • Variables – Left-right error – Turn angle error – Any more variables? 6/22/12 NXT Robotics Techniques 2012 21 Navigation • Review: – Use navigation and “reset to zero” to know where robot is at all times – Understand variables and how they influence robot movement. We learned left-right moves are less accurate than front-back moves. – Long dead reckoning moves are ok, if robot/attachments can compensate for move inaccuracies, e.g. • Width of can pusher, width of buoy pickup fork • Backing into wall or corner to re-align robot • Go for simple & sufficient solution 6/22/12 NXT Robotics Techniques 2012 22 Sensors • Now that we know how to move and turn with some precision, lets take a look at sensors • Sensors we can use in FLL: – touch, light, rotation, distance • Teams sometimes give up on sensors because they seem complex and don’t seem to work in a predictable manner • But, we all use the built-in rotation sensors in the motors to tell us the number of rotations/degrees • Let’s explore the light sensor to help us navigate on the playing field 6/22/12 NXT Robotics Techniques 2012 23 Sensors • Let’s take a detailed look at the light sensor (LS) – Connect LS to NXT brick – use port 3 – Create a program to turn on LS and read values, use yellow LS icon, add a 5 sec wait to keep the LS on for a few seconds while you read values – Read LS values: click LS icon, read value in LS control panel – Mount the LS about 3/8 inch from the mat and observe Black, Green, and White values 6/22/12 NXT Robotics Techniques 2012 24 Sensors • Let’s look at LS-to-mat distance & record some data: – Mount LS on the robot about 1/8” from the mat – Record Black, Green, & White values – Move the LS to 3/8” from the mat, record values – How does the distance affect LS values? – As the robot moves, it bounces. Which distance do you think would work best, and why? LS # _____ Black Green White Calculated trigger point 1/8” from mat 3/8” from mat 6/22/12 NXT Robotics Techniques 2012 25 Sensors • Now let’s record some more data: – Use your hand to cover the LS to simulate a dark room – Record Black, Green, & White values – Trigger point is halfway between white & black, we will come back to this calculation – What does this tell us about LS performance in various room lighting conditions? Black Green White Calculated trigger point LS-1 uncovered LS-1 covered 6/22/12 NXT Robotics Techniques 2012 26 Sensors • Theory: Light sensor returns values of reflected light – E.g. white = 63 – Trigger point (programmed) = • (( white – black) / 2) + black – black = 34 – Trigger point example: ((63-34) / 2) + 34 = – Take a minute and calculate trigger points on previous slides 6/22/12 NXT Robotics Techniques 2012 27 Sensors • • • Now lets use what we learned in a program.. Theory: sensor “wait until” program action (orange hour glass icons) Program example: – Runs the Move block, – Waits on the Light Sensor block, Until sensor trigger point is crossed, – Continues to the next program step • • What does this program do? What is the purpose of the third block? • Note: – Don’t forget to select less than< or greater than> on the control panel W63 Trigger point – – B33 6/22/12 NXT Robotics Techniques 2012 28 Sensors • Data from 7 light sensors - uncalibrated, room light on • What trigger point would we use to stop on black? On green? 80 Uncal room light on 70 Uncal value 60 50 Black 40 Green 30 White 20 10 0 0 1 2 3 4 5 6 7 8 Sensor number 6/22/12 NXT Robotics Techniques 2012 29 Sensors • Calibration: A process to compensate for varying lighting conditions 120 • Data from two light sensors – uncalibrated, calibrated 100 LS1Cal LS2Cal 80 BLACK LS2Uncal 60 GREEN LS1Uncal LS1Cal 40 WHITE LS2Uncal LS1Uncal LS2Cal LS2Uncal LS1Uncal 20 0 6/22/12 LS1Cal NXT Robotics Techniques 2012 LS2Cal 30 Sensors • Example: Light Sensor Calibration Blocks – Program Steps: • • • • • • • • Turn on light sensor Say “white” Wait 3 seconds to position sensor over white area Sample and store the “white” value Say “Black” Wait 3 seconds to position sensor over black area Sample and store the “black” value Wait 1 second and end the program – Why is this important? • Calibrating the light sensor provides widest range of values between white and black, making it easier to use the sensor in a variety of lighting conditions 6/22/12 NXT Robotics Techniques 2012 31 Sensors • Using the internal calibration program • • • • • • Connect NXT brick to your computer, and make sure MINDSTORMS is running. Verify the NXT is properly connected, click “NXT Window” in lower right corner of screen, click “Scan” and “Connect” and “Close” On the upper left corner, click “Tools” and “Calibrate Sensors” To Un-calibrate the NXT: – Click “Port3”, “Default”, and “Refresh”. Important: If you calibrate one of the workshop robots, please “un-calibrate” it before leaving class. To Calibrate, do the following: – – – – 6/22/12 Select the light sensor and the port the sensor is connected to. Then click the Calibrate button. This will download a small program to the NXT and run it automatically. On the NXT’s screen you will see text that reads “Min Value:”. Point the light sensor towards a material or spot that represents what the light sensor should measure as dark. Press the orange Enter button on the NXT. Next you will see text that reads “Max Value:”. Point the light sensor towards a material or spot that represents the brightest location the sensor will encounter during the program. Press the orange Enter button again. Calibration is complete. Caution: After Calibration, read light sensor values from the Light Sensor program block to determine trigger points. Do not use NXT View function, View gives incorrect values for calibrated light sensors. NXT Robotics Techniques 2012 32 Sensors • Extra Credit – The Color Light Sensor • • • • • • See Color Sensor Block “?” for programming details Detects color(s) within a defined range Also works as black & white light sensor Our tests show it works better for detecting black lines Color sensor does not require calibration when detecting colors Review how to set “stop on black” • • • • Example: Turn on B motor “Wait until” color red Stop B motor • Use Color Lamp Block – for turning on/off RGB lamps 6/22/12 NXT Robotics Techniques 2012 33 Sensors • Mounting LS on the robot: – Front center – detect line or follow line to target – If LS is too close to turning center, then robot wobbles – Distance to the mat, shoot for about 3/8” to avoid false triggers with small bumps in mat – room light influence, LS is buried inside robot or out in open • Extra Credit: – What changes to the LS mounting would you recommend? – When could we use two sensors? – Review LS help sections in NXT-G 6/22/12 NXT Robotics Techniques 2012 34 Sensors • Homework assignment: – Add a “Wait for Distance” block – Program the robot to stop at 4 inches – Shape and texture of target object is important • This completes the four sensors: 1. Rotation 2. Touch 3. Light 4. Distance • Questions on Sensors? 6/22/12 NXT Robotics Techniques 2012 35 ORTOP FLL Workshop 3 The Buoy Mission In this segment: • Use a Mission Planning Sheet • Plan moves, turns, & attachments • Program the robot • Win the points! s 6/22/12 NXT Robotics Techniques 2012 36 The Buoy Mission • Engineering Problem: – Pick up and carry the buoy from its current position, – Place it in the box at the end of the mission board, – Park the robot on the blue finish line • • 6/22/12 Note the box has a fence in front, so to score points you must lift the buoy over the fence and into the box. Extra credit points for detecting the fence using the distance sensor. First, write a mission plan (moves, turns & attachments), then write a program to execute your plan NXT Robotics Techniques 2012 37 Mission Planning Sheet Mission(s):______________________________________ Maximum Score: _________ Program Name: __________________Memory size: ____ Time to run: _____________ Plan Overview: ___________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ Starting Position:__________________________________________________________ _______________________________________________________________________ _ Sensors Used (Port): __________(___), __________(___), __________(___) __________(___), __________(___), __________(___) Navigation Details:________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ _______________________________________________________________________ 6/22/12 NXT Robotics Techniques 2012 38 Buoy Mission End here s Place buoy here Start here 6/22/12 NXT Robotics Techniques 2012 39 Next Steps • Register your team with FLL • Share with your team – NXT Robotics Techniques slides – Mindstorms NXT Tutorial (Dale Yocum) • www.ortop.org/NXT_Tutorial – Build and test 2-3 robot designs, then have your team select a hybrid of best features – Project resource video: Google FLL project dvd, should find: www.youtube.com/watch?v=LFBBnyz8syM • Challenge the kids! – Make up your own exercises – stress basics and repeatability • Fill out workshops survey, let us know highlights, lowlights, changes, keeps www.ortop.org/workshopsurvey/ • Good Luck and thanks for being a coach/mentor! 6/22/12 NXT Robotics Techniques 2012 40