Book Image

BeagleBone Robotic Projects

By : Richard Grimmett
Book Image

BeagleBone Robotic Projects

By: Richard Grimmett

Overview of this book

Thanks to new, inexpensive microcontrollers, robotics has become far more accessible than it was in the past. These microcontrollers provide a whole new set of capabilities to allow even the most inexperienced users to make amazingly complicated projects. Beaglebone 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 to allow 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 will include guidance on what to purchase and how to connect it all successfully–and a primer on programming the BeagleBone Black. Chapter by chapter, we will add additional software functionality available from the open source community, including how to make the system see using a webcam, how to hear using a microphone, and how to speak using a speaker. We then add hardware to make your robots move–including wheeled and legged examples–as well as covering how to add sonar sensors to avoid or find objects, plus wireless control to make your robot truly autonomous. Adding GPS allows the robot to find itself. Finally the book covers how to integrate all of this functionality so that it can all work together, before developing the most impressive robotics projects: those that can sail, fly, and explore underwater.
Table of Contents (18 chapters)
BeagleBone Robotic Projects
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

We live in an amazing age. We are mostly aware of how amazing it is as we live in an age where major changes to how we live occur well within a lifetime, sometimes within a few years. Nowhere is this more evident than in the general area of technology, and the specific area of computers. Not so many years ago, certainly within the lifespan of most of the baby-boomer generation, computers were distant machines kept in the backrooms of large corporations or universities. Access to them was tightly controlled. If you wanted to program them, you punched your computer cards, fed them into the card reader, and then, after an hour or so of wait, you went to receive your computer printout. This was, I regret to reveal, part of my first experience with a computer.

These large computers were the domain of companies such as IBM, with their model 360, Digital Equipment, with the Model PDP-7, and Hewlett-Packard, with the Model 1000. These computers cost many thousands of dollars, and were rarely seen except by a privileged few, who had access to climate-controlled computer rooms.

This model fit the world just wonderfully for many years, until the advent of the personal computer. I was lucky to know someone who purchased one of the very first IBM-PCs. It had two floppies, a monochrome monitor, and was an amazing piece of equipment. Suddenly the world changed and the technology that had seemed so remote was now available on the desktop. This same technological revolution in processing power also birthed a new breed of dedicated microprocessors. These could be used for specific tasks that had previously been the realm of analog circuitry or, in many cases, human interaction with mechanical systems.

These processing solutions to specific applications are named embedded systems. They take the digital calculating capability of personal computers and shrink them even further so they can be placed in common household and industrial objects. Embedded technology has also evolved with respect to price; fortunate, for few would be willing to pay several thousand dollars for a door lock or temperature sensor. The initial embedded devices were very limited in their technology, and developing applications with them became quite a challenge. It was very common to run out of either computing horsepower or memory. Many nights were spent by the talented few shoehorning the last features into the last few bytes of memory.

The computer age has spawned an amazing array of technical advances in both the hardware and software areas. Companies such as Intel and AMD have created processors with almost unfathomable computing power and more available memory that once thought possible, and both Microsoft and Apple have provided major advances in the area of software functionality and usability. The personal computer has become a standard tool in most households, schools, businesses, and factories.

As the personal computer has gone, so has the embedded systems world. From what were once four bit, special purpose processors with 2000 bytes of memory, now embedded processors have emerged that rival the performance and capability of standard personal computers. One has to look no further than the cell phone for an example of significant computing capability in very small packages, and at very inexpensive prices.

This has all reached a bit of a crescendo with the introduction of small, inexpensive systems that can not only run simple, focused applications, but have the capability of powering almost any type of computing need we can create. At the same time these small but powerful systems have outgrown the small, single purpose development environments as well. They are now paired with powerful operating systems, and provide personal computer-like functionality in very small packages. The overwhelming advance of tablets and smart phones has begun to take over the face of computing for many applications.

These advances have also affected the embedded area as well. Small, highly capable systems have married very inexpensive hardware with free, open source software to provide a platform for almost anyone to explore the embedded world. The Arduino, the Raspberry Pi, and now the BeagleBone Black are all platforms that offer not only an affordable price point, but also an open source software community that provides free capability and an easy way to interact with others to get answers to questions or exchange ideas. With these new capabilities, as we shall see later in the book, the sky is literally the limit.

This book will focus on just one of these processors, the BeagleBone Black. However, much of what is written here could be applied to other choices with some limited modifications. But this is not what you came here to learn. You came to learn how to build some very interesting, complex, amazing robotics projects. And processors such as the BeagleBone Black are impressive because they have the capability to not only make this possible, but to make it accessible to those outside of academic or research communities. In this book, we'll explore these capabilities, and build some very impressive projects.

