Robot Autonomous Robots - Pearsoncmg

Transcription

RobotProgramming: AGuide to ControllingAutonomousRobotsCameron HughesTracey Hughes800 East 96th StreetIndianapolis, Indiana 46240

ROBOT PROGRAMMING: A GUIDETO CONTROLLING AUTONOMOUSROBOTSEditor-in-ChiefGreg WiegandExecutive EditorRick KughenCopyright 2016 by Pearson EducationAll rights reserved. Printed in the United States of America. This publication isprotected by copyright, and permission must be obtained from the publisherprior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, request forms, and theappropriate contacts within the Pearson Education Global Rights & PermissionsDepartment, please visit www.pearsoned.com/permissions/. No patent liability is assumed with respect to the use of the information contained herein.Although every precaution has been taken in the preparation of this book, thepublisher and author assume no responsibility for errors or omissions. Nor isany liability assumed for damages resulting from the use of the information contained herein.Senior AcquisitionsEditorLaura NormanDevelopment EditorWilliam AbnerTechnical EditorJohn BaichtalManaging EditorSandra SchroederISBN-13: 978-0-7897-5500-1Project EditorISBN-10: 0-7897-5500-9Mandie FrankLibrary of Congress Control Number: 2015955656First Printing: May 2016TrademarksAll terms mentioned in this book that are known to be trademarks or servicemarks have been appropriately capitalized. Que Publishing cannot attest to theaccuracy of this information. Use of a term in this book should not be regardedas affecting the validity of any trademark or service mark.Warning and DisclaimerCopy EditorGeneil BreezeIndexerKen JohnsonProofreaderGill Editorial ServicesEvery effort has been made to make this book as complete and as accurate asEditorial Assistantpossible, but no warranty or fitness is implied. The information provided is onCindy Teetersan “as is” basis. The authors and the publisher shall have neither liability norresponsibility to any person or entity with respect to any loss or damages aris-Cover Designering from the information contained in this book.Chuti PrasertsithSpecial SalesCompositorFor information about buying this title in bulk quantities, or for specialBronkella Publishingsales opportunities (which may include electronic versions; custom coverdesigns; and content particular to your business, training goals, marketingfocus, or branding interests), please contact our corporate sales departmentat corpsales@pearsoned.com or (800) 382-3419.For government sales inquiries, please contact governmentsales@pearsoned.com.For questions about sales outside the U.S., please contact intlcs@pearson.com.

CONTENTS AT A GLANCEIntroduction11 What Is a Robot Anyway? 92 Robot Vocabularies 333 RSVP: Robot Scenario Visual Planning 474 Checking the Actual Capabilities of Your Robot 735 A Close Look at Sensors 916 Programming the Robot’s Sensors 1157 Programming Motors and Servos 1598 Getting Started with Autonomy: Building Your Robot’s Softbot Counterpart 2199 Robot SPACES 24110 An Autonomous Robot Needs STORIES 26511 Putting It All Together: How Midamba Programmed His First Autonomous Robot 30712 Open Source SARAA Robots for All! 343A BURT’s Gotchas 351Index357

CONTENTSIntroduction1Robot Programming Boot Camp 2Ready, Set, Go! No Wires or StringsAttached 2Boot Camp Fundamentals 3Core Robot Programming Skills Introducedin This Book 4BURT—Basic Universal RobotTranslator 4BRON—Bluetooth Robot OrientedNetwork 6Giving the Robot Instructions 25Every Robot Has a Language 25Meeting the Robot’s LanguageHalfway 27How Is the Robot ScenarioRepresented in Visual ProgrammingEnvironments? 30Midamba’s Predicament 30What’s Ahead?2 Robot VocabulariesHow Midamba Learned to Program aRobot 71 What Is a Robot Anyway?9The Seven Criteria of Defining a Robot 10Criterion #1: Sensing theEnvironment 11Criterion #2: Programmable Actions andBehavior 11Criterion #3: Change, Interact with, orOperate on Environment 11Criterion #4: Power Source Required 11Criterion #5: A Language Suitable forRepresenting Instructions and Data 12Criterion #6: Autonomy Without ExternalIntervention 12Criterion #7: A Nonliving Machine 13Robot Categories 13What Is a Sensor? 16What Is an Actuator? 17What Is an End-Effector? 18What Is a Controller? 19What Scenario Is the Robot In? 2333Why the Additional Effort? 34Identify the ActionsAssumptions About the Reader’sRobot(s) 63238The Autonomous Robot’s ROLL Model 39Robot Capabilities 41Robot Roles in Scenarios andSituations 42What’s Ahead? 443 RSVP: Robot Scenario VisualPlanning 47Mapping the Scenario 48Creating a Floorplan 49The Robot’s World 52RSVP READ SET 53Pseudocode and Flowcharting RSVP 56Flow of Control and ControlStructures 60Subroutines 64Statecharts for Robots and Objects 66Developing a Statechart 68What’s Ahead? 72

4 Checking the Actual Capabilitiesof Your Robot 73Digital Cameras Used to Detect and TrackColor Objects 124The Reality Check for theMicrocontroller 76Tracking Colored Objects with RSMedia 124Sensor Reality Check 79Determine Your Robot’s SensorLimitations 81Tracking Colored Objects with the PixyVision Sensor 128Training Pixy to Detect Objects 129Programming the Pixy 130A Closer Look at the Attributes 134Actuators End-Effectors Reality Check 84REQUIRE Robot Effectiveness 87What’s Ahead? 895 A Close Look at Sensors91What Do Sensors Sense? 92Analog and Digital Sensors 95Reading Analog and Digital Signals 97The Output of a Sensor 99Where Readings Are Stored 100Active and Passive Sensors 101Sensor Interfacing withMicrocontrollers 103Attributes of Sensors 107Range and Resolution 108Precision and Accuracy 108Linearity 109Sensor Calibration 110Problems with Sensors 111End User Calibration Process 112Calibration Methods 112What’s Ahead? 1146 Programming the Robot’sSensors 115Using the Color Sensor 116Color Sensor Modes 118Detection Range 119Lighting in the Robot’sEnvironment 119Calibrating the Color Sensor 119Programming the Color Sensor 120Ultrasonic Sensor 135Ultrasonic Sensor Limitations andAccuracy 135Modes of the Ultrasonic Sensor 139Sample Readings 140Data Types for Sensor Reading 141Calibration of the Ultrasonic Sensor 141Programming the Ultrasonic Sensor 143Compass Sensor Calculates Robot’sHeading 153Programming the Compass 154What’s Ahead? 1577 Programming Motors andServos 159Actuators Are Output Transducers 159Motor Characteristics 160Voltage 160Current 161Speed 161Torque 161Resistance 161Different Types of DC Motors 161Direct Current (DC) Motors 162Speed and Torque 165Motors with Gears 167Motor Configurations: Direct and IndirectDrivetrains 177Terrain Challenge for Indoor and OutdoorRobots 178

