BeagleBone Blue and robots that can fly
You’ve now built robots that can move around on a wheeled structure, robots that can have legs, and robots that can sail. You can also build robots that can fly, relying on the BeagleBone blue to control their flight. There are several possible ways to incorporate the BeagleBone into a flying robotic project, but perhaps the most straightforward is to add it to a quadcopter project.
Quadcopters are a unique subset of flying platforms that have become very popular in the last few years. They utilize the same vertical lift concept as helicopters; however, they employ not one but four motor or propeller combinations to provide an enhanced level of stability. Here is a picture of just such a platform:
The quadcopter has two sets of counter-rotating propellers, which simply means that two of the propellers rotate one way and the other two rotate the other to provide thrust in the same direction. This provides a platform that is inherently stable. Controlling the thrust on all the four motors allows you to change pitch, roll, and yaw of the device.
Here is a diagram that may be helpful:
As you can see, controlling the relative speeds of the four motors allows you to control the various ways the device can change position. To move forward, or really in any direction, we combine a change in roll or pitch with a change in thrust, so that instead of going up, the device moves forward, as shown in this diagram:
In a perfect world, you might, knowing the components you used to build your quadcopter, know exactly how much control signal to apply to get a certain change in the roll/pitch/yaw or altitude of your quadcopter. But there are simply too many aspects of your device that can vary to know this well enough to rely on a fixed set of signals. Instead, this platform uses a series of measurements of its position, pitch/roll/yaw, and altitude, and then adjusts the control signals to the motors to achieve the desired result. We call this feedback control. Here is a diagram of a feedback system:
As you can see, if your quadcopter is too low, the difference between the Desired Altitude and the Actual Altitude will be positive, and the motor control will be increased, increasing the altitude. If the quadcopter is too high, the difference between the Desired Altitude and the Actual Altitude will be negative, and the Motor Control will be decreased, decreasing the altitude. If the Desired Altitude and the Actual Altitude are equal, then the difference between the two will be zero, and the Motor Control will be held at its current value. Thus, the system stabilizes even if the components aren’t perfect, or if wind comes along and blows the quadcopter up or down.
One application of the BeagleBone Blue in this type of robotic project is to actually coordinate the measurement and control of the quadcopter’s pitch, roll, yaw, and altitude. This can be done but it is a very complex task and the detail of its implementation is beyond the scope of this book. There are some individuals in the open source software and hardware space working on this problem. See https://diydrones.com/profiles/blogs/beaglebone-blue-released-linux-enabled-autopilot-for-80?xg_source=activity for details.
The BeagleBone Blue can still be utilized in this type of robotic projects, without focusing on the low-level control, by introducing another embedded processor to do the low-level control, and using the BeagleBone blue to manage the high level tasks, such as using the vision system of the BeagleBone Blue to identify a colored ball and then guiding the platform toward it. Or, as in the sail boat example, using the BeagleBone to coordinate GPS tracking and long-range communications via ZigBee. This is the type of example that I’ll cover in this section.
The first thing you’ll need is a quadcopter. There are three approaches to this: one, purchase an already assembled quadcopter; two, purchase a kit and construct it yourself; or three, buy the parts and construct the quadcopter. In either case, to complete this section, you’ll need to choose one that uses the ArduPilot as its flight control system. This flight system uses a flight version of the Arduino to do the low level feedback control we talked about earlier. The advantage to this system is that you can talk to the flight control system via USB.
There are a number of assembled quadcopters available that use this flight controller. One place to start is at ardupilot.com. This will give you some information on the flight controller, and the store has several already assembled quadcopters. If you think assembling a kit is the right approach, try www.unmannedtechshop.co.uk/multi-rotor.htmlor www.buildyourowndrone.co.uk/ArduCopter-Kits-s/33.htm, as each of these not only sells assembled quadcopters but kits as well.
If you’d like to assemble your own kit, there are several good tutorials about choosing all the right parts and assembling your quadcopter. Try blog.tkjelectronics.dk/2012/03/quadcopters-how-to-get-started, blog.oscarliang.net/build-a-quadcopter-beginners-tutorial-1/, or http://www.arducopter.co.uk/what-do-i-need.html for excellent instructions.
You might be tempted to purchase one of the very inexpensive quadcopters that are being offered on the market. For this project, you will need two key characteristics of the quadcopter. First, the quadcopter flight control will need a USB port so you can connect the BeagleBone Blue to it. Second, it will need to be large enough with enough thrust to carry the extra weight of the BeagleBone Blue, a battery, and perhaps a web cam or other sensing device.
No matter which path you choose, another excellent source for information is code.google.com/p/arducopter
. This gives you some information on how the ArduPilot works, and also talks about Mission Planner, the open-source control SW that will be used to control the ArduPilot on your quadcopter. This SW runs on the PC and communicates to the quadcopter in one of two ways: either directly through a USB connection or through a radio connection. It is the USB connection that you will communicate between the BeagleBone Blue and the ArduPilot.
The first step, when working in this space, is to build your quadcopter and get it working with an RC radio. When you allow the BeagleBone Blue to control it later, you may still want to have the RC radio handy, just in case things don’t go quite as planned.
When the quadcopter is flying well, based on your ability to control it using the RC radio, then you should begin to use the ArduPilot in autopilot mode. To do this, download the SW from ardupilot.com/downloads
. You can then run the SW and you should see something like this:
You can then connect your ArduPilot to the SW and press the connect button in the upper right corner. I will not walk you through how to use the SW to plan an automated flight plan as there is plenty of documentation for that on the ardupilot.com website. What you want to do is to hook up your BeagleBone Blue to the ArduPilot on your quadcopter so that it can control the flight of your quadcopter much as the Mission Planner does, but at a much lower and more specific level. You will use the USB interface, just as the Mission Planner does.
To connect the two devices, you’ll need to modify the Arduino code and create some BeagleBone Blue code, then simply connect the USB interface of the BeagleBone Blue to the Ardupilot and you can issue yaw, pitch, and roll commands to the Arduino to guide your quadcopter to wherever you want it to go. The Arduino will take care of keeping the quadcopter stable. An excellent tutorial on how to accomplish, albeit using the Raspberry Pi as the controller, is available at http://oweng.myweb.port.ac.uk/build-your-own-quadcopter-autopilot/.
Now that you can fly your quadcopter using the BeagleBone Blue, you can use the same GPS and ZigBee capabilities, mentioned in other areas of the book, to make your quadcopter semi-autonomous.
Your quadcopter can also act completely autonomously as well. Adding a 3G modem to the project allows you to track your quadcopter, no matter where it goes, as long as it can receive a cell signal. Here is a picture of such a modem:
This can be purchased on amazon.com, but also at your cellular service provider. Once you have purchased your modem, simply google instructions on how to configure it in Linux. An example project is given at http://www.adafruit.com/blog/2013/08/23/sky-drone-fpv-uses-3g4g-cell-network-to-provide-long-range-rc/.