Just a few comments on how the book is laid out. We'll start with a very basic introduction to the BeagleBone Black, and how to get the hardware and software up and working. Then, we'll build some basic functionality on top of the basic system, showing you how to add sound, vision, and control.

Then we'll tackle some fairly complex capability, including GPS, audio, and some advanced sensors. Finally, we'll wrap it up by showing you how to put an entire system together with some tools that can make that a bit less complicated.

In each chapter, I'll give you some very specific instructions for how to proceed. This is a bit dangerous, and the instructions are all going to be subject to change. Hopefully you'll understand the basics of what we are trying to accomplish, so if things don't go quite to plan, you'll be able to figure out how to proceed. There is a lot of help out there, between message boards and blogs, so don't be shy.

What is critical to remember is that this is not an academic exercise. Don't just read the book, but do something with the hardware. My hope is that by the end, you'll be building the kinds of machines that will lead us all into the 22nd century. I often tell my students that their children will grow up as comfortable with robots as they are with computers.

So, let's begin!

What this book covers

Chapter 1, Getting Started with the BeagleBone Black, will provide instructions for initial power-up of your hardware.

Chapter 2, Programming the BeagleBone Black, will give you a brief tutorial so that you can be successful implementing all the amazing functionality, as many of you are new to embedded systems, Linux, Python, or perhaps even programming in general.

Chapter 3, Providing Speech Input and Output, will show you how to add speech recognition as well as make your robot speak.

Chapter 4, Allowing the BeagleBone Black to See, will show you how to add the capability for your robot to see.

Chapter 5, Making the Unit Mobile – Controlling Wheeled Movement, will show you how to add wheeled movement to your robot.

Chapter 6, Making the Unit Very Mobile – Controlling Legged Movement, shows how to build robots that have the capability to walk.

Chapter 7, Avoiding Obstacles Using Sensors, shows how to use sensors to avoid barriers as it hardly makes sense to have mobility if your robot is going to run into obstacles.

Chapter 8, Going Truly Mobile – Remote Control of Your Robot, will show how to use a remote device to control your robot.

Chapter 9, Using a GPS Receiver to Locate Your Robot, shows how to add a GPS device to your robot.

Chapter 10, System Dynamics, introduces some methods for organizing all of the capabilities so that they are available at the same time.

Chapter 11, By Land, Sea, and Air, introduces some interesting possibilities for embedded projects that can fly, sail, or swim

What you need for this book

Each chapter will lead you through not only the hardware, but also the software required for each project. However, for almost all of these projects you'll need a personal computer connected to the Internet, an additional Internet connection and LAN cable, the BeagleBone Black, and the power cable that comes with it.

Who this book is for

This book is designed for the informed beginner. I would hope that before beginning the projects in this book you would be familiar with your personal computer and its basic use and functionality. You won't need prior programming experience, but it will be helpful. You'll be introduced to some of the most basic working of the Linux operating system, so any familiarity there will be helpful, but not essential. More than anything the book requires a curiosity about how robots or other embedded projects work, and the tenacity to work through the issues associated with building your own hardware and then adding software to get to a working system.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Mission briefing

This section explains what you will build, with a screenshot of the completed project.

Why is it awesome?

This section explains why the project is cool, unique, exciting, and interesting. It describes what advantage the project will give you.

Your objectives

This section explains the major tasks required to complete your project.

  • Task 1

  • Task 2

  • Task 3

  • Task 4, and so on

Mission checklist

This section explains any pre-requisites for the project, such as resources or libraries that need to be downloaded, and so on.

Task 1

This section explains the task that you will perform.

Prepare for lift off

This section explains any preliminary work that you may need to do before beginning work on the task.

Engage thrusters

This section lists the steps required in order to complete the task.

Objective complete – mini debriefing

This section explains how the steps performed in the previous section allow us to complete the task. This section is mandatory.

Classified intel

The extra information in this section is relevant to the task.

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

Code words in text are shown as follows: "You can do this with the ls -la /dev/sd* command."

A block of code is set as follows:

#Smooth image, then convert the Hue
    cv.Smooth(img,img,cv.CV_BLUR,3)
    hue_img = cv.CreateImage(cv.GetSize(img), 8, 3)
    cv.CvtColor(img,hue_img, cv.CV_BGR2HSV)

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

xz -cd ubuntu-precise-12.04.2-armhf-3.8.13-bone20.img.xz > /dev/sdX

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "The Safe start violation tab is set when you first enter the program; you need to clear this by clicking on the Resume button at the bottom-left corner of the screen."

Note

Warnings or important notes appear in a box like this.

Tip

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 may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via 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 on 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 and colored images

You can download the example code files and colored images for this Packt book you have purchased 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.

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 would 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 on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright 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 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

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.