viRo b o t P ro g ra mmin g : A Guide t o C ont rolling Aut onomous Robot sDealing with Terrain Challenges 179Torque Challenge for Robot Arm andEnd-Effectors 182Calculating Torque and SpeedRequirements 182Motors and REQUIRE 183Programming the Robot to Move 184One Motor, Two, Three, More? 185Making the Moves 186Programming the Moves 186Programming Motors to Travel to aLocation 191Programming Motors UsingArduino 198Robotic Arms and End-Effectors 200Robot Arms of Different Types 201Torque of the Robot Arm 203Different Types of End-Effectors 205Programming the Robot Arm 208Calculating Kinematics 212What’s Ahead? 2168 Getting Started with Autonomy:Building Your Robot’s SoftbotCounterpart 219Softbots: A First Look 222Parts Section 224The Actions Section 224The Tasks Section 224The Scenarios/Situations Section 224The Robot’s ROLL Model and SoftbotFrame 225BURT Translates Softbots Frames intoClasses 227Our First Pass at Autonomous RobotProgram Designs 239What’s Ahead? 2409 Robot SPACES241A Robot Needs Its SPACES 242The Extended Robot Scenario 242The REQUIRE Checklist 245What Happens If Pre/Postconditions AreNot Met? 248What Action Choices Do I Have If Pre/Postconditions Are Not Met? 248A Closer Look at Robot InitializationPostconditions 249Power Up Preconditions andPostconditions 251Coding Preconditions andPostconditions 252Where Do the Pre/Postconditions ComeFrom? 257SPACES Checks and RSVP StateDiagrams 262What’s Ahead? 26310 An Autonomous Robot NeedsSTORIES 265It’s Not Just the Actions! 266Birthday Robot Take 2 266Robot STORIES 268The Extended Robot Scenario 269Converting Unit1’s Scenario intoSTORIES 269A Closer Look at the Scenario’sOntology 271Paying Attention to the Robot’sIntention 282Object-Oriented Robot Code andEfficiency Concerns 304What’s Ahead? 306

C ont ent s11 Putting It All Together: HowMidamba Programmed His FirstAutonomous Robot 307Midamba’s Initial Scenario 307Midamba Becomes a Robot ProgrammerOvernight! 308Step 1. Robots in the WarehouseScenario 310Step 2. The Robot’s Vocabulary andROLL Model for Facility Scenario#1 312Step 3. RSVP for Facility Scenario#1 313Visual Layouts of a Robot POVDiagram 315Midamba’s Facility Scenario #1(Refined) 316Graphical Flowchart Component of theRSVP 317State Diagram Component of theRSVP 324Midamba’s STORIES for Robot Unit1 andUnit2 325Autonomous Robots to Midamba’sRescue 338Endnote 342What’s Ahead? 34212 Open Source SARAA Robots forAll! 343Low-Cost, Open-Source, Entry-LevelRobots 344Scenario-Based Programming SupportsRobot Safety and ProgrammerResponsibility 345SARAA Robots for All 346Recommendations for First-Time RobotProgrammers 348Complete RSVPs, STORIES, and SourceCode for Midamba’s Scenario 349A BURT’s GotchasIndex357351vii

ABOUT THE AUTHORSCameron Hughes is a computer and robot programmer. He holds a post as a SoftwareEpistemologist at Ctest Laboratories where he is currently working on A.I.M. (AlternativeIntelligence for Machines) and A.I.R. (Alternative Intelligence for Robots) technologies.Cameron is the lead AI Engineer for the Knowledge Group at Advanced Software ConstructionInc., a builder of intelligent robot controllers and software-based knowledge components. Heholds a staff appointment as a Programmer/Analyst at Youngstown State University.Tracey Hughes is a senior software and graphics programmer at Ctest Laboratories andAdvanced Software Construction Inc. where she develops user interfaces and information andepistemic visualization software systems. Her work includes methods of graphically showingwhat robots and computers are thinking. She is on the design and implementation teams forthe East-Sidaz robots at Ctest as well.Both Cameron and Tracey Hughes are members of the advisory board for the NREF (NationalRobotics Education Foundation) and members of the Oak Hill Collaborative Robotics MakerSpace. They are project leaders of the technical team for the NEOACM CSI/CLUE RoboticsChallenge and regularly organize and direct robot programming workshops for the Arduino,Mindstorms EV3, LEGO NXT, and RS Media robot platforms. Cameron and Tracey are twoof the authors of Build Your Own Teams of Robots with LEGO Mindstorms NXT andBluetooth, published by McGraw-Hill/TAB Electronics, January 2013. They have written manybooks and blogs on Software Development and Artificial Intelligence. They’ve also writtenbooks on multicore, multithreaded programming, Linux rapid application development, objectoriented programming, and parallel programming in C .DedicationWe dedicate this book to all those open source robot maker spaces that in spite ofhumble and meager resources continue to toil against the improbable and do amazingthings with robots.

ACKNOWLEDGMENTSWe are greatly indebted to Valerie Cannon who played the role of “on location” robo-journalistand photographer for us at the 2015 DARPA Robotics Search and Rescue Challenge at theFairplex in Pomona, California.We would like to thank our two interviewees for our “Bron’s Believe It or Not” interviews. Wealso thank Ken Burns from Tiny Circuits of Akron, Ohio, who provided us with a personal tourof his Arduino manufacturing space and endured our probing interview questions. Portionsof the material on Arduino robotics hardware, especially the Phantom X Pincher Robot Arm,would not have been possible without the time and interview given to us from Kyle Granat atTrossen Robotics.We are also indebted to the NEOACM CSI-Clue robotics challenge team who acted as a sounding board and early test bed for many of the robot example programs in this book. We are fortunate to be part of Ctest Laboratories, which provided us with unfettered access to their EastSidaz and Section 9 robots. The East Sidaz and Section 9 met every challenge we could throwat them. A special thanks to Pat Kerrigan, Cody Schultz, Ken McPherson, and all the folks atthe Oak Hill Collaborative Robotics Maker Space who allowed us to subject them to someof our early robot designs. A special thanks to Howard Walker from Oak Hill Collaborativewho introduced us to the Pixy camera. Thanks to Jennifer Estrada from Youngstown StateUniversity for her help with the Arduino-to-Bluetooth-to-Vernier magnetic field sensor connection and code. A special thanks goes to Bob Paddock for offering his insight and expertiseon sensors and giving us a clear understanding of the Arduino microcontroller. A shout-out toWalter Pechenuk from IEEE Akron, Ohio, chapter for his subtle, cool, and calm interaction andresponses as we went on endlessly about our approach to autonomous robotics. Further, thissimply could not have been written without the inspiration, tolerance, and indirect contributionof many of our colleagues.

WE WANT TO HEAR FROM YOU!As the reader of this book, you are our most important critic and commentator. We value youropinion and want to know what we’re doing right, what we could do better, what areas you’dlike to see us publish in, and any other words of wisdom you’re willing to pass our way.We welcome your comments. You can email or write to let us know what you did or didn’t likeabout this book—as well as what we can do to make our books better.Please note that we cannot help you with technical problems related to the topic of this book.When you write, please be sure to include this book’s title and author as well as your nameand email address. We will carefully review your comments and share them with the authorand editors who worked on the book.Email:feedback@quepublishing.comMail:Que PublishingATTN: Reader Feedback800 East 96th StreetIndianapolis, IN 46240 USAREADER SERVICESRegister your copy of Robot Programming at quepublishing.com for convenient access todownloads, updates, and corrections as they become available. To start the registration process, go to quepublishing.com/register and log in or create an account*. Enter the productISBN, 9780789755001, and click Submit. Once the process is complete, you will find any available bonus content under Registered Products.*Be sure to check the box that you would like to hear from us in order to receive exclusive discounts on future editions of this product.

INTRODUCTIONROBOT BOOT CAMPcautionWe who program robots have a special responsibility to make sure thatthe programming is safe for the public and safe for the robots. The safetyof robot interaction with humans, animals, robots, or property is a primary consideration whenever a robot is being programmed. This is truefor all kinds of robot programming and especially true for programmingautonomous robots, which is the kind of robot programming that weexplain in this book. The robot commands, instructions, programs, andsoftware presented in this book are meant for exposition purposes onlyand as such are not suitable for safe public interaction with people, animals, robots, or property.A serious treatment of robot safety is beyond the scope of this introductory book. Although the robot examples and applications presented inthis book were tested to ensure correctness and appropriateness, wemake no warranties that the commands, instructions, programs, andsoftware are free of defects or error, are consistent with any particularstandard of merchantability, or will meet your requirements for any particular application.The robot code snippets, programs, and examples are meant for exposition purposes only and should not be relied on in any situation wheretheir use could result in injury to a person, or loss of property, time, orideas. The authors and publisher disclaim all liability for direct or consequential damages resulting from your use of the robots, commands,instructions, robot programs, and examples presented in this book orcontained on the supporting website for this book.

2Ro b o t Bo o t Ca mpRobot Programming BootCampWelcome to Robot Programming: A Guide to ControllingAutonomous Robots. This robot programming “boot camp”ensures that you have all the information needed to get started.We have built and programmed many types of robots rangingfrom simple single-purpose robots to advanced multifunctionautonomous robot teams and have found this short robot programming boot camp indispensable for those who are new toprogramming robots or who want to learn new techniques toprogram robots.Ready, Set, Go! No Wires orStrings AttachedThere are two basic categories for robot control and robot operation as shown in Figure I.1.The telerobot group represents robot operations that are remotelycontrolled by a human operator using some kind of remote controldevice or puppet mode. Some remote controls require a tether (awire of some sort) to be physically connected to the robot, andother types of remote control are wireless (for example, radio control or infrared).The autonomous robot group represents the kind of robot thatdoes not require a human operator. Instead, the robot accessesa set of instructions and carries them out autonomously withoutintervention or interruption from a remote control.In this book, we focus on the autonomous group of robotoperations and robot programming. Although we often discuss,explain, and contrast telerobots and autonomous robots, ourprimary focus is on introducing you to the basic concepts of programming a robot to operate and execute assigned tasks autonomously.As you see in Chapter 9, “Robot SPACES,” there are hybrids ofthe two types of robot control/operation with different mixes andmatches for operation strategies. You are introduced to techniques that allow for mixing and matching different robot controlstrategies.cautionAlthough Robot Programming:A Guide to ControllingAutonomous Robots does notassume that you have any previous experience programmingrobots, to get the most outthe book it is assumed thatyou are familiar with basicprogramming techniques instandard programming languages such as Java or C .While the book does presentall the final robot programs inJava or C , the basic robotinstruction techniques andconcepts are presented withdiagrams or plain English first.The book also introduces youto approaches to programdesign, planning, and analysissuch as RSVP (Robot ScenarioVisual Planning) and REQUIRE(Robot Effectiveness QuotientUsed in Real Environments) .noteAll robot instructions,commands, and programsin this book have beentested on ARM7, ARM9microcontroller-based robotsas well as on the widelyavailable and popular LEGONXT and EV3-based robots.All other robot-basedsoftware used in this bookwas tested and executedin Mac OSX and Linuxenvironments.

3B oot C amp Fundament alsFigure I.1The two basiccategories ofrobot operationTWO BASIC CATEGORIES OF ROBOT sBoot Camp FundamentalsFive basic questions must be answered prior to any attempt to program a robot:1. What type of robot is being considered?2. What is the robot going to do?3. Where is the robot going to do it?4. How is the robot going to do it?5. How will the robot be programmed?Many beginner and would-be robot programmers fail to answer these basic questions and endup with less than successful robot projects. Having the answers to these fundamental questionsis the first step in the process of getting any kind of robot to execute the assigned task. In RobotProgramming: A Guide to Controlling Autonomous Robots we demonstrate how these questionsand their answers are used to organize a step-by-step approach to successfully instructing a robot toautonomously carry out a set of tasks.

