Table of Contents Raspberry Pi Robotic Projects Credits About the Author About the Reviewers www.PacktPub.com Support files, eBooks, discount offers and more Why Subscribe? Free Access for Packt account holders Preface What this book covers What you need for this book Who this book is for Conventions Reader feedback Customer support Downloading the example code Errata Piracy Questions 1. Getting Started with Raspberry Pi Getting started The unveiling Hooking up a keyboard, mouse, and display Installing the operating system Accessing the board remotely Summary 2. Programming Raspberry Pi Basic Linux commands on Raspberry Pi Creating, editing, and saving files on Raspberry Pi Creating and running Python programs on Raspberry Pi Basic programming constructs on Raspberry Pi The if statement The while statement Working with functions Libraries/modules in Python The object-oriented code Introduction to the C/C++ programming language Summary 3. Providing Speech Input and Output Hooking up the hardware to make and input sound Using Espeak to allow our projects to respond in a robot voice Using PocketSphinx to accept your voice commands Interpreting commands and initiating actions Summary 4. Adding Vision to Raspberry Pi Connecting the USB camera to Raspberry Pi and viewing the images Downloading and installing OpenCV – a fully featured vision library Using the vision library to detect colored objects Summary 5. Creating Mobile Robots on Wheels Gathering the required hardware Using a motor controller to control the speed of your platform Controlling your mobile platform programmatically using Raspberry Pi Making your mobile platform truly mobile by issuing voice commands Summary 6. Making the Unit Very Mobile – Controlling the Movement of a Robot with Legs Gathering the hardware Connecting Raspberry Pi to the mobile platform using a servo controller Connecting the hardware Configuring the software Creating a program in Linux to control the mobile platform Making your mobile platform truly mobile by issuing voice commands Summary 7. Avoiding Obstacles Using Sensors Gathering the hardware Connecting Raspberry Pi to an infrared sensor Connecting Raspberry Pi to a USB sonar sensor Connecting the hardware Using a servo to move a single sensor Summary 8. Going Truly Mobile – The Remote Control of Your Robot Gathering the hardware Connecting Raspberry Pi to a wireless USB keyboard Using the keyboard to control your project Working remotely with your Raspberry Pi through a wireless LAN Working remotely with your Raspberry Pi through ZigBee Summary 9. Using a GPS Receiver to Locate Your Robot Connecting Raspberry Pi to a GPS device Accessing the GPS programmatically Summary 10. System Dynamics Getting started Creating a general control structure Using the structure of the Robot Operating System to enable complex functionalities Summary 11. By Land, Sea, and Air Using Raspberry Pi to sail Getting started Using Raspberry Pi to fly robots Using Raspberry Pi to make the robot swim underwater Summary Index Raspberry Pi Robotic Projects Raspberry Pi Robotic Projects Copyright © 2014 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. First published: February 2014 Production Reference: 1140214 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-84969-432-2 www.packtpub.com Cover Image by John Michael Harkness (<[email protected]>) Credits Author Richard Grimmett Reviewers Hector Cuesta Lihang Li Masumi Mutsuda Zapater Acquisition Editors Usha Iyer Anthony Albuquerque Nikhil Karkal Content Development Editor Ruchita Bhansali Technical Editors Novina Kewalramani Rohit Kumar Singh Pratish Soman Copy Editors Tanvi Gaitonde Dipti Kapadia Shambhavi Pai Project Coordinator Amey Sawant Proofreaders Paul Hindle Ameesha Green Indexer Monica Ajmera Mehta Graphics Yuvraj Mannari Abhinash Sahu Production Coordinator Kyle Albuquerque Cover Work Kyle Albuquerque About the Author Richard Grimmett has been fascinated by computers and electronics from his very first programming project, which used Fortran on punch cards. He has a bachelor's and master's degree in electrical engineering and a PhD in leadership studies. He also has 26 years of experience in the radar and telecommunications industries (he even has one of the original brick phones). He now teaches computer science and electrical engineering at Brigham Young University - Idaho, where his office is filled with his many robotic projects. He recently completed a book on using BeagleBone Black for robotic projects, and is now excited to release this title for those who prefer Raspberry Pi. I would certainly like to thank my wife Jeanne and family for providing me with a wonderful, supportive environment that encourages me to take on projects such as this one. I would also like to thank my students; they showed me that amazing things can be accomplished by those who are unaware of all the barriers. About the Reviewers Hector Cuesta is the author of the book Practical Data Analysis, Packt Publishing, and holds a BA in Informatics and an MSc in Computer Science. He provides consulting services for software engineering and data analysis and has more than nine years of experience in various industries including financial services, social networking, e-learning, and human resources. Hector is fluent in several programing languages and computational tools such as Java, Python, R, C-CUDA, ActiveMQ, Hadoop, C#, D3.js, MongoDB, SQL, Weka, Cassandra, OpenMP, and MPI. He is a lecturer in the Department of Computer Science at the Autonomous University of Mexico State. His main research interests lie in computational epidemiology, machine learning, computer vision, high performance computing, big data, simulation, and data visualization. He has done a research residency (Fall 2011) in Computational Epidemiology at University of North Texas in the Center of Computational Epidemiology and Response Analysis (CeCERA). He is currently working on modeling and simulation of infectious diseases using global stochastic cellular automata. He has helped in the technical review of the books Raspberry Pi Networking Cookbook, Rick Golden, Packt Publishing, and Hadoop Operations and Cluster Management Cookbook, Shumin Guo, Packt Publishing. He is also a columnist with Software Guru and has published several scientific papers in international journals and conferences. He is an enthusiast of Lego Robotics and Raspberry Pi in his spare time. You can follow him on Twitter at https://twitter.com/hmCuesta. Lihang Li received his BE degree in Mechanical Engineering from Huazhong University of Science and Technology (HUST), China, in 2012 and is now pursuing his MS degree in Computer Vision from the National Laboratory of Pattern Recognition (NLPR) at the Institute of Automation, Chinese Academy of Sciences (IACAS).
Description: