Turboshrimp is a clojure library for communicating with and controlling the Parrot AR.Drone.
This code was originally forked from the awesome work gigasquid/Carin Meier did with clj-drone.
My changes are mostly about turning the code into a full-featured library for writing drone applications (like node-ar-drone), with the following specific goals:
-
Keeping the focus on straightforward drone control: I removed the OpenCV dependency and the goal/belief-driven programming API. Those are good things, but I think they should be in separate libraries.
-
Enhancing the ability to control multiple drones and receive telemetry from multiple drones: Replacing single, global vars with per-drone data structures.
-
Adding a clean way for applications to process drone telemetry, and parsing the full set of navdata options from the drone: GPS, magneto, vision, etc.
-
Android compatibility. I want to be able to use this code on Android using Clojure on Android.
I'm basing some of the new work on the node-ar-drone project.
-
Flight control works.
-
Telemetry works--even GPS!
-
Video works. I've tried two different H.264 decoders:
-
turboshrimp-h264j uses the pure Java h264j decoder. h264j is a little slow and has some color glitches and occasional errors.
-
turboshrimp-xuggler uses the xuggler decoder, which uses native code. It's almost twice as fast as h264j and its output appears to be perfect.
-
-
It runs on Android. I don't check every commit, but I do periodically test on Android. This code has flown a drone on an Android phone.
There is an example of using the library to create a simple ground control station with keyboard control and live video with an overlaid HUD: examples/controller.clj
You can run the example like this:
# lein with-profile example run -m controller > debug.log
(Hey look, it's Ralph & Dottie!)
Here's a video of the HUD in action: https://www.youtube.com/watch?v=2mOtoYUoiWI
Once the controller has started, you can use the following controls:
Key | Command |
---|---|
t | Take off |
l | Land |
w/a/s/d | Forward / turn left / backward/ turn right |
shift-a/d | "Strafe" left / right |
q / z | Climb / descend |
c | Switch to forward-facing camera |
v | Switch to downward-facing camera |
$ lein test
-
Fix the inconsistent API. That is, some commands are functions, e.g.
(takeoff drone)
while some are sent usingcommand
:(command drone :navdata-options :demo)
. -
Add some convenient handling of emergency mode, similar to what node-ar-drone does.
-
Test with multiple drones and drones that aren't at the default 192.168.1.1 address.
-
Consider whether we can make it a little more convenient to use video.
-
Handle blocking config commands and multiconfig (see felixge/node-ar-drone#76).
-
Make sure errors and other events are handled correctly and consistently.
-
Make it easier to tell if the drone is connected or disconnected.
Copyright 2014, 2015 John Wiseman jjwiseman@gmail.com
Distributed under the MIT License.