ROS By Example A Do-It-Yourself Guide to the Robot Operating System VOLUME A PI ROBOT PRODUCTION R PATRICK GOEBEL Version 1.1.0 For ROS Indigo ROS BY EXAMPLE Copyright © 2012 by R Patrick Goebel 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: 5-800085-311092 Version 1.1.0 for ROS Indigo: January 2015 LEGO® is a trademark of the LEGO group which does not sponsor, authorize, or endorse this book Other products and company names mentioned herein may be the trademarks of their respective owners Rather than use a trademark symbol with every occurrence of a trademark name, we are using the names only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark Information contained in this work (Paperback or eBook) has been obtained from sources believed to be reliable However, the author does not guarantee the accuracy or completeness of any information contained in it, and the author shall not be responsible for any errors, omissions, losses, or damages caused or alleged to be caused directly or indirectly by the information published herein This work is published with the understanding that the author is supplying information but is not attempting to render professional services This product almost certainly contains errors It is your responsibility to examine, verify, test, and determine the appropriateness of use, or request the assistance of an appropriate professional to so PREFACE This book is about programming your robot to amazing things, whether it be detecting people's faces and other visual objects, navigating autonomously around your house, or responding to spoken commands We will be using some of the most advanced robotics software available today thanks to ROS, the Robot Operating System created by California-based Willow Garage and now maintained by the Open Source Robotics Foundation (OSRF) The primary goal of ROS (pronounced "Ross") is to provide a unified and open source programming framework for controlling robots in a variety of real world and simulated environments ROS is certainly not the first such effort; in fact, doing a Wikipedia search for "robot software" turns up 15 such projects But Willow Garage is no ordinary group of programmers banging out free software Propelled by some serious funding, strong technical expertise, and a well planned series of developmental milestones, Willow Garage has ignited a kind of programming fever among roboticists with hundreds of user-contributed ROS packages already created in just a few short years ROS now includes software for tasks ranging from navigation and localization (SLAM), 3D object recognition, action planning, motion control for multi-jointed arms, machine learning and even playing billiards In the meantime, Willow Garage has also designed and manufactured a $400,000 robot called the PR2 to help showcase its operating system Using the latest in robot hardware, including two stereo cameras, a pair of laser scanners, arms with degrees of freedom, and an omni-directional drive system, only a lucky few will be able to run ROS directly on the PR2, including 11 research institutions that were awarded free PR2s as part of a beta-test contest However, you not need a PR2 to leverage the power of ROS; packages have already been created to support lower-cost platforms and components including the iRobot Create, TurtleBot, Arduino, WowWee Rovio, LEGO ® NXT, Phidgets, ArbotiX, Serializer, Element and Robotis Dynamixels The guiding principle underlying ROS is "don't reinvent the wheel" Many thousands of very smart people have been programming robots for over fifty years—why not bring all that brain power together in one place? Fortunately, the Web is the perfect medium for sharing code Many universities, companies and individuals now openly share their ROS code repositories, and with free cloud space available through services such as Google Code or GitHub, anyone can share their own ROS creations easily and at no cost Perhaps the best part of jumping on the ROS train is the excitement that comes from working with thousands of like-minded roboticists from around the world Not only will you save many days of frustration by not duplicating someone else's work, you can also feel the satisfaction that comes from contributing back to this rapidly developing field PRINTED VS PDF VERSIONS OF THE BOOK The printed and PDF versions of this book are nearly the same with a few important differences The page formatting is identical but most PDF readers start page numbering from the first page and ignore what is set by the document itself Images and code syntax are in color in the PDF version but grayscale in the printed version to keep the cost reasonable The PDF version is full of clickable links to other resources on the Web In the printed version, these links appear as underlined text with a numbered superscript The expanded URLs are then listed as endnotes at the end of the book Staying Up-To-Date: If you'd like to receive notifications of updates to both the book and the accompanying code, please join the ros-by-example Google Group ... Follower 11 .3 .1 Adding Depth to the Object Tracker 11 .3.2 Testing the Object Follower with a Simulated Robot 18 6 18 6 18 7 18 8 19 6 19 6 19 8 19 9 2 01 2 01 2 01 2 01 203 204 210 211 211 215 11 .3.3 Object... ROS By Example A Do- It- Yourself Guide to the Robot Operating System VOLUME A PI ROBOT PRODUCTION R PATRICK GOEBEL Version 1. 1.0 For ROS Indigo ROS BY EXAMPLE Copyright © 2 012 by R Patrick... Linux 10 .5 ROS to OpenCV: The cv_bridge Package 10 .6 The ros2 opencv2.py Utility 10 .7 Reducing Video Processing Load 10 .7 .1 Data skipping 10 .7.2 Topic Throttling 12 7 13 2 13 3 13 4 13 6 13 8 13 9 13 9 14 0