File Exchange

image thumbnail

Controller for AR.Drone

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

3 Downloads

Updated 08 Jul 2013

View License

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

'drone = ARDrone'
'drone.control'

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

Comments and Ratings (15)

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('192.168.1.1', 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.

Victoria.

muhd syahir

Hello phillip...is 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 fzhu@uh.edu

kamil

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 kml.orman@gmail.com

Philip,

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 cwilhelm@unm.edu.

daher

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('FTRIM','');
obj.command('CONFIG','\"control:altitude_max\", \"20000\"');
obj.command('REF','290718208');
obj.drive([0,0,-1,0]);
obj.drive([0,-0.5,0,0]);
obj.drive([-1,0,0,0]);
obj.command('REF','290717696')

end

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

Phillip Hege

@Chang&Arnau: For the AR Drone v1.7 I followed the documentation at http://www.robotappstore.com/Files/KB/ARDrone/ARDrone_SDK_1_7_Developer_Guide.pdf
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('192.168.1.1', 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.

Cheers

arnau

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

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

@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?

Cheers

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

it dont work.

daher

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

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor