Copyright 2013 by McGraw-Hill Education, LLC. All rights reserved. Except as permitted under the United States Copyright Act of 1976, no part of this publication may be reproduced or distributed in any form or by any means, or stored in a database or retrieval system, without the prior written permission of the publisher.
ISBN: 978-0-07-179857-0
MHID: 0-07-179857-9
The material in this eBook also appears in the print version of this title: ISBN: 978-0-07-179856-3, MHID: 0-07-179856-0.
All trademarks are trademarks of their respective owners. Rather than put a trademark symbol after every occurrence of a trademarked name, we use names in an editorial fashion only, and to the benefit of the trademark owner, with no intention of infringement of the trademark. Where such designations appear in this book, they have been printed with initial caps.
McGraw-Hill Education eBooks are available at special quantity discounts to use as premiums and sales promotions, or for use in corporate training programs. To contact a representative please e-mail us at bulksales@mcgraw-hill.com.
McGraw-Hill Education, the McGraw-Hill Education logo, TAB, and related trade dress are trademarks or registered trademarks of McGraw-Hill Education, LLC and/or its affiliates in the United States and other countries and may not be used without written permission. All other trademarks are the property of their respective owners. McGraw-Hill Education is not associated with any product or vendor mentioned in this book.
Information contained in this work has been obtained by McGraw-Hill Education, LLC from sources believed to be reliable. However, neither McGraw-Hill Education nor its authors guarantee the accuracy or completeness of any information published herein, and neither McGraw-Hill Education nor its authors shall be responsible for any errors, omissions, or damages arising out of use of this information. This work is published with the understanding that McGraw-Hill Education and its authors are supplying information but are not attempting to render engineering or other professional services. If such services are required, the assistance of an appropriate professional should be sought.
TERMS OF USE
This is a copyrighted work and McGraw-Hill Education, LLC and its licensors reserve all rights in and to the work. Use of this work is subject to these terms. Except as permitted under the Copyright Act of 1976 and the right to store and retrieve one copy of the work, you may not decompile, disassemble, reverse engineer, reproduce, modify, create derivative works based upon, transmit, distribute, disseminate, sell, publish or sublicense the work or any part of it without McGraw-Hill Educations prior consent. You may use the work for your own noncommercial and personal use; any other use of the work is strictly prohibited. Your right to use the work may be terminated if you fail to comply with these terms.
THE WORK IS PROVIDED AS IS. McGRAW-HILL EDUCATION AND ITS LICENSORS MAKE NO GUARANTEES OR WARRANTIES AS TO THE ACCURACY, ADEQUACY OR COMPLETENESS OF OR RESULTS TO BE OBTAINED FROM USING THE WORK, INCLUDING ANY INFORMATION THAT CAN BE ACCESSED THROUGH THE WORK VIA HYPERLINK OR OTHERWISE, AND EXPRESSLY DISCLAIM ANY WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. McGraw-Hill Education and its licensors do not warrant or guarantee that the functions contained in the work will meet your requirements or that its operation will be uninterrupted or error free. Neither McGraw-Hill Education nor its licensors shall be liable to you or anyone else for any inaccuracy, error or omission, regardless of cause, in the work or for any damages resulting therefrom. McGraw-Hill Education has no responsibility for the content of any information accessed through the work. Under no circumstances shall McGraw-Hill Education and/or its licensors be liable for any indirect, incidental, special, punitive, consequential or similar damages that result from the use of or inability to use the work, even if any of them has been advised of the possibility of such damages. This limitation of liability shall apply to any claim or cause whatsoever whether such claim or cause arises in contract, tort or otherwise.
The authors would like to dedicate this book to those who helped us, showed patience, and gave us inspiration:
To Barbara, who gave Bob his first LEGO set in 1974, and to Betsy, who graciously gave Bob the precious time and space to work on the material and to build that amazing cube solver.
To Lael, who loaned us Trevor and his expertise for far too many long hours.
To Takeo, whose 60th birthday celebration made the robot spark our priority.
To Mary Beulah, who during the project would always pronounce the word robots ro-buts, we will miss you.
To Vera Mae, who was the first to ignite Traceys passion for philosophy and science, you are missed.
About the Authors
Cameron Hughes is a professional software developer with more than 15 years of experience. He is a staff programmer/analyst at Youngstown State University and a software epistemologist for Ctest Laboratories. Tracey Hughes is a senior software and graphics programmer at Ctest Laboratories, where she develops information and epistemic visualization software. Both Cameron and Tracey are long-time robot enthusiasts with a collection of more than 100 robots. They have sponsored and participated in local robot competitions and robot programming workshops for the LEGO NXT and RS Media platforms through their local ACM chapter. Cameron and Tracey are the authors of seven books on software development, multithreaded programming, and parallel programming in C++.
Trevor Watkins is a network communications and system integrations specialist. He is currently the Technology Manager at the Wadsworth Public Library, where he designs, integrates, and administers all aspects of the librarys network and information systems. Trevor is also an adjunct professor in the Computer Science and Information Systems Department at Youngstown State University, where he teaches high-level programming languages and computer networks. He has been a robot hobbyist for over 20 years, with the past five years dedicated to MINDSTORMS NXT, Vex, and Arduino-based robot kits, and he consults with local high school robotics teams.
Bob Kramer is a full-time computer science professor at Youngstown State University. His research interests include using LEGO robotics as a tool to teach computer science concepts, as well as the development and extension of programming tools for LEGO robots. Bob has helped extend the nxtOSEK environment to enable C++ programs to execute on the NXT platform, and has developed an interface for a third-party sensor in the leJOS environment.
Contents
Introduction
E ven though we may be able to get a robot to do many different things and perform different tasks, we will never be able to build a single robot that can perform every task or do everything imaginable. Even a general-purpose robot is limited by the number or types of sensors it has or by the types of end effectors it possesses. We may only have access to a stationary robot where a mobile robot is needed. It might be determined that a four-wheeled tractor has the required type of mobility, and as it turns out, the robot we have is bipedal or has been designed with only two wheels. But we cant go too far in the other direction either. Its not practical or possible to build a different robot for every task or for every scenario we require. First, building a robot requires time, and the parts are costly. Sensors can be expensive. We wouldnt want to build one robot to turn off the lights and a separate robot to turn on the lights. There would be a lot of unnecessary duplication. However, we could dismantle the robot we have to build the robot we need. We really dont like this option, though. After we have put in the time and effort to build a robot and test it, and it does what we want it to do, were usually happy, and we keep it.