If you're interested in a more graphical-interface approach, you might also look into URBI or ROS.
Please note that I am only supporting this project on 64-bit Ubuntu, using the latest SDK and firmware
from Parrot (currently SDK 2.0.1). I do not have the resources to support other OSs or backward
To get started, you should download the current AR.Drone SDK
(registration required). Also make sure your AR.Drone has the current firmware --
easiest way is to download the current version of
from the AppStore.
If you have a Logitech Extreme 30 Pro joystick or Playstation PS3 controller, the only file you should need to modify immediately in the repository is the autopylot.makefile, whose first non-commented lines you should change to reflect where you put the AR.Drone SDK. You should also modify the lines right below there that specify which kind of controller you have and its hexadecimal ID (which you can find by issuing the lsusb command in Linux). If you have some other kind of gamepad, like a Nintendo Wii, you'll have to modify autopylot_gamepad.c to reflect this. If you're using Python, make sure to get the Python development environment:
sudo apt-get install python-dev
|0||Rock left/right||Roll (sideways travel)|
|1||Rock forward/back||Pitch (forward/backward travel)|
|2||Twist clockwise/anticlockwise||Yaw (clockwise/anticlockwise turn)|
|5||Mini-joystick on top||Altitude (forward=down; backward=up)|
|2||IN-FLIGHT EMERGENCY CUTOFF|
|3||Zap (toggle front/belly camera)|
|0||Left-side stick left/right||Roll (sideways travel)|
|1||Left-side stick forward/back||Pitch (forward/backward travel)|
|2||Right-side stick left/right||Yaw (clockwise/anticlockwise turn)|
|3||Right-side stick forward/back||Altitude (forward=down; backward=up)|
|8 (select)||Exit program (IN-FLIGHT EMERGENCY CUTOFF)|
|3 (square)||Zap (toggle front/belly camera)|
|2 (×)||Toggle autopilot|
The autopilot is intially off, so you are flying the AR.Drone
manually. When you push the autopilot button (4 on the Logitech joystick,
× on the PS3), control is transferred to the
action function in
autopylot_agent.py. Any subsequent joystick / gamepad action returns control to you, providing an
emergency override. The function in autopylot_agent.py currently ignores the video and navigation data
input and just makes the drone turn clockwise. (I've noticed that the program can take several
seconds to report non-zero navigation data from the drone.) Note that the altitude and X/Y velocities
are approixmate, and that the minimum reported altitude is around 230 mm.
You can modify this function to do something
Working with Matlab
The file autopylot_agent.m contains Matlab code equivalent to the
Python code in autopylot_agent.py.
To run the Matlab version, comment-out the Python lines
(36-38) in autopylot.makefile, and un-comment the Matlab lines
you should have the following in your .bashrc file:
export MATLAB=/usr/local/MATLAB/R2013a # or whatever release you've installed
You will also need the csh command,
which is used by the Matlab Engine. To be sure you have this command,
do sudo apt-get install csh in your Ubuntu shell.
Working with C
If you prefer to program in C, comment-out the Python lines
in autopylot.makefile, un-comment the C lines
(50-51), and work with the code in autopylot_c_agent.c.
Running the Ball-Tracking Example
To run the example in the video, download
version of autopylot_agent.py. You will need OpenCV for Python,
which you can install by following the instructions
Copyright and licensing information can be found in the header of each source file. Please contact me with any questions or suggestions.