21,59 €
BeagleBone Blue is effectively a small, light, cheap computer in a similar vein to Raspberry Pi and Arduino. It has all of the extensibility of today’s desktop machines, but without the bulk, expense, or noise. This project guide provides step-by-step instructions that enable anyone to use this new, low-cost platform in some fascinating robotics projects. By the time you are finished, your projects will be able to see, speak, listen, detect their surroundings, and move in a variety of amazing ways.
The book begins with unpacking and powering up the components. This includes guidance on what to purchase and how to connect it all successfully, and a primer on programming the BeagleBone Blue. You will add additional software functionality available from the open source community, including making the system see using a webcam, hear using a microphone, and speak using a speaker.
You will then learn to use the new hardware capability of the BeagleBone Blue to make your robots move, as well as discover how to add sonar sensors to avoid or find objects. Later, you will learn to remotely control your robot through iOS and Android devices. At the end of this book, you will see
how to integrate all of these functionalities to work together, before developing the most impressive robotics projects: Drone and Submarine.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 184
Veröffentlichungsjahr: 2017
BIRMINGHAM - MUMBAI
Copyright © 2017 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: December 2013
Second edition: June 2017
Production reference: 1090617
ISBN 978-1-78829-313-6
www.packtpub.com
Author
Dr. Richard Grimmett
Copy Editor
Stuti Srivastava
Reviewers
Shantanu Bhadoria
Marcelo Boá
Jason Kridner
Project Coordinator
Virginia Dias
Commissioning Editor
Vijin Boricha
Proofreader
Safis Editing
Acquisition Editor
Heramb Bhavsar
Indexer
Rekha Nair
Content Development Editor
Sharon Raj
Graphics
Kirk D'Penha
Technical Editor
Prashant Chaudhari
Production Coordinator
Aparna Bhagat
10 years ago now, Gerald and I envisioned the original BeagleBoard, which would democratize access to computers that were small enough, low-power enough, capable enough, open enough, understandable enough, and affordable enough to encourage hundreds of thousands of new developers to build electronics systems that they controlled, rather than simply creating an application that merely runs on someone else's platform. From open hardware DNA-analysis machines to advanced transportation systems and prototypes of Mars rovers, over a million BeagleBoards and BeagleBones have now gone into developers' projects, and often, units built around the open source hardware designs have gone into production systems, enabling entrepreneurs and visionaries to realize their dreams. Enabling the http://beagleboard.org/ community has remained my passion, and I support it everyday. Traveling to trade shows, chatting on the live IRC channel, maintaining the website, answering technical queries on the mailing list, updating documentation, supporting innovations with our suppliers and distributors, and ultimately creating new designs all pay off when I see individuals succeeding in learning about and creating with programming and electronics.
Robotics has always been a popular application of the BeagleBoard, but the new BeagleBone Blue provides a unique set of features, taking the exploration and implementation of robotics to another level of simplicity, completeness, and community activity. Robotics provides a compelling opportunity to build and go beyond a basic understanding of mechanics, electronics, programming, and networking technologies that impact nearly all of our daily lives. Moving beyond the initial experience, the open nature enables you to collaborate, build understanding from history, and eliminate any barriers to where you can take your learning, all the way to making your own product--and that makes you part of a compelling community.
Richard has already written the book on BeagleBone robotics with his titles BeagleBone Robotic Projects and Mastering BeagleBone Robotics. These are excellent books, providing practical introductions to rewarding creations. With the introduction of the BeagleBone Blue, it was natural for me to reach out to Richard with early access to the board. In this edition, Richard fast-tracks you into robotics and the BeagleBoard.org community with a practical set of hands-on experiences that get you started, and he further gives you the tools to help bring in others to this amazing world. I hope you’ll join us as we make this world a better place by mastering robotics and sharing the joy of creation and creativity it offers.
Jason Kridner
Co-founder of BeagleBoard.org
Dr. Richard Grimmett has been fascinated by computers and electronics from his very first programming project, which used Fortran on punch cards. He has bachelor's and master's degrees in electrical engineering and a PhD in leadership studies. He also has 26 years of experience in the radar and telecommunications industries, and 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 robotics projects.
Shantanu Bhadoria is an avid traveler and an author of several popular open source projects in Perl, Python, Golang, and NodeJS, including many IoT projects. When in Singapore, he works on paging and building control systems for skyscrapers and large campuses in Singapore, Hong Kong, and Macau. He has authored and contributed to public projects dealing with control over gyroscopes, accelerometers, magnetometers, altimeters, PWM generators, and other sensors and controllers, as well as sensor fusion algorithms such as Kalman filters.
His work in IoT and other fields can be accessed from his GitHub account at https://github.com/shantanubhadoria.
He is also the author of Device::SMBus, a popular Perl library used to control devices over the I2C bus.
Marcelo Boá is an electronics technician who has a bachelor's degree in information systems. He has worked for 10 years in the field of electronic maintenance. He has also worked in Java development, Oracle PL/SQL, PHP, ZK framework, shell scripts, HTML, JavaScript, Ajax, NodeJS, AngularJS, Linux, Arduino, and BeagleBone.
He started as a PL/SQL trainee at the Federal Technological University of Paraná, Brazil. He worked for several companies on many different kinds of electronic circuits and hardware, gaining technical experience at Sony, Aiwa, and Gradiente. 10 years later, he returned to Java development with the ZK framework, developing software for call centers in Curitiba's Software Park. He worked as a systems analyst in the warehouse management systems and industrial automation department at SSI SCHAEFER and provided support to large companies in the distribution sector, such as Boticário, Posigraf, Sadia BRF, GTFoods, Cotriguaçú, Unifrango, and Cocari.
He also reviewed Mastering Beaglebone Robotics.
Jason Kridner has over 25 years of experience in developing embedded electronics, from digital circuits and digital signal processing to high-level systems integration around RTOS environments and Linux. As an applications engineer at Texas Instruments, Jason has taken joy in helping others solve both simple and complex embedded systems problems. Seeking to share his passion with others, he co-founded http://beagleboard.org/ in 2008, creating platforms that hundreds of thousands of users have now enjoyed using, advancing their programming and electronics skills. He has co-authored two books on BeagleBone, Bad to the Bone and BeagleBone Cookbook.
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1788293134.
If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
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
Downloading the color images of this book
Errata
Piracy
Questions
Getting Started with the BeagleBone Blue
Powering up and connecting to the BeagleBone Blue
Accessing the operating system
Accessing the BeagleBone Blue remotely via WLAN
Summary
Programming the BeagleBone Blue
Basic Linux commands showing how to navigate around the filesystem on the BeagleBone Blue
Creating, editing, and saving files on the BeagleBone Blue
Creating and running Python programs on the BeagleBone Blue
Some basic programming constructs on the BeagleBone Blue
A brief introduction to the C programming language
Summary
Making the Unit Mobile - Controlling Wheeled Movement
Getting started
Controlling your mobile platform programmatically using the BeagleBone Blue
Connecting the DC motors to the BeagleBone Blue
Controlling the DC motors programmatically
Accessing the compass on the BeagleBone Blue
Summary
Avoiding Obstacles Using Sensors
Different types of sensors used
The sonar sensor
The infrared sensor
The LiDAR sensor
Connecting a sonar sensor to an Arduino
Accessing the sonar sensor from the Arduino IDE
Creating an array of sensors
Dynamic path planning with your mobile platform
Basic path planning
Avoiding obstacles
Summary
Allowing Our BeagleBone Blue to See
Connecting your USB camera to your BeagleBone Blue and viewing the images
Downloading and installing OpenCV, a fully featured vision library
Using the vision library to detect colored objects
Summary
Providing Speech Input and Output
Hardware prerequisites
Connecting the hardware and making an input sound
Using eSpeak to allow our projects to respond in a robot voice
Using Pocketsphinx to interpret your voice commands
Providing the capability to interpret your commands and have your robot initiate action
Summary
Making the Unit Very Mobile - Controlling Legged Movement
Connecting the BeagleBone Blue to your mobile platform
Creating a Linux program to control your mobile platform
Making your mobile platform truly mobile by issuing voice commands
Using a GPS Receiver to Locate Your Robot
Connecting the BeagleBone Blue to a GPS device
Accessing the GPS programmatically and determining how to move to a location
Summary
By Land, By Sea, By Air
The BeagleBone Blue and robots that can sail
Connecting an analog airspeed sensor
Getting sensor data from the airspeed sensor
Long range control of the BeagleBone Blue
BeagleBone Blue and robots that can fly
The BeagleBone Blue in robots that can go under the water
Summary
System Dynamics
Controlling your robot via a game pad controller
Controlling your robot via a web interface
Summary
The world we live in today is bursting with new possibilities, all made possible by new technology. Cell phones and personal computers, once the cutting edge of technology, are now a standard part of our lives. Self-driving cars, robotic vacuum cleaners, and software that can predict our shopping patterns are moving from the world of science fiction to the world of our everyday lives.
Much of this new technology is fueled by small and inexpensive but powerful processors that are not only easy to program, but are surrounded by a universe of inexpensive hardware that expands their capabilities to areas that only a few years ago weren't even in the realm of imagination. This book covers one flavor of this technology, the BeagleBone Blue. This processor embodies the next generation of do-it-yourself processors: it not only has the processing capability, but also incorporates much of the necessary surrounding support hardware in a single board.
This book will take you through a number of different projects that will show you how to take full advantage of the BeagleBone Blue. These projects include robots that roll, walk, fly, and sail. In each case, you'll learn how to use the full power of the BeagleBone Blue to create projects that would have required thousands of dollars of hardware just a few years ago.
So grab your BeagleBone Blue, and let's go!
Chapter 1, Getting Started with the BeagleBone Blue, is designed to help the novice be successful in their first few moments with the unit. The chapter begins with a discussion of how to connect power and ends with a full system, configured and ready to begin connecting any of the amazing devices and software capabilities to fulfill almost any project dream.
Chapter 2, Programming the BeagleBone Blue, introduces, or reviews for those who are already familiar, basic Linux, editing, and programming techniques that will be useful through the rest of the book. We'll cover how to interact from the command line, how to create and edit a file using an editor, and basic Python and C programming.
Chapter 3, Making the Unit Mobile - Controlling Wheeled Movement, is based on how one of the first things you might want to do is create a robot that can move around and explore its environment. Perhaps the easiest way to do this is by adding a wheeled or tracked platform. This chapter details how to control a DC motor so that the unit can drive wheels or tracks.
Chapter 4, Avoiding Obstacles Using Sensors, explores the different types of sensors that can help you complete your projects. These sensors can help you know when you are approaching an obstacle, which direction you are moving in, or how to get from here to there.
Chapter 5, Allowing Our BeagleBone Blue to See, shows how with speech, computer vision has moved forward in amazing ways with the introduction of the webcam and the integrated camera for cell phones and laptops. This chapter provides the details of how to connect a webcam, both the hardware and the software, so that we can use it to input visual data into our system.
Chapter 6, Providing Speech Input and Output, explains how a few years ago, the concept of a computer that can talk and listen was science fiction, but today, it is becoming a standard part of new cell phones. This chapter introduces how the BeagleBone Blue system can both listen to speech and also respond in kind. This is not as easy as it sounds (pun intended), and we'll expose some basic capabilities while also understanding some of the key limitations.
Chapter 7, Making the Unit Very Mobile - Controlling Legged Movement, discusses how one of the impressive capabilities that really sets a robotic project apart is the ability to control arms and legs. This is done using servos, whose position can be controlled using our system. We'll also introduce the capability of external dedicated servo controllers that can make this job much easier.
Chapter 8, Using a GPS Receiver to Locate Your Robot, explains how knowing where we are and whether to communicate it to others or to find a path to a different location can add significant possibilities to our project. GPS has become ubiquitous in our world, and its use is now taken for granted. In this chapter, we'll show how to enable it in your own project.
Chapter 9, By Land, By Sea, By Air, goes through how now that we have a powerful toolkit, we can expand our horizons to even more possibilities.
Chapter 10, System Dynamics, discusses how we've added lots of amazing capabilities to our project. At this point, we might want to integrate several of these together in order to build complex machines. This chapter covers this process in more detail, including offering some help in the form of open source software that can make this even easier.
The hardware required is introduced at the start of each chapter.
Software list:
Chapter 1
Xfce
sudo apt-get install xfce4
WinScp
https://winscp.net/eng/index.php
Putty
http://www.putty.org/
VNC server
sudo apt-get install tightvncserver
Real VNC
https://www.realvnc.com/
Chapter 2
Emacs
sudo apt-get install emacs
build-essential
sudo apt-get install build-essential
Chapter 5
guvcview
sudo apt-get install guvcview
libavformat
sudo apt-get install libavformat
ffmpeg
sudo apt-get install ffmpeg
libcv2.3
sudo apt-get install libcv2.3
libcvaux2.3
sudo apt-get install libcvaux2.3
libhighgui2.3
sudo apt-get install libhighgui2.3
python-opencv
sudo apt-get install python-opencv
python-opencv-doc
sudo apt-get install python-opencv-doc
libcv-dev
sudo apt-get install libcv-dev
libcvaux-dev
sudo apt-get install libcvaux-dev
libhighgui-dev
sudo apt-get install libhighgui-dev
python-numpy
sudo apt-get install python-numpy
Chapter 8
gpsd
sudo apt-get install gpsd
gpsd-clients
sudo apt-get install gpsd-clients
ND-100S Application
On CD with HW or http://www.usglobalsat.com/store/download/590/nd-100_gps_test_setup.zip
This book is for anyone who has been curious about using new, low-cost hardware to create robotics projects that have previously been the domain of research labs of major universities or defense departments. Some programming background is useful, but if you know how to use a personal computer, you can, with the aid of the step-by-step instructions in this book, construct complex robotics projects.
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
Log in or register to our website using your e-mail address and password.
Hover the mouse pointer on the
SUPPORT
tab at the top.
Click on
Code Downloads & Errata
.
Enter the name of the book in the
Search
box.
Select the book for which you're looking to download the code files.
Choose from the drop-down menu where you purchased this book from.
Click on
Code Download
.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/BeagleBone-Robotic-Projects-Second-Edition. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from
https://www.packtpub.com/sites/default/files/downloads/BeagleBoneRoboticProjectsSecondEdition_ColorImages.pdf