You are on page 1of 11
WCE ULTe Cool }) Creating Cool MINDSTORMS® NXT Robots Daniele Benedettelli Apress’ Creating Cool MINDSTORMS® NXT Robots Copyright © 2008 by Daniele Benedetteli llrightsreserved, No part ofthis work may be reproduced or transmitted in any form or by any means, electronic or mechanical including photocopying, recording, or by any information storage or retrieval system, without the prior written permission of the copyright owner and the publisher. ISBN-18 (pbk): 978-1-59059-966-2 ISBN-10 (pbb 159059-966-7 ISBN-13 electronie: 978-1-4307-0589-9 ISBN-10 electron): 1-4302-0599-7 Printed and bound in the United States of America 98 765.4221 “Trademarked names may appear inthis book. Rather than use a trademark symbol with every occurrence ofa trademarked name, we dse the names only in an editorial fashion and to the benefit ofthe trademark ‘owner, with no intention of infringement ofthe trademark, Lead Bator: Jefitey Pepper ‘Technical Reviewer: Claude Baumann, Developmental Editor: John R. Vacca Editorial Board: Clay Andres, Steve Anglin, Ewan Buckingham, Tony Campbell, Gary Cornel, Jonathan Gennick, Matthew Moodie, Joseph Ottinger Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clatke, Dominic Shakeshaft, Matt Wade, Tom Welsh Project Manager: Beth Christmas Copy Editor Susannah Davidson Pfalzer ‘Associate Production Director: Kari Brooks-Copony Production Editor Kelly Winguist CCompositor: Kinetic Publishing Services, LLC Proofreader: April Eddy Indexer: Becky Hornyak Artists: April Mile, Dina Quan. Cover Designer: Kurs Krames “Manufacturing Director: Tom Debolski Distributed to the book ade worldwide by Springer-Verlag New York. Inc. 233 Spring Street, th Floor, New York NY 10013, Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders-ryspringer- sb. con, oF Wisithtsp:/ mw. springeron]ine.con For information on translations, please contact Apress dtectly st 2855 Telegraph Avenue, Suit 600, Berkeley, (GA81705, Phone 510-549-5930, fx 510-549-5938, e-mail infoRapress. com or Visithttp://ia2pre5s.com Apress and friends of ED books may be purchased in bulk for academic, corporate or promotional use ‘book versions and licenses are also availabe for most tiles. For more information, reference ou Special Bulk Sales-eBo0k Licensing web page at htip://swwapress.con/info/bulksales ‘The information in this book s distributed on an “as is” basis, without warranty. Although every precaution has been taken inthe preparation ofthis work, neither the author(s) nor Apress shall have any liability to any person or entity with respect to any loss or damage caused or alleged to be caused directly or indirectly by the information contained in this work The source code for this book s available to readers at http://w. apress. con You will need to answer ‘questions pertaining Co this book in order to sucessfully download the code. To my brother Alessandro Contents at a Glance ‘About the Author ‘About the Technical Reviewer Acknowledgments Introduction PART 1 Look, Mom! No Wheels! CHAPTER 1 Building Biped Robots CHAPTER 2 Quasimodo CHAPTER 3 __ Finite State Machines. (CHAPTER 4 NXTAT-ST CHAPTER 5 Omni-Biped CHAPTER 6 NXT Turtle PART 2 Back on Wheels CHAPTER 7 Mine Sweeper. CHAPTER 8 © JohnNXT Is Alive! CHAPTER 9 Need Input! Building a Remote Control Device "APPENDIX _ Introduction to BricxCC and NXC Programming INDEX xi vo 1 a7 59 143 203 281 a7 57 867 Contents ‘About the Author ‘About the Technical Reviewer Acknowledgments Introduction PART 1 CHAPTER 1 CHAPTER 2 CHAPTER 3 Look, Mom! No Wheels! Building Biped Robots LEGO Bipedal Walking: The State of the Art Interlacing Legs Bipeds Jerky COG Shifting Bipeds. Smooth COG Shifting Bipeds Summary Quasimodo Applying What You Learned Introducing NXT Technology Meeting the NXT-G Software Connecting the NXT for the First Time Programming Quasimodo Using NXT-G The Shortest Program in the Book. Building Your Belfry Hunchback Summary Finite State Machines. Finite State Machines in Brief Saturating Counter FSM General Implementation Decision Tables Summary xi vo " 2 15 17 17 20 2 Fy 6 a7 7 49 5 56 58 wi CONTENTS CHAPTER 4 CHAPTER 5 CHAPTER 6 PART 2 CHAPTER 7 NXT AT-ST Design Thoughts Programming the AT-ST Building Your Personal AT-ST Summary Omni-Biped. History of a Biped Single-Tasking vs. Multitasking Writing a Single-Task Program Using Hysteresis Writing a Muttitask Program Building Instructions Summary NXT Turtle Quadruped Walking Introducing the Turtle Programming the Turtle Simple Program Line Following ‘Autonomous Behavior Simulation Building Your Pet Design Thoughts Summary Back on Wheels Mine Sweeper Getting More Actions from a Single Motor The Double Scanner : Programming the Mine Sweeper . Building the Mine Sweeper Mines Building instructions Summary 60 62 a 141 143 144 145 149 154 158 163 201 203 204 206 207 207 24 a7 233 aT 218 281 282 286 286 298 3a 34 CHAPTER 8 CHAPTER 9 JohnNXT Is Alive! Johnnicle: My LEGO Johnny 5 Chronicle JohnNXT Features Sensors and Actuators JohnNNXT’s Behavior and Menu JohnNXT User Guide Turning It On ‘Autonomous Behavior. JohnxT's Menu Programming JohaNXT . Panoramic View of the JohnNXT Software High Speed Communication Library. Slave Program Master Program Sound Counting FSM JohnNNxT Programming Guide. Moving the Treads Moving the Head Playing Sounds............ Moving the Slave NXT Motor Building JohnNXT Summary Need Input! Building a Remote Control Device . The Remote Control Design Bluetooth Autoconnection Library. RIC: A Program for Every Need Simple R/C Programs ‘Advanced Program Remote Control Template Programs. Sender Program Template .. Receiver Program Template. Building the Remote Control Summary CONTENTS 347 347 354 354 356 357 387 358 358 360 360 361 362 366 370 374 376 376 376 377 378 516 517 si7 518 520 520 534 542 543 544 552 565 CONTENTS APPENDIX INDEX Introduction to BricxCC and NXC Programming Getting Connected with BrioxCC Ready to Go BriexCC Menu, BricxCC Tools Summary 567 568 54 575 576 877 579 About the Author DDANIELE BENEDETTELLI appeared in this world on December 2, AD 1984 in Grosseto, the capital city of the beautiful Maremma Toscana, While attending high school, apart from his compulsory studies, his main pas- sion was writing music and playing the piano, a passion to which he devoted his childhood. When he was not playing the piano, you could find him playing with LEGOs. ‘This last passion took a backseat during hs “dark age of LEGO,” when ‘Deyo? — | real-life interests got the better of building plastic creations. In 2000, Daniele scraped enough savings together to get the LEGO MINDSTORMS Robotics Invention System, and from that moment on, a new way of relat ing to LEGO began: his adult career in the LEGO community started! In 2006, he got a Bachelor of Science degree cum laude in Computer Engineering (Automation concentration) from the Univer sity of Siena with a thesis whose approximately translated title is “LEGO MINDSTORMS-based mobile robots team.” A toy—a destiny, we could say. Now he's studying for a Master of Science degree in Robotics and Automation at the University of Siena, In 2006, he was selected by The LEGO Group as member of the MINDSTORMS Developer Program (MDP), and in 2007 as one of MINDSTORMS Community Partners (MCP), 2007 was a turning point for Daniele, He gave birth to a LEGO NXT robot that can solve automatically any 3 x3 Rubiks Cube in less than a minute. This robot is the mechanical part of the project called the LEGO Rubik Utopy. The world has gone crazy over this wonderful contraption, His activity with LEGO on the NXT line is continuing now with the group called. the MINDSTORMS Community Partners 2.0. About the Technical Reviewer Since 1999, CLAUDE BAUMANN has taught advanced LEGO MINDSTORMS robotics in after-school classes and maintains the related widely known web site http://imw.convict. 1u/Jeunes/RoboticsIntro. htm. He partici- ‘pated in beta testing of the ROBOLAB software that originated at Tufts University. He also has been in charge—in collaboration with Professor Chris Rogers—of the creation of ULTIMATE ROBOLAB, a cross-compiler environment that allows graphical programming of RCX firmware, and of a unique RCX self-replicating program (also called a “virus"). Claude has been the assessor of various high-school robot projects (among which is the famous LEGO humanoid robot GASTON). He is the author and coauthor of several related articles and conference presentations, and he was the technical reviewer of Extreme NXT: Extending the LEGO MINDSTORMS NXT to the Next Level by Michael Gasperi et al. (Apress, 2007). In 2004 and 2005, he was guest speaker atthe annual ROBOLAB Conference in Austin, Texas. He's married and has three children, is the director of a boarding institution in Luxem- bourg, and is the radio amateur LXIBW.

You might also like