Book Image

BeagleBone Robotic Projects - Second Edition

By : Richard Grimmett
Book Image

BeagleBone Robotic Projects - Second Edition

By: Richard Grimmett

Overview of this book

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.
Table of Contents (18 chapters)
Title Page
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Customer Feedback
Preface

Preface

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!

What this book covers

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.

What you need for this book

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

Who this book is for

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.

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "We can include other contexts through the use of the include directive."

A block of code is set as follows:

void loop() {
delay(500);                     
unsigned int uS1 = sonar1.ping();
unsigned int uS2 = sonar2.ping();
unsigned int uS3 = sonar3.ping();
Serial.print(uS1 / US_ROUNDTRIP_CM);
Serial.print(“,”);
Serial.print(uS2 / US_ROUNDTRIP_CM);
Serial.print(“,”);
Serial.println(uS3 / US_ROUNDTRIP_CM);
}

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

void loop() {
delay(500);                    
unsigned int uS1 = sonar1.ping();
unsigned int uS2 = sonar2.ping();
unsigned int uS3 = sonar3.ping();
Serial.print(uS1 / US_ROUNDTRIP_CM);
Serial.print(“,”);
Serial.print(uS2 / US_ROUNDTRIP_CM);
Serial.print(“,”);
Serial.println(uS3 / US_ROUNDTRIP_CM);
}

Any command-line input or output is written as follows:

sudo rc_test_motors

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Clicking the Next button moves you to the next screen."

Note

Warnings or important notes appear in a box like this.

Note

Tips and tricks appear like this.

Reader feedback

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.

Customer support

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.

Downloading the example code

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:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. 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!

Downloading the color images of this book

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

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.