Over the last few weeks at my internship (at Boeing, the aerospace company), I’ve been developing an app for Android to control the ARDrone, a quad-copter. Here is an image of the ARDrone, hosted on the Parrot company’s website.
I’m very impressed with the drone itself. Its got an incredible autonomous flight system built in which is incredibly powerful. You can push the drone and it won’t get upset. It will try to return to its original position you first had it at and try to keep itself stable. Its got a few limitations to it, like a 15 minute run time battery life as well as a distance limiter on it, due to the wifi signal.
The actual drone runs linux inside with either C/C++ which interfaces to the wifi and received by C/C++ code. I haven’t been looking at the actual code so I wouldn’t be able to tell you which one (C or C++) it actually uses. Then, to get the Java to talk to the C/C++ I’ve been using JNI and the Android NDK. That’s all some pretty ugly code combined, so thankfully I was able to base my code off existing Java software (though it was not Android compatible).
Since then, I’ve been working on porting the Java code library, called Javadrone to Android compatible Java. I’ve been successful in getting the ARDrone to communicate perfectly with the exception of receiving video feeds so far. The Android app I’ve written so far allows the user to take off, land, as well as connect and disconnect at will without fear of crashing the drone (I’ll go into the first test flight next…). I’ve been a bit hesitant to start working on direction controls merely because I’m worried that I will overdue the controls (yaw/pitch/etc) and cause the drone to flip out or majory crash and break. Even though its relatively cheap ($300 or so), I don’t think I want to be spending that much on buying a replacement.
Anyways, the story of the first test flight: I had just compiled the app and was going to test the takeoff button/command for the second time, since the first didn’t work. I press the connect button, wait a few seconds, then press take off. And it works! So then I start thinking about what would the drone do if I disconnected from it while mid-flight. I hadn’t coded that scenario for the drone and I figured the autonomous flight that was native to the drone would kick in. And it did! It just hovered there. Though I had no way to get it back to the ground, since I wasn’t connected, to turn the drone off. So I decided to connect to the drone to land it. Big mistake. Boom. The drone freezes its props (all 4 of ‘em) mid-flight. Thunk! it his the ground. Uh oh, I’m worried that I just broke the entire $300 ARDrone that wasn’t even mine. But it turns out to be just fine, though a bit jostled. Lucky break for me. To fix this issue, I just added a condition where if the drone is still in flight when you disconnect it sends a land command before disconnecting.
So the entire app I’ve coded so far is open source and available on my github page and you can download it here. Though I must remind you that it is a work in progress that I’m going to be spending at least another few days on. After this I will not be able to post anymore updates for the source code and will unlikely ever post updates, partly because I don’t even own an ARDrone to test out future updates. Feel free to modify and publish the source code, using the license provided, which says that you can use the source code just find as long as you keep the copyright and license info with it.