4Ro b o t Bo o t Ca mpCore Robot Programming Skills Introducedin This BookIn this book, we introduce you to the following basic techniques of the Robot Boot Camp shown inTable I.1.Table I.1 The Boot Camp NotesTechniquesDescriptionRobot motion planning & programmingArm movementGripper programmingEnd-effector movementRobot navigationProgramming the robot to usedifferent types of sensorsInfrared sensorsUltrasonic sensorsTouch sensorsLight sensorsRFID sensorsCamera sensorsTemperature sensorsSound sensorsAnalysis sensorsMotor useMotors used in robot navigationsMotors used in robotic arms, grippers, and endeffectorsMotors used in sensor positioningDecision-makingRobot action selectionRobot direction selectionRobot path selectionInstruction translationTranslating English instructions and commands into aprogramming language or instructional format that arobot can processThese techniques are the core techniques necessary to get a robot to execute almost any assignedtask. Make note of these five areas because they represent the second step in building a solid foundation for robot programming.BURT—Basic Universal Robot TranslatorIn this book, we use two aids to present the robot programs and common robot programming issuesin an easy-to-understand and quick reference format. The first aid, BURT (Basic Universal Robot

Co re Robot Programming Skills Int roduced in T his B ook5Translator), is used to present all the code snippets, commands, and robot programs in this book.BURT shows two versions of each code snippet, command, or robot program: Plain English version Robot language versionBURT is used to translate from a simple, easy-to-understand English version of a set of instructionsto the robot language version of those instructions.In some cases the English version is translated into diagrams that represent the robot instructions.In other cases, BURT translates the English into standard programming languages like Java or C .BURT can also be used to translate English instructions into robot visual instruction environmentslike Labview or LEGO’s G language for Mindstorms robots.The BURT Translations are numbered and can be used for quick reference guides on programmingtechniques, robot instructions, or commands. BURT Translations have two components; an inputand an output component. The input component will contain the pseudocode, or RSVPs. The outputcomponent will contain the program listing, whether it be a standard language or visual instruction.They will be accompanied with the BURT Translation Input or Output logo as shown in Figure I.2.In addition to BURT Translations, this book contains BURT Gotchas, a.k.a. BURT’s Glossary ofTechnical Concepts and Helpful Acronyms. The world of robot programming is full of technicalterms and acronyms that may be unfamiliar or tricky to recall. BURT Gotchas provide a convenientplace to look up any acronym or some of the more technical terms used in this book. In some casesBURT Gotchas are listed at the end of the chapter in which they are first used, but a complete list ofall of BURT Gotchas can be found in the book’s glossary.Figure I.2BURT TranslationInput and Outputlogos%857·6 ,1387 1' 287387 75 16/ 7,21 /2*26

6Ro b o t Bo o t Ca mpBRON—Bluetooth Robot Oriented NetworkThe second aid is BRON (Bluetooth Robot Oriented Network). We have put together a small team ofrobots that are connected and communicate through Bluetooth wireless protocols and the Internet.It is the responsibility of this team of robots to locate and retrieve useful tips, tricks, little-knownfacts, interviews, and news from the world of robot programming that the reader will find interesting and helpful. This material is presented in sections titled BRON’s Believe It or Not and are identified by the logo shown in Figure I.3.;KHG LFigure I.3BRON’s Believe It or Not logoBelieve ItOr Not!These sections contain supplementary material that the reader can skip, but often offer additionalinsight on some idea that has been presented in the chapter. In some instances, a BRON’s BelieveIt or Not contains news that is hot off the presses and relevant to some aspect of robot programming. In other instances, a BRON section contains excerpts from interviews of individuals makingimportant contributions to the world of robotics or robot programming. In all cases, BRON’s BelieveIt or Not sections are designed to give you a deeper understanding and appreciation for the world ofrobotics and robot programming.Assumptions About the Reader’s Robot(s)Robot Programming: A Guide to Controlling Autonomous Robots can be read and much can belearned without any access to robots at all. Most chapters explain the concepts in plain English andare reinforced with diagrams. However, to get the maximum benefit from reading this book, it is

How Midamba Learned t o Program a Robotassumed you will try out and test the commands, instructions, orprograms on robots that you have access to.We used and tested the instructions and programs in this book onseveral different types of robots, and the ideas presented in thisbook broadly apply to many classes of robots. If you have accessto a robot with at least one capability from each column shownin Table I.2, you will be able to adapt any program in this book toyour robot.7noteWe do show you how toprogram a robot to use othersensors beyond those listed inTable I.2. But the main ideasin the book can be tried andtested with only those listedin Table I.2.Table I.2 The Boot Camp’s Matrix of Robot CapabilitiesMovement pperARM7 MicrocontrollerBipedalUltrasonicRobot armARM9 MicrocontrollerQuadrupedCameraPusherLEGO Mindstorms EV3 MicrocontrollerHexaped (etc.)HeatLEGO Mindstorms NXT MicrocontrollerAerialLightArduinoColorARM Cortex/Edison ProcessorTouchHow Midamba Learned to Program aRobotIn this book, we tell a short story of how free-spirited, fun-loving Midamba found himself in a precarious predicament. As luck would have it, his only chance out of the predicament required that helearn how to program robots. Although Midamba had some basic experience programming a computer, he had very little knowledge of robots and no experience programming them. So throughoutthe book, we use Midamba’s predicament and his robot programming triumph as an example. Wewalk you through the same basic lessons that Midamba learned and the steps he had to take to successfully program his first robot.

This page intentionally left blank

3RSVP: ROBOT SCENARIOVISUAL PLANNINGRobot Sensitivity Training Lesson #3: Don’t instruct the robot to performa task you can’t picture it performing.As described in Chapter 2, “Robot Vocabularies,” the robot vocabularyis the language you use to assign a robot tasks for a specific situation orscenario. And once a vocabulary has been established, figuring out theinstructions for the robot to execute using that vocabulary is the next step.Making a picture or a “visual representation” of the scenario and instructions you want the robot to perform can be great way to ensure your robotperforms the tasks properly. A picture of the instructions the robot willperform allows you to think through the steps before translating them tothe code. Visuals can help you understand the process, and studying thatvisual can improve its development by seeing what has to be done andelucidating that which may otherwise pose a problem. We call this theRSVP (Robot Scenario Visual Planning). The RSVP is a visual that helpsdevelop the plan of instructions for what the robot will do. The RSVP iscomposed of three types of visuals: A floorplan of the physical environment of the scenario A statechart of the robot and object’s states Flowcharts of the instructions for the tasksThese visuals ensure that you have a “clear picture” of what has to bedone to program a robot to do great feats that can save the world or lightthe candles on a cake. RSVP can be used in any combination. Flowchartsmay be more useful than statecharts for some. For others, statecharts arebest. All we suggest is that a floorplan or layout is needed whether statecharts or flowcharts are utilized.

CHAPTER48RS VP : Ro b o t S ce n a rio Vis ual Planning3The saying “a picture is worth a thousand words” means that a single image can convey the meaning of a complex idea as well as a large amount of descriptive text. We grew up with this notionwhile in grade school especially when trying to solve word problems; “draw a picture” of the mainideas of the word problem and magically it becomes clear how to solve it. That notion still works. Inthis case, drawing a picture of the environment, a statechart, and flowcharts will be worth not onlya thousand words but a thousand commands. Developing an RSVP allows you to plan your robotnavigation through your scenario and work out the steps of the instructions for the tasks in the various situations. This avoids the trials and errors of directly writing code.Mapping the ScenarioThe first part of the RSVP is a map of the scenario. A map is a symbolic representation of the environment where the tasks and situations will take place. The environment for the scenario is theworld in which the robots operate. Figure 3.1 shows the classic Test Pad for NXT Mindstorms robot.Figure 3.1A robot world for NXT Mindstorms Test PadA Test Pad like the one shown in Figure 3.1 is part of the Mindstorms robot kits. This Test Pad isapproximately 24 inches wide, 30 inches long, and has a rectangular shape. There are 16 colors onthe Test Pad and 38 unique numbers with some duplicates. There is a series of straight lines andarcs on the pad. Yellow, blue, red, and green squares are on the Test Pad along wit

Challenge and regularly organize and direct robot programming workshops for the Arduino, Mindstorms EV3, LEGO NXT, and RS Media robot platforms. Cameron and Tracey are two of the authors of Build Your Own Teams of Robots with LEGO Mindstorms NXT and Bluetooth, published by McGraw-Hill/TAB Electronics, January 2013. They have written many