This is a quick and dirty fork of Stenix's python-ardrone library modified to support recording the video and navdata received from and commands sent to the drone.
Warning: This is dirty. Very dirty. Both the code (sloppy) and the architecture (piping H.264 over stdin to a separate ffmpeg process and listening for decoded frames over stdout). But it works! And performance seems to be perfectly acceptable.
A big thank you to Stenix, Bastian Venthur and Jonathan Hunt for doing 99.99999% of the work behind this! Consider tipping Bastian Venthur's Flattr account (see the original python-ardrone) if you find this helpful.
>>> import libardrone
>>> drone = libardrone.ARDrone()
>>> # You might need to call drone.reset() before taking off if the drone is in
>>> # emergency mode
>>> drone.takeoff()
>>> drone.land()
>>> drone.halt()The drone's property image contains always the latest image from the camera.
The drone's property navdata contains always the latest navdata.
There is also a demo application included which shows the video from the drone and lets you remote-control the drone with the keyboard:
RETURN - takeoff
SPACE - land
BACKSPACE - reset (from emergency)
a/d - left/right
w/s - forward/back
1,2,...,0 - speed
UP/DOWN - altitude
LEFT/RIGHT - turn left/right
c - switch between front and bottom camera
To record the video, navdata and commands from the flight, start the demo as demo.py recordingFolderPath.
Here is a video of the library in action:
This software was tested with the following setup:
- Python 2.6.6
- Pygame 1.8.1 (only for the demo)
- ffmpeg in $PATH
- Unmodified AR.Drone firmware 1.5.1
This software is published under the terms of the MIT License: