File Exchange

image thumbnail

Controller for AR.Drone

version (3.67 KB) by Phillip Hege
Shows basic control functionality of a Parrot AR.Drone and displays navdata returned by the drone.


Updated 08 Jul 2013

View License

How To Use:
Connect to AR.Drone via wi-fi
navigate to command window

'drone = ARDrone'

follow on-screen instructions

Tested on mac osx and windows
uses AR.Drone firmware v1.7

Allows user to:
control drone using keyboard
view live navdata feed

Cite As

Phillip Hege (2021). Controller for AR.Drone (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (15)

Kendrick Buchala

Any updated code to use with the AR drone 2.0? Needed for a project ASAP.

Hello Phillip,

I have studied your code and I have seen that you use a udp connection to read navdata. I want to use udp to read real time video from the port 5555 of the drone, but I have tried this without success.

I create another udp connection (udp('', 5555, 'LocalPort', 5555)) and I read it with the command "fread". I get an error, and this error indicates that nothing has been read. As if nothing arrives to the port udp.

Have you any idea about where is the problem??

Sorry for my bad english.

Thanks in advance.


muhd syahir

Hello this controller matlab-based can be used for multiple ar drone control?If not, can you give me guideline on how to do the multiple control?

Phillip Hege

Hi everyone,
Sorry for my late response. I have been caught up with some other work.

@daher: By didn't work, what do you mean? Did it not take off at all? Go too far? I believe the drive commands take speed inputs. Therefore you have to designate how long to travel at that speed.

@corbin: I sent you an email 8/27/14 with no reply yet.

@kamil: Sorry, unfortunately I haven't spent the time to add video processing yet. If you have any insights, please let me know.

@fangsh: The code I posted ONLY works on ardrone 1 and NOT the ardrone 2.0. Within the ardrone 1 platform I only developed and tested on ardrone 1.7, so if it works on any other version that is by fluke. Based on what I have seen thus far in ardrone 2.0 their data variable is organized differently and thus is incompatible. I currently don't have an ardrone 2.0 to develop on yet, but when I do I'll be sure to write an updated controller for it. :)

I hope this helps.

Fangshi Zhu

Hi dear Philip,

I met a problem while trying to run your script by typing 'drone = ARDrone' in the command window. The error said:
"Attempted to access data(25); index out of bounds because numel(data)=24." Do you have any idea why did this happen?

BTW, I am using a ARDrone 2.0, which runs perfectly with AR.FreeFlight 2.4 on iPad. Is this caused by incompatibility between AR.Drone v1.7 and AR.Drone2_v2.4.8

The whole info showed in the command window after typing 'drone = ADRone' is shown below:

drone =

ARDrone with properties:

seq: 4
ARc: [1x1 udp]
ARn: [1x1 udp]
Control_State: []
Battery_Voltage: 0
Pitch: 0
Roll: 0
Yaw: 0
Altitude: 0
X_Velocity: 0
Y_Velocity: 0
NavData: 0

Attempted to access data(25); index out of bounds because numel(data)=24.

Error in ARDrone/ARDrone/navPacketRxCallback (line 70)
vBattery = [data(25) data(26) data(27) data(28)];

Error in instrcb (line 36)
feval(val{1}, obj, eventStruct, val{2:end});

Warning: The BytesAvailableFcn is being disabled. To enable the callback property
either connect to the hardware with FOPEN or set the BytesAvailableFcn property.

Have your ever tried your code on ARDrone2? Do you have a update to date script for latest version. Thanks your very much. If possible, please contact me through


Hi Philip,
Do you have a new work on the streaming video data?

my project related to the object tracking with Ardrone video signal

please email me at

Corbin Wilhelmi


My apologies for the late reply, mathworks didn't notify me of your post.

I believe that you need a TCP/IP instead of UDP in your comment below to Chang and amau.

Let's talk offline through a couple different things, please email me at


Hi Philip,
thanks for your clarifications. it is working perfectly with me. i was trying to do something based on your script. it is a waypoint function... i am not able unfortunately to make it working. could you please advise?
function waypoint(obj)

obj.command('CONFIG','\"control:altitude_max\", \"20000\"');


i have added key 'm' for waypoint, it didnt work..

Phillip Hege

@Chang&Arnau: For the AR Drone v1.7 I followed the documentation at
I am still working on decoding video myself. Chapter 7.2 is the section that discusses video streaming. The format should be universal and independent of operating system. However, I do know you need to setup another UDP connection (ex. udp('', 5555, 'LocalPort', 5555)). Just like with navdata, it needs a signal to begin the data stream, then you should be able to read the image/video feed.



can you give me some advice for geting a video stream on Microsoft windows? I found it only in mac

Chang Justin

How can I read the video stream from the AR.DRONE? Could you give me some advice? Thanks!

Phillip Hege

@daher: The code should generate a new popup window with the navdata labels in it. Also output instructions should be viewable in the command prompt

@Alan: Could you be more specific as to what issues you are running into?

@Corbin: All of the functions necessary should be included in the file. Which files does it say you're missing?


Corbin Wilhelmi

Please re-upload all of your function.m files. This will not work without the other functions that it calls. Best - C

Alan Moreira

it dont work.


Hi, can you please assist me with some hints, i am running your code in matlab 2012, 64 bit, no errors shown, but cant see anything happening when i execute 'drone.ARDrone' 'drone.control'

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!