Professional Microsoft ® Robotics Developer Studio www.wrox.com $49.99 USA $54.99 CAN Wrox Professional guides are planned and written by working programmers to meet the real-world needs of programmers, developers, and IT professionals. Focused and relevant, they address the issues technology professionals face every day. They provide examples, practical solutions, and expert education in new technologies, all designed to help programmers do a better job. Recommended Computer Book Categories Technology Robotics ISBN: 978-0-470-14107-6 Microsoft Robotics Developer Studio (MRDS) offers an exciting new way to program robots in the Windows environment. With key portions of the MRDS code available in source form, it is readily extensible and offers numerous opportunities for programmers and hobbyists. This comprehensive book illustrates creative ways to use the tools and libraries in MRDS so you can start building innovative new robotics applications. The book begins with a brief overview of MRDS and then launches into MRDS concepts and takes a look at fundamental code patterns that can be used in MRDS programming. You’ll work through examples—all in C#—of common tasks, including an examination of the physics features of the MRDS simulator. As the chapters progress, so does the level of difficulty and you’ll gradually evolve from navigating a simple robot around a simulated course to controlling simulated and actual robotic arms, and finally, to an autonomous robot that runs with an embedded PC or PDA. What you will learn from this book ● How to program in the multi-threaded environment provided by the concurrency and coordination runtime ● Suggestions for starting and stopping services, configuring services, and packaging your services for deployment ● Techniques for building new services from scratch and then testing them ● How to build your own simulated environments and robots using the Visual Simulation Environment ● What robots are supported under MRDS and how to select one for purchase Who this book is for This book is for programmers who are interested in becoming proficient in the rapidly growing field of robotics. All examples featured in the book are in C#, which is the preferred language for MRDS. Enhance Your Knowledge Advance Your Career Microsoft ® Robotics Developer Studio Johns Taylor Professional spine=1.728" Updates, source code, and Wrox technical support at www.wrox.com Professional Microsoft ® Robotics Developer Studio Kyle Johns, Trevor Taylor Wrox Programmer to Programmer TM Wrox Programmer to Programmer TM www.it-ebooks.info ffirs.indd viiiffirs.indd viii 5/8/08 1:56:53 PM5/8/08 1:56:53 PM www.it-ebooks.info Professional Microsoft® Robotics Developer Studio Foreword xxv Introduction xxix Part I: Robotics Developer Studio Fundamentals Chapter 1: Exploring Microsoft Robotics Developer Studio 3 Chapter 2: Concurrency and Coordination Runtime (CCR) 29 Chapter 3: Decentralized Software Services (DSS) 83 Chapter 4: Advanced Service Concepts 157 Part II: Simulations Chapter 5: The MRDS Visual Simulation Environment 225 Chapter 6: Extending the MRDS Visual Simulation Environment 269 Chapter 7: Using Orchestration Services to Build a Simulation Scenario 337 Chapter 8: Simulating Articulated Entities 377 Chapter 9: Adventures in Simulation 419 Part III: Visual Programming Language Chapter 10: Microsoft Visual Programming Language Basics 471 Chapter 11: Visually Programming Robots 501 Chapter 12: Visual Programming Examples 523 (Continued) ffirs.indd iffirs.indd i 5/8/08 1:56:50 PM5/8/08 1:56:50 PM www.it-ebooks.info Part IV: Robotics Hardware Chapter 13: Using MRDS with Robotics Hardware 563 Chapter 14: Remotely Controlling a Mobile Robot 599 Chapter 15: Using a Robotic Arm 655 Chapter 16: Autonomous Robots 681 Chapter 17: Writing New Hardware Services 731 Index 799 ffirs.indd iiffirs.indd ii 5/8/08 1:56:52 PM5/8/08 1:56:52 PM www.it-ebooks.info Professional Microsoft® Robotics Developer Studio Kyle Johns Trevor Taylor Wiley Publishing, Inc. ffirs.indd iiiffirs.indd iii 5/8/08 1:56:52 PM5/8/08 1:56:52 PM www.it-ebooks.info Professional Microsoft® Robotics Developer Studio Published by Wiley Publishing, Inc. 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2008 by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-14107-6 Manufactured in the United States of America 10 9 8 7 6 5 4 3 2 1 Library of Congress Cataloging-in-Publication Data: Johns, Kyle, 1965- Professional Microsoft robotics developer studio / Kyle Johns, Trevor Taylor. p. cm. Includes index. ISBN 978-0-470-14107-6 (paper/website) 1. Robotics. I. Taylor, Trevor, 1955- II. Title. TJ211.J55 2008 629.8'9—dc22 2008014648 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4355, or online at http://www.wiley.com/go/permissions. Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author shall be liable for damages arising herefrom. The fact that an organization or Website is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Website may provide or recommendations it may make. Further, readers should be aware that Internet Websites listed in this work may have changed or disappeared between when this work was written and when it is read. For general information on our other products and services please contact our Customer Care Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002. Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other countries, and may not be used without written permission. Microsoft is a registered trademark of Microsoft Corporation in the United States and/or other countries. All other trademarks are the property of their respective owners. Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book. Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may not be available in electronic books. ffirs.indd ivffirs.indd iv 5/8/08 1:56:53 PM5/8/08 1:56:53 PM www.it-ebooks.info To Ryan, Tanner, Kaitlyn, Kelsey, Colin, and little Abby; but most of all to Marie. — Kyle To Denise, whose support enabled me to undertake writing this book. — Trevor ffirs.indd vffirs.indd v 5/8/08 1:56:53 PM5/8/08 1:56:53 PM www.it-ebooks.info ffirs.indd viffirs.indd vi 5/8/08 1:56:53 PM5/8/08 1:56:53 PM www.it-ebooks.info About the Authors Kyle Johns is a principal software developer at Microsoft, where he is currently a member of the Microsoft Robotics Developer Studio Team. After receiving a master’s degree in computer science from the University of Utah, he designed 3D graphics hardware for flight simulators at Evans and Sutherland. He joined Microsoft as one of the original members of the DirectX Team and then went on to help develop the graphics system software in the early days of the Xbox project. Recently he has been enjoying the opportunity to apply his 20 years of 3D graphics experience to the field of robotics by developing the Robotics Developer Studio Simulation Environment. Trevor Taylor is a consultant in the field of robotics education. After 20 years in the IT industry, including co - founding a consulting company that became a Microsoft Solution Provider Partner, he moved to the Queensland University of Technology in 2002. For six years he taught a variety of subjects, including Visual Basic and Web development using ASP.NET. During this period he also worked part - time on a doctorate in computer vision and robotics. In early 2008, Trevor left QUT to concentrate on developing course materials for teaching robotics and to finish writing his thesis. Trevor has worked with MRDS since the very first Community Technology Preview in June 2006 and is an active and well - known contributor to the community. ffirs.indd viiffirs.indd vii 5/8/08 1:56:53 PM5/8/08 1:56:53 PM www.it-ebooks.info ffirs.indd viiiffirs.indd viii 5/8/08 1:56:53 PM5/8/08 1:56:53 PM www.it-ebooks.info [...]... Contents Foreword Introduction xxv xxix Part I: Robotics Developer Studio Fundamentals 1 Chapter 1: Exploring Microsoft Robotics Developer Studio 3 Microsoft Does Robots? Microsoft Robotics Developer Studio Components Concurrency and Coordination Runtime (CCR) Decentralized Software Services (DSS) Visual Simulation Environment Visual Programming Language (VPL) Robotics Samples Packages Support for MRDS... companion for developers just beginning It also illustrates creative ways to use the tools and libraries in Microsoft Robotics Developer Studio to build innovative new robotics applications I believe that by enabling a wider audience of contributors personal robotics has the potential to become as much a reality as personal computing has become today I hope that Microsoft Robotics Developer Studio and... Similarly, the personal robotics market that is just emerging has the same or even greater potential if the creativity of its community can be unlocked It is the vision and energy of the existing robotics community that directly contributed to Microsoft investing in the creation of Microsoft Robotics Developer Studio While many employees at Microsoft have had a personal interest in robotics, it was not... Source Code section that follows As new versions of MRDS are released by Microsoft, you will also be able to download updated versions of the sample code from www.proMRDS.com After the 1.5 Refresh version of Robotics Developer Studio was released, Microsoft changed the name of the development kit to Microsoft Robotics Developer Studio We have used this new name and the abbreviation MRDS in most places... www.lynxmotion.com Parallax, Inc.: www.parallax.com Picblok Corporation Pty Ltd: www.picblokcorporation.com RoboticsConnection (Summerour Robotics Corporation): www.roboticsconnection.com Surveyor Corporation: www.surveyor.com Throughout the preparation of the book, the Microsoft Robotics Developer Studio Team have been most helpful in resolving problems and answering questions To them we extend a big... end Tandy Trower General Manager Microsoft Robotics Group xxvii flast.indd xxvii 5/7/08 9:40:18 AM www.it-ebooks.info flast.indd xxviii 5/7/08 9:40:18 AM www.it-ebooks.info Introduction Microsoft Robotics Developer Studio (MRDS) introduces a new way to program robots in the Windows environment It attempts to bring some order to the chaos that has marred the field of robotics, at least as far as Windows-based... interest in robotics, it was not until the leadership from diverse parts of the robotics community invited Microsoft to participate that the company decided to get started Until that time, robotics developers were considered part of an audience consisting of casual, academic, and professional developers who might use Visual Studio and our embedded operating systems In 2004, things began to change I happened... had been incubating and Rick offered to host the new incubation From there it took about nine months to prototype what would become Microsoft Robotics Developer Studio After another executive review, the prototype was approved, leading to a new product and business for Microsoft In June 2006, the product was formally previewed; it was released in December that same year What was delivered is an impressive... within the reach of the average professional programmer They are small enough to use in an office environment and are readily available — most can be ordered online If you have a bit more money to spend, the principles in the book apply equally to robots costing many thousands of dollars To run the examples, you should remember the following: ❑ The Microsoft Robotics Developer Studio development environment... free download from the Microsoft website It is advisable to apply Visual Studio Service Pack 1 Visual Studio 2005 automatically installs NET V2.0, but you must apply the NET Service Pack 1 The code has not been tested using Visual Studio 2008, which was released while the book was being written Visit the book’s website (www.proMRDS.com) for the latest information on using Visual Studio 2008 with MRDS . PM www.it-ebooks.info Professional Microsoft Robotics Developer Studio Foreword xxv Introduction xxix Part I: Robotics Developer Studio Fundamentals Chapter 1: Exploring Microsoft Robotics Developer Studio. xxv Introduction xxix Part I: Robotics Developer Studio Fundamentals 1 Chapter 1: Exploring Microsoft Robotics Developer Studio 3 Microsoft Does Robots? 4 Microsoft Robotics Developer Studio Components 5 Concurrency. Professional Microsoft ® Robotics Developer Studio www.wrox.com $49.99 USA $54.99 CAN Wrox Professional guides are planned and written by working