LEGO MINDSTORMS NXT 2.0 The King’s Treasure ■ ■ ■ James Floyd Kelly Lego Mindstorms NXT 2.0: The King’s Treasure Copyright © 2009 by James Floyd Kelly All rights reserved. No part of this 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-13 (pbk): 978-1-4302-2491-4 ISBN-13 (electronic): 978-1-4302-2492-1 Printed and bound in the United States of America 9 8 7 6 5 4 3 2 1 Trademarked names may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, we use the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. Lead Editor: Jonathan Gennick Technical Reviewers: Adam Tester, Fay Rhodes Editorial Board: Clay Andres, Steve Anglin, Mark Beckner, Ewan Buckingham, Tony Campbell, Gary Cornell, Jonathan Gennick, Michelle Lowman, Matthew Moodie, Jeffrey Pepper, Frank Pohlmann, Ben Renow-Clarke, Dominic Shakeshaft, Matt Wade, Tom Welsh Coordinating Editor: Jim Markham Copy Editor: Seth Kline Compositor: Mary Sudul Indexer: Ann Rogers/Ron Strauss Artist: April Milne Distributed to the book trade worldwide by Springer-Verlag New York, Inc., 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax 201-348-4505, e-mail orders- [email protected], or visit http://www.springeronline.com. For information on translations, please contact Apress directly at 2855 Telegraph Avenue, Suite 600, Berkeley, CA 94705. Phone 510-549-5930, fax 510-549-5939, e-mail [email protected], or visit http://www.apress.com. Apress and friends of ED books may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Special Bulk Sales–eBook Licensing web page at http://www.apress.com/info/bulksales. The information in this book is distributed on an “as is” basis, without warranty. Although every precaution has been taken in the preparation of this 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. For Kristie B. and Canvin – thanks for everything (cid:2)CONTENTS Contents (cid:2)About the Author ........................................................................................................ ix (cid:2)About the CAD Reviewer .............................................................................................. x (cid:2)About the Technical Reviewer .................................................................................... xi (cid:2)Acknowledgments ..................................................................................................... xii (cid:2)Introduction .............................................................................................................. xiii (cid:2)Chapter 1: Turns and Tricks ........................................................................................ 1 Day 1: King Ixtua’s Treasure Repository, 2:13 p.m. ........................................................... 1(cid:2) The Maze Challenge ........................................................................................................... 4(cid:2) Evan’s Solution .................................................................................................................. 6(cid:2) (cid:2)Chapter 2: Mazerunner—Planning and Design ........................................................... 9 The MazeRunner ................................................................................................................ 9(cid:2) The Robot Description...................................................................................................... 11(cid:2) The Task List .................................................................................................................... 12(cid:2) Limitations/Constraints .................................................................................................... 13(cid:2) Mindstorm ........................................................................................................................ 15(cid:2) Sketches .......................................................................................................................... 17(cid:2) (cid:2)Chapter 3: MazeBot—Build It .................................................................................... 19 Never Be Afraid to Experiment ......................................................................................... 20(cid:2) Step by Step CAD Instructions – MazeBot ....................................................................... 21(cid:2) (cid:2)Chapter 4: MazeRunner—Program It ........................................................................ 41 Some Experience Required .............................................................................................. 41(cid:2) Into the Maze ................................................................................................................... 46(cid:2) Out of the Tunnel ............................................................................................................. 55(cid:2) v (cid:2) CONTENTS Left Turn and Right Turn Calculations ............................................................................. 58(cid:2) Simulating the Challenge ................................................................................................. 59(cid:2) (cid:2)Chapter 5: Swing and Switch .................................................................................... 61 Day 4: King Ixtua Treasure Repository, 9:14 a.m. ............................................................ 61(cid:2) Don’t Look Down .............................................................................................................. 62(cid:2) The Monkey’s Swing Challenge ....................................................................................... 63(cid:2) Evan’s Solution ................................................................................................................ 64(cid:2) (cid:2)Chapter 6: RopeSwinger—Design and Planning ....................................................... 65 Getting Started ................................................................................................................. 65(cid:2) The Robot Description...................................................................................................... 65(cid:2) The Task List .................................................................................................................... 66(cid:2) Limitations and Constraints ............................................................................................. 68(cid:2) Mindstorm ........................................................................................................................ 68(cid:2) Sketches .......................................................................................................................... 70(cid:2) (cid:2)Chapter 7: RopeSwinger—Build It ............................................................................. 73 Never Be Afraid to Experiment ......................................................................................... 74(cid:2) Step by Step CAD Instructions – RopeSwinger ................................................................ 75(cid:2) (cid:2)Chapter 8: RopeSwinger—Program It ..................................................................... 113 Swing Swing .................................................................................................................. 113(cid:2) Pulling the Lever ............................................................................................................ 117(cid:2) (cid:2)Chapter 9: Hook and Pull ......................................................................................... 125 Day 5: King Ixtua’s Treasure Repository, 8:39 a.m. ....................................................... 125(cid:2) Watch Your Step ............................................................................................................ 126(cid:2) Tricky Tupaxu ................................................................................................................ 127(cid:2) The Four Warriors .......................................................................................................... 128(cid:2) Hooks and Doors ............................................................................................................ 129(cid:2) Evan’s Solution .............................................................................................................. 131(cid:2) (cid:2)Chapter 10: RingTosser—Design and Planning ....................................................... 133 The RingTosser .............................................................................................................. 133(cid:2) The Robot Description.................................................................................................... 133(cid:2) vi (cid:2)CONTENTS The Task List .................................................................................................................. 134(cid:2) Limitations and Constraints ........................................................................................... 136(cid:2) Mindstorm ...................................................................................................................... 136(cid:2) Sketches ........................................................................................................................ 138(cid:2) (cid:2)Chapter 11: RingTosser—Build It ............................................................................ 141 Step by Step CAD Instructions – RingTosser ................................................................. 143(cid:2) (cid:2)Chapter 12: RingTosser—Program It ...................................................................... 179 It Starts with Rolling ...................................................................................................... 179(cid:2) Building the Challenge Area .......................................................................................... 187(cid:2) (cid:2)Chapter 13: Rock and Roll ....................................................................................... 201 Day 6: King Ixtua Treasure Repository, 9:27 a.m. .......................................................... 201(cid:2) The Story Wall ................................................................................................................ 202(cid:2) An Uphill Battle .............................................................................................................. 202(cid:2) The Ramp of the Warriors .............................................................................................. 203(cid:2) The Ramp Room ............................................................................................................ 205(cid:2) Evan’s Solution .............................................................................................................. 206(cid:2) (cid:2)Chapter 14: RampRider—Design and Planning ....................................................... 207 The RampRider .............................................................................................................. 207(cid:2) The Robot Description.................................................................................................... 207(cid:2) The Task List .................................................................................................................. 209(cid:2) Limitations and Constraints ........................................................................................... 210(cid:2) Mindstorm ...................................................................................................................... 210(cid:2) Sketches ........................................................................................................................ 212(cid:2) (cid:2)Chapter 15: RampRider—Build It ............................................................................ 213 Step by Step CAD Instructions – RampRider ................................................................. 217(cid:2) (cid:2)Chapter 16: RampRider—Program It ...................................................................... 235 Multiple Statues ............................................................................................................. 235(cid:2) The Ramp Challenge Setup ............................................................................................ 244(cid:2) (cid:2)Chapter 17: Grab and Release ................................................................................. 247 Day 7: King Ixtua’s Treasure Repository, 8:41 a.m. ....................................................... 247(cid:2) vii (cid:2) CONTENTS Tupaxu’s Story ............................................................................................................... 248(cid:2) The King’s Throne .......................................................................................................... 250(cid:2) Evan’s Solution .............................................................................................................. 251(cid:2) (cid:2)Chapter 18: ZipLiner—Design and Planning ............................................................ 253 The ZipLiner ................................................................................................................... 253(cid:2) The Robot Description.................................................................................................... 253(cid:2) The Task List .................................................................................................................. 254(cid:2) Limitations and Constraints ........................................................................................... 256(cid:2) Mindstorm ...................................................................................................................... 256(cid:2) Sketches ........................................................................................................................ 258(cid:2) (cid:2)Chapter 19: ZipLiner—Build It ................................................................................. 261 Step by Step CAD Instructions – ZipLiner ...................................................................... 263(cid:2) (cid:2)Chapter 20: ZipLiner—Program It ........................................................................... 291 Hold On! ......................................................................................................................... 291(cid:2) The Zip Line Challenge Setup ........................................................................................ 295(cid:2) (cid:2)Chapter 21: Treasure and Discovery ....................................................................... 303 Day 8: King Ixtua Treasure Repository, 7:02 a.m. .......................................................... 303(cid:2) Qau’s Challenge ............................................................................................................. 304(cid:2) The King’s Legacy .......................................................................................................... 304(cid:2) Qau’s Teacher ................................................................................................................ 305(cid:2) ■Design Journal ......................................................................................................... 307 ■Index ........................................................................................................................ 317 viii (cid:2)CONTENTS About the Author ■James Floyd Kelly is a freelance writer living in Atlanta, Georgia, with degrees in English and Industrial Engineering. A long-time LEGO MINDSTORMS developer, he is editor-in-chief of the world's most popular NXT blog, thenxtstep.com, which continues to draw an estimated 40,000+ readers monthly, and is a regular contributor to the LEGO MINDSTORMS development team. James Kelly has written on topics including robotics, building custom computers and free software. When not writing, he can be found spending time with his wife and young son exploring all sorts of places and things. ix
Description: