PS Drone Documentation
PS Drone Documentation
Philipp de Graaff
The PS-Drone-API
1 Introduction 1
1.1 Disclaimer and License . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.2 Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3 Version . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
2 Tutorial 4
2.1 First flight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Glide vs stop and a better startup-sequence . . . . . . . . . . . . . . . . . . 6
2.3 Enhanced movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.4 Using the drone’s sensors . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.5 Configurate the drone . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
2.6 Detecting markers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
2.7 Using video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3 PS-Drone-API commands 24
3.1 Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1.1 Startup settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.1.2 startup() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2 Calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2.1 Calibration variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.2.2 trim() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2.3 mtrim() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2.4 mantrim() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.2.5 getSelfRotation() . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3 Movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.1 Movement variables . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.2 takeoff() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.3 land() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.4 setSpeed() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.5 stop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.3.6 Basic movement . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.3.7 move() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.3.8 relMove() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.3.9 turnAngle() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.4 NavData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.4.1 NavData variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.4.2 useDemoMode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.4.3 useMDemoMode() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
iii
Contents
3.4.4 getNDpackage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.4.5 addNDpackage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.4.6 delNDpackage() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.4.7 reconnectNavData() . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.5 Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.5.1 Configuration variables . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.5.2 getConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.5.3 setConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.5.4 setConfigSessionID() . . . . . . . . . . . . . . . . . . . . . . . 32
3.5.5 setConfigUserID() . . . . . . . . . . . . . . . . . . . . . . . . . 32
3.5.6 setConfigApplicationID() . . . . . . . . . . . . . . . . . . . . 33
3.5.7 setConfigAllID() . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.5.8 sendConfigIDs() . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.5.9 setMConfig() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
3.6 Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.6.1 Video variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.6.2 startVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.6.3 stopVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3.6.4 saveVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.6.5 fastVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.6.6 midVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.6.7 slowVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.6.8 frontCam() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.6.9 groundCam() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
3.6.10 sdVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.6.11 hdVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.6.12 mp4Video() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
3.6.13 showVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6.14 hideVideo() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6.15 videoFPS() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.6.16 videoBitrate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
3.7 Convenient Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.7.1 getBattery() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.7.2 getKey() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.7.3 angleDiff() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
3.7.4 printDefault() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.7.5 printRed() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.7.6 printGreen() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.7.7 printYellow() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.7.8 printBlue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.7.9 printPurple() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.7.10 printLineUp() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.7.11 doggyHop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
3.7.12 doggyNod() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
3.7.13 doggyWag() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
iv
Contents
4 NavData packages 47
4.1 State . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
4.2 NavData . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.2.1 ¨demo¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.2.2 ¨time¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.2.3 ¨wifi¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.2.4 ¨magneto¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2.5 ¨altitude¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2.6 ¨pressure raw¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2.7 ¨wind speed¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
4.2.8 ¨kalman pressure¨ . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2.9 ¨zimmu 3000¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2.10 ¨raw measures¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
4.2.11 ¨phys measures¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2.12 ¨references¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2.13 ¨rc references¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . 52
4.2.14 ¨gyros offsets¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2.15 ¨euler angles¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2.16 ¨watchdog¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2.17 ¨trims¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2.18 ¨pwm¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
4.2.19 ¨vision¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.20 ¨vision stream¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.21 ¨vision of¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.22 ¨vision raw¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.23 ¨vision detect¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.24 ¨vision perf¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.25 ¨hdvideo stream¨ . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.26 ¨games¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
4.2.27 ¨trackers send¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.2.28 ¨adc data frame¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
4.2.29 ¨chksum¨ . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
v
Contents
5 Configuration entries 57
5.1 General . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
5.2 Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
5.3 Detect . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
5.4 Video . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
5.5 LEDs, Syslog and Pic . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
5.6 Custom . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
5.7 GPS, Network and Userbox . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
vi
List of Tables
4.1 State-entries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
vii
Listings
viii
1 Introduction
PS-Drone is a full featured API, written in and for Python, for Parrot’s AR.Drone 2.0. It
is based on a part of a master of computer science degree dissertation and was designed to
be easy to learn, but it offers the full set of the possibilities of the AR.Drone 2.0, including
Sensor-Data (aka NavData), Configuration and full Video-support.
It was also designed to be as fast as Python can be. Unneeded functions can be deactivated
which allows your program to run on really slow computers like Intel Atom N270 with
1.6GHz. The video function is not restricted to mere viewing; it is also possible to analyze
video images data using OpenCV2.
Obviously, the PS-Drone is perfect for teaching purposes; however, even the requirements
for professional purposes can be satisfied. The nomenclature refers to the official definition
of parrot and its SDK, so it is easy to find some additional help in newsgroups or elsewhere
on the internet by simply typing in the pre-existing keywords.
The examples are easy to understand for people with little programming experience. This
Tutorial is a brief introduction for using this API, its most important commands and the
most important sensor values sent by the drone. For a full list of the commands and
a description of the sensor data, have a look to the PS-Drone documentary, starting in
chapter 3, page 24.
PS-Drone is not compliant to Parrots AR.Drone 1.0 ! It could be possible to fly and do
simple movements, but it is not possible to get any sensor-values. The PS-Drone-API
does not support new models like the Bebop aka AR.Drone 3.0, due significant changes
of Parrot’s communication-protocol. I will provide full support as soon as I get enough
donations to buy a Bebop-drone.
A port to Windows is planned, but compared to Linux, Windows does not support some
relevant functions. These functions have to be implemented manually.
I am not a money-grubbing monster, but it took me several months and killed two drones
to create PS-Drone and its documentation; so it would be nice to get some donations for
further development (e.g. for Parrot’s Bebop) and as a appreciation.
Beware, stinginess may lead to bad breath of your dog, sexually transmitted disease and
watching reality-shows while listening to the greatest hits of the worst boy-groups for
eternity !Think about it, a dollar is not too much. *nudge*
PS-Drone is available for free on www.playsheep.de/drone
1
1.1 Disclaimer and License
2
1.2 Requirements
1.2 Requirements
To program the drone you need a computer or virtual machine with a POSIX compliant
operating system like Linux and an AR.Drone 2.0 of any edition. OpenCV2 is recom-
mended and necessary for video-support. To use all functions without limitation a CPU
equal 1.83GHz Intel Core Solo T1400 is needed, a 2.4GHz E6600 Core 2 Duo CPU or
better is recommended for video-analysis.
PS-Drone was programmed and mostly tested on a computer with an Intel Atom N270,
running a Linux Mint 13. The used drones were standard AR.Drones 2.0 by Parrot using
Firmware 2.2.6 and 2.3.3.
1.3 Version
2.0.0 beta: Transferred source code from PdG-Drone to PS-Drone, some bug-fixes,
changed start-up-sequence, more consistent command names, functions added, source code
clean up, enhanced comments in source-code, multiple drone controlling, video initializa-
tion recovery. (Nov 2014)
2.0.0: Several minor bug-fixes and checked orthography. (Dec 2014)
2.0.1: Several major bug-fixes in movement-commands. Only perform the reset-command,
if the drone is in fail-mode. Added missed State-bit. Error-messages regarding additional
NavData for AR.Drones 2.0 with firmware version 2.4.8 are patched. (Dec 2014)
3
2 Tutorial
It is not as complicated as it might look at first sight. First, make sure you are run-
ning a POSIX compliant operating system, Linux is suggested, and make sure that
python 2.x is installed. In case you want to use the drone’s video, is also neces-
sary to install OpenCV2. If you do not have any experience with Linux, try Knoppix
(http://www.knopper.net/knoppix/index-en.html), the Linux Mint 17 live Im-
age (http://linuxmint.com) or install a Linux (Linux Mint 17 MATE Edition is
pretty nice) on a virtual machine (f.e. virtualBox (https://www.virtualbox.org)).
Parrot’s AR.Drone 2.0 is by default a flying WiFi-hotspot. By default, it communicates
unencrypted on a channel named ardrone2 xxxxxx, using IP 192.168.1.1 and offers
a DHCP-Server, which means a client will (regularly) get IP 192.168.1.2.
As a suggestion, in case you are using a LAN-connected PC, attach a wifi-router in client
mode to connect to the drone and add an additional IP-address (e.g. 192.168.1.9) to
your PC.
When every everything is set up, start directly the PS-Drone-API-program which includes
a simple demo program how to control the drone with your keyboard:
python ps drone.py
Key Movement
<space> take-off or land
<0> stop moving
<w> move forward
<s> move backward
<a> move left
<d> move right
<q> turn left
<e> turn right
Try pressing numbers, <*>, <+>, or <->, any not listed key will land the drone and
end the demo.
4
2.1 First flight
When you are done, take a look at the first example firstTry.py.
import time
import ps drone #Imports the PS-Drone-API
drone = ps drone.Drone() #Initials the PS-Drone-API
drone.startup() #Connects to the drone and starts subprocesses
drone.takeoff() #Drone starts
time.sleep(7.5) #Gives the drone time to start
drone.moveForward() #Drone flies forward...
time.sleep(2) #... for two seconds
drone.stop() #Drone stops...
time.sleep(2) #... needs, like a car, time to stop
drone.moveBackward(0.25) #Drone flies backward with a quarter speed...
time.sleep(1.5) #... for one and a half seconds
drone.stop() #Drone stops
time.sleep(2)
drone.setSpeed(1.0) #Sets default moving speed to 1.0 (=100%)
print drone.setSpeed() #Shows the default moving speed
drone.turnLeft() #Drone moves full speed to the left...
time.sleep(2) #... for two seconds
drone.stop() #Drone stops
time.sleep(2)
drone.land() #Drone lands
5
2.2 Glide vs stop and a better startup-sequence
In this section, the term “thrust” is also used for speed; because, basically, speed is caused
by thrust.
The following example glideNstop.py shows the difference between active stopping and
holding position on the one hand; and reducing the thrust to 0.0 on the other. Active
stopping will cause the drone to hold position, while giving no thrust will make the drone
to glide on; it will just get slower due to air drag. If you want to experience the difference
between the two yourself, start the program, push the flying drone and see what happens.
6
2.2 Glide vs stop and a better startup-sequence
For a clean start up some additional code has been added, because a just time-based
controlling is rarely not a good solution. As a suggestion just copy and paste this start
up-sequence to your own code.
The first lines remain more or less the same. Resetting the drone makes it work again, if
the drone’s firmware blocks flying, indicated by red LEDs. A reset takes a while and the
drone does not send data in the meantime. When sending data again (the battery status
will be checked here), the drone has almost finished, but still needs a little time.
The commands useDemoMode(val) and getNDpackage(val) will be explained later,
the values True and [¨demo¨] are standard-settings anyway.
However, it could happen that you require more data and faster. Therefore, a brief expla-
nation beforehand: The drone sends its sensor-/NavData in a large bunch. This includes
several packets called ¨demo¨, ¨time¨, ¨altitude¨ and so on, with specified data.
In demo-mode, there are only the packages ¨demo¨ and ¨vision detect¨ available,
7
2.3 Enhanced movement
both 15 times per second; most of the time, this is enough and perfect for learning or
debugging. Switching off the demo-mode means all NavData-packages are available, 200
times per second.
Available NavData-values are always stored in an array called ¨NavData¨. First dimen-
sion is the name of the small package the values are stored in. Position [0][2] stores
the drone’s landed-status-tag. If not set anymore, the drone is ready for action.
It has already been mentioned, that a take-off takes around seven seconds. However, this
example uses the drone’s flight-status. There will be a further explanation later.
The command getKey() has been added for convenience and has technically nothing to
do with the drone. Use it to get the value of a pressed key, without worrying about timing,
deadlocks and other annoying effects.
Notice that there is no command to land the drone, PS-Drone does it for you at the end
of your program. The example stops when a key was pressed that is not <space>.
It is recommended to implement an emergency stop in your code which will land the
drone by pressing a key. Also a powerpoint-remote control is suggested in order to be
more mobile; a pressed key on that remote control is like pressing a key or a key chain on
the keyboard and simple to implement.
It is now time for the last important movement and movement-related commands as shown
in example moveTurn.py in listing 2.3.
The move()-command combines all the basic movements that have already been intro-
duced. So you can make the drone fly to the right, backwards, down and turn to the right
at the same time; and with different speed in each direction.
The move()-command expects four values for the directions ’right’, ’forward’, ’up’ and
’turn right’ : move(right, forward, up, turn right)
Like the basic movements, the range for the speed-value is 0.0 to 1.0, representing 0%
to 100% of the drone’s top speed. By setting a negative value, the drone will reverse its
direction; for example, the value -0.5 for forward-speed lets the drone fly backwards.
The command turnAngle() lets the drone turn to the left or the right in the exact
given degrees. This command requires values for a certain degree in order to turn to the
right and the speed to do so. If you use a negative degree value, the drone rotates to the
left. turnAngle() blocks which means that following commands are not processed until
turnAngle() has been executed. So there is no clean way to stop the movement, for
example as an emergency stop, until its done.
Optional, you can set a value for accuracy, the allowed mismatch of the given degree. The
default value is ±0.005◦ and ±0.1◦ , depending on the drone’s Demo-Mode-status. The
less accurate the turn is, the faster is it done.
The maximum turn is a half rotation; the angle-value can be at most ±180.0◦ .
Known bug: this command is not able to perform an exact turn of 180.0◦ ; instead, the
drone tries to find its destination angle until the battery is dead and without the possibility
to stop the drone neatly. This bug will be fixed soon.
8
2.3 Enhanced movement
In order to hold position and not drift away slowly in any direction, the drone’s sensors for
orientation need to be calibrated on horizontal ground. The drone’s firmware does a good
job recalibrating these sensors in case of inaccuracy, using the sensors for acceleration. If
it is necessary to recalibrate the sensors later, use the command trim(). Use it before
takeoff() and give the drone a second to calibrate.
Technically, the accuracy of a sensor’s measurements differs from sensor to sensor also
depending on external influences like temperature. So the gyroscope-sensor for rotation
slowly alters its value, even if the drone is on the ground and not moved.
If it is necessary to be exact, you can get the false measured self-rotation by the command
getSelfRotation(val) in degrees per second, stored in variable selfRotation.
9
2.4 Using the drone’s sensors
This command expects the time to measure as value. Of cause: the more time you
give to measure the more accurate is the result. turnAngle() considers the value of
selfRotation for exact turns.
Note: With the firmware version 2.2.6, the automatic value alteration of the gyroscope-
sensor was around 0.0185◦ /sec. Parrot fixed this auto alteration with the firmware version
2.3.3, but now the entire drone rotates, about 360◦ in 20 minutes, without any recognition
of the gyroscope-sensor. If you yet have not updated, the suggestion is to stay with version
2.2.6. Firmware-version 2.4.8 has not tested, yet.
10
2.4 Using the drone’s sensors
While a program-loop using NavData, it is suggested to wait for the next time-unit by
using the NavDataCount as shown in the previous example.
11
2.4 Using the drone’s sensors
No Name 0: 1:
[ 10 ] NavData demo All NavData NavData demo
[ 12 ] Motors status OK Problem
[ 15 ] Batterystatus OK Too low
[ 18 ] Magnetometer calib No calibration needed Calibration needed
[ 20 ] Wind mask OK Too much wind
[ 21 ] Ultrasonic sensor OK Deaf
[ 31 ] Emergency landing No emergency Emergency
12
2.4 Using the drone’s sensors
¨demo¨-package:
Shows the most important values at all, like some status-tags and information about slope,
acceleration and battery charge.
Pos Note
[ 0 ][ 2 ] Status-tag for ¨landed¨ - Drone is on the ground or not fully flying
[ 0 ][ 3 ] Status-tag for ¨flying¨ - Drone is flying
[ 0 ][ 4 ] Status-tag for ¨hovering¨ - Name should be: ¨landing¨, the drone is landing
[1] Battery-status in percent
[ 2 ][ 0 ] Pitch in degree (front/back)
[ 2 ][ 1 ] Roll in degree (left/right)
[ 2 ][ 2 ] Yaw in degree (turn)
[3] Altitude in cm (only when flying)
[ 4 ][ 0 ] Estimated speed in X in mm/s (forward/backward, only when flying)
[ 4 ][ 1 ] Estimated speed in Y in mm/s (left/right, only when flying)
[ 4 ][ 2 ] Estimated speed in Z in mm/s (up/down, only when flying)
Figure 2.1: Status-tags while taking off and landing of an AR.Drone 2.0
¨magneto¨-package:
Pos Note
[0] Magnetometer values for X, Y and Z
[1] Raw magnetometer values for X, Y and Z
¨pressure raw¨-package:
Pos Note
[0] A raw value, the height is calculable, the higher the drone flies the lower the
value (about 80cm per count)
13
2.4 Using the drone’s sensors
¨altitude¨-package:
Pos Note
[3] Altitude in mm
¨kalman pressure¨-package:
Pos Note
[1] Estimated height (only when flying)
¨wind speed¨-package:
Pos Note
[0] Windspeed (only when flying)
[1] Angle of wind (only when flying)
¨pwm¨-package:
The motors are controlled by pulse-wide modulation. The higher the value, the higher is
the rotation velocity of the propellers.
Pos Note
[ 0 ][ 0 ] Shows the actual pwm-value for the motor on the front left
[ 0 ][ 1 ] Shows the actual pwm-value for the motor on the front right
[ 0 ][ 2 ] Shows the actual pwm-value for the motor on the back right
[ 0 ][ 3 ] Shows the actual pwm-value for the motor on the back left
¨vision detect¨-package:
Gives information on up to four detected markers. In order to detect markers, some
configurations needs to be done first.
Pos Note
[0] Number of detected marker (max 4)
[1] List of the types of detected markers
[2] List of the X-positions of detected markers
[3] List of the Y-positions of detected markers
[4] List of the dimensional width of detected markers
[5] List of the dimensional depth of detected markers
[6] List of the distances of detected markers
[7] List of the orientation angles of detected markers
[9] List of the rotations of detected markers
¨chksum¨-package:
Pos Note
[0] Checksum
[1] Quality: incorrect/correct
14
2.5 Configurate the drone
Before working with video, it is necessary to understand some basic configuration issues.
Depending on configuration-settings the drone behaves differently, so is e.g. the command
useDemoMode(), beside others, an alias for a reconfiguration of the drone.
The AR.Drone 2.0 has 104 information and configurable options. Some entries give a
status and are only readable, like ¨general:flight time¨, some are editable, e.g.
¨general:ardrone name¨. These simple text strings, more or less, consist of two
parts; the first part is the option’s name, containing the category and the option, the
second part is the set value.
The PS-Drone supports you by organizing the complex procedures of communication and
its handling, so a reconfiguration is not so tricky. You cannot “brick” the drone, but it is
always better to know what you are doing.
It is important to know that reconfigurations are set with a delay, depending on the
quantity of configurations to set at once. Depending on the drone’s firmware (e.g. version
2.3.3) that procedure is optimized by temporarily sending extra NavData in between.
Furthermore, it happens once in a while that the drone’s reactions are inconsistent after
an alteration: The drone claims that the value has been set, but it maintains its previous
15
2.5 Configurate the drone
setting. It seems that this concerns mainly video: Sometimes a switch to ground-camera
has been acknowledged, but the front-view is still visible.
Here is an example how to get and set the drones configurations:
16
2.5 Configurate the drone
for i in drone.ConfigData:
if i[0]==¨control:altitude max¨:
print str(i)+¨ Count: ¨+str(drone.ConfigDataCount)\
+¨ Timestamp: ¨+str(drone.ConfigDataTimeStamp)
print¨\n-----¨
print¨Setting \¨control:altitude max\¨ to \¨2980\¨,\
\¨control:altitude min\¨ to \¨499\¨ and \
\¨video:video on usb\¨ to \¨false\¨...¨
CDC = drone.ConfigDataCount
NDC = drone.NavDataCount
refTime = time.time()
drone.setConfig(¨control:altitude max¨,¨2980¨) # Change of an option
drone.setConfig(¨control:altitude min¨,¨499¨) # Change of an other option
drone.setConfig(¨video:video on usb¨,¨false¨) # Change of an other option
while CDC==drone.ConfigDataCount: time.sleep(0.001) #Wait until it is done
print¨ Finished after ¨+str(time.time()-refTime)+¨ seconds, ¨\
+str(drone.NavDataCount-NDC)+¨ NavData where received meanwhile.¨
for i in drone.ConfigData:
if i[0]==¨control:altitude max¨ or i[0]==¨control:altitude min¨\
or i[0]==¨video:video on usb¨:
print str(i)+¨ Count: ¨+str(drone.ConfigDataCount)\
+¨ Timestamp: ¨+str(drone.ConfigDataTimeStamp)
print¨\n-----¨
print¨Just resyncing the drones configuration...¨
CDC = drone.ConfigDataCount
NDC = drone.NavDataCount
refTime = time.time()
drone.getConfig()
while CDC==drone.ConfigDataCount: time.sleep(0.001) #Wait until it is done
print¨ Finished after ¨+str(time.time()-refTime)+¨ seconds, ¨\
+str(drone.NavDataCount-NDC)+¨ NavData where received meanwhile.¨
For reconfiguration you mainly need two commands: getConfig() and setConfig()
getConfig() will synchronize the local copy of the drone’s configuration and
stores the list in the variable ConfigData, along with the time when it was
received in ConfigDataTimeStamp and the count of received configurations in
ConfigDataCount. The fetch of the drone’s configuration works not in real-time and
may take up to 0.15 seconds.
The command setConfig(¨option¨,¨value¨) sets the value for the given option.
The name of the option has to be a text-string. As alterations are not in real-time, in
order to optimize the configuration-speed and for convenience, the request is added to
a queue and sent one after another without you having to care about. PS-Drone tests
the queue for double entries of the same option and initiates the latest change to prevent
unnecessary delay.
If you try to set an unknown option, the drone will reject the request; however, if the
value is unknown, the drone sets an unpredictable value itself. When the queue is done,
the local copy of the drone’s configuration is automatically updated analogue to command
getConfig().
17
2.5 Configurate the drone
Not all of the options and their possible values are guessable, some are not even doc-
umented by Parrot. Take a look at chapter 5, starting on page 57 to find the known
descriptions of the entries.
A mode for multi-configuration is also existing. It is mainly interesting for using video
and it contains the configurations for the set sessions. It is not really necessary to care
about how it works; however, once you have started using it, you must continue to use it
until your program has finished or until you have switched back to single-configuration.
As you see, multi-configuration does not really differ from normal configuration.
After having enabled multi-configuration by sending pre-set IDs with the command
setConfigAllID(), you change configurations by using the command setMConfig()
which has the same usage and behaviour as setConfig().
18
2.6 Detecting markers
The AR.Drone 2.0 supports detecting certain machine-parsable images using its cameras.
These particular images are called “tags” or “markers”. It is an integrated feature of
the drone able to detect up to four markers; their position, distance to the drone and,
depending on the marker, their orientation at the same time.
The cameras of the drone (tested with a standard AR.Drone 2.0) are not really good, so
there is a limited range of luminance in which it is possible to get acceptable results. Also
spotlights and reflections of marker-printouts are a serious problem.
The marker that comes with the drone is the “black and white oriented roundel”. It is
recommended for the following tests, not least because the drone detects it most certainly.
The tag “Roundel” has also been tested, but, because it contains specific colors, it is
harder for the drone to detect it.
19
2.7 Using video
For using the drones video, the package “OpenCV2” is used for decoding, preparing and
analyzing the images. Using this API to work with the drone’s video-function, it is pretty
simple to make yourself familiar with. However, it is still helpful to have some theoretical
background knowledge:
The video-stream of Parrots AR.Drone 2.0 is H.264 or MPEG4 coded (to be exact:
MPEG4.10 respectively MPEG4.2).
Both codecs work with “I-frames”, also known as “key-frames”, which store the whole
information of an image like a photo or picture, and “P-Frames”, which store just the
difference to the preceding frame. I-frames are followed by a certain amount of P-frames.
A P-frame always refers to the preceding frame (I-frame or P-frame) and stores only the
information that differs from this preceding frame. This might be useful to know as de-
coding the videostream is pretty complex and needs considerable CPU-usage. For slow(er)
computers for which it is impossible to decode every frame in real-time, it is for example
not possible to decode every second frame, as P-frames refer to the preceding frame. The
result would be a loss of information causing an incorrect and distorted image.
Stylized depiction of a video sequence showing one I-frame, followed by five p-frames
20
2.7 Using video
So, decode all or nothing ? Not really, because PS-Drone offers, beside lowering the video-
bitrate, the opportunity just to decode the key-frames which are received in a strict period,
for up to 95% less CPU-usage.
If you like to examine footage of colored objects, it is also helpful to know that both codecs
store their information as progressive 4:2:0 YUV. That means, that every picture is stored
as a whole (no two interlaced half pictures) and pixels are represented by luminance, the
color’s saturation and the color’s hue. The color slides from red (0) to green (85) and blue
(170) back to (allmost) red (255).
In a square of 2 × 2 pixels, every pixel has its own value for brightness, but all four pixels
share the same value for color. That is due to the fact, that the human eye cannot notice
colour related differences as good as differences in luminance. Also different shades of blue
are not as good distinguishable as different shades of green or red, that is why blue is also
stripped down by the compression codecs. These are usual techniques to reduce a video’s
data stream and not a special limitation of the drone or PS-Drone.
The H.264-codec is a pretty recent method to reduce and compact a video-stream. The
drone sends the pictures for both cameras in resolutions of 1280×720 and 640×360 pixels.
The MPEG4-codec is older than H.264; it needs more bandwidth, but also less CPU-power
to decode and is suggested for slow computers. The drone’s resolution for MPEG4-streams
is 640 × 368 pixels, but the additional 8 lines contain no usable information. The pictures
might be sharper, but there is a tendency for “blocking”, if the bit-rate is too low for all
the information of the videostream.
The drone’s default video-settings are a H.264 coded, 640 × 360 pixel resolved videostream
of the front camera. It is recommended to set the video codec and the resolution before
starting the video function and not to change it while it is running.
21
2.7 Using video
The first step to enable video is to switch the drone to the multi-configuration mode,
using setConfigAllID() as mentioned before. Remember to use the command
setMConfig() for changing the drone’s configurations.
After the video-resolution and the video-codec have been set, using the commands
sdVideo()/hdVideo() and mp4Video(), give the drone some time to adjust these
settings (you can either just wait or check for changes of ConfigDataCount). It will
take one to three seconds until the video is fully operable.
Again, it is highly recommended not to alter video-resolution and -codec after the video
function has been started. Nevertheless, it is always possible to set or alter any other
command any time.
As mentioned before, the AR.Drone 2.0 might have a bug when it comes to setting up
the video function. Sometimes the request for a change is set and confirmed by the drone
(e.g. switching from front to bottom camera), but nothing happens. Unfortunately, there
is no workaround for this.
22
2.7 Using video
The usage of the video-images is similar to NavData and ConfigData: Every single de-
coded video picture is stored as an openCV2-image-object in the variable VideoData,
its timestamp is stored in VideoImageTimeStamp and the time it took to decode in
VideoDecodeTime.
The variable VideoReady shows the status of the video-related processes.
The commands frontCam() and groundCam() allow to change the streamed camera;
the commands showVideo() and hideVideo() open and hide a window which shows
the drone’s actual view.
If the used computer is too slow to decode the drones videostream in real-time, you can
switch to more economic modes by using the commands slowVideo() and midVideo().
Both commands determine that only keyframes are decoded, which also means that the
frame-rate is decreasing; depending on resolution, used camera and codec, it is between 1
to 2 frames per second.
Due to internal buffers, slowVideo() has a higher delay, midVideo() needs more time
to process, but has the same delay as fullVideo(). Using slowVideo() reduces the
CPU usage for decoding by 92% - 96%, using midVideo() by 33% - 82%.
Please note: it is possible that the video initialization can fail for various reasons. It
tries to detect and recover the initialization, but it is suggested to start the video-function
before the take off.
That is all! For further information and all commands, please see chapter 3, beginning on
page 24.
23
3 PS-Drone-API commands
3.1 Startup
DroneIP
IP-address of the drone as a string. Manually editable. (Default: ¨192.168.1.1¨)
NavDataPort
Port-number through which the drone sends the NavData-stream, as an integer.
Manually editable. (Default: 5554)
VideoPort
Port-number through which the drone sends the video-stream, as an integer.
Manually editable. (Default: 5555)
CMDPort
Port through which the drone receives commands, as an integer.
Manually editable. (Default: 5556)
CTLPort
Port-number through which the drone sends its configuration, as an integer.
Manually editable. (Default: 5559)
3.1.2 startup()
Connect to the drone.
Usage: startup()
Return: None
Note: After setting drone’s IP and Ports, use this command next.
Example: drone.startup()
3.2 Calibration
selfRotation
Contains the self-spinning correction value yaw gyrometer in degrees per second,
measured by getTolerances() or manually editable. (Default: 0.0185)
24
3.2 Calibration
3.2.2 trim()
Drone sets the reference to the horizontal plane.
Usage: trim()
Return: None
Note: Drone has to be on the ground.
Example: drone.trim()
3.2.3 mtrim()
Drone calibrates magnetometer.
Usage: mtrim()
Return: None
Note: Drone has to fly to rotate one time.
Example: drone.mtrim()
3.2.4 mantrim()
Manual calibration of drone’s gyrometers.
Usage: mantrim(theta,phi,yaw)
Return: None
Name: Type: Description:
theta float Sets the correction theta-angle (sideward)
phi float Sets the correction phi-angle (forward/backward)
yaw float Sets the correction yaw-angle (horizontal turn)
3.2.5 getSelfRotation()
Drone measures out the yaw gyrometers self spinning.
Usage: getSelfRotation(time)
Return: Yaw gyro self-spinning correction value in degrees per second.
Name: Type: Description:
time integer Time to measure
Note: Drone has to be on the ground, useful for turnAngle() or highly accurate
measures. The value is stored in selfRotation.
Example: drone.getSelfRotation(10)
25
3.3 Movement
3.3 Movement
speed
The drone’s default movement speed, editable by setSpeed(). (Default: 0.2).
3.3.2 takeoff()
Drone takes off and enters flight mode.
Usage: takeoff()
Return: None
Note: Necessary before any movement command.
Example: drone.takeoff()
3.3.3 land()
Drone lands and leaves flight mode.
Usage: land()
Return: None
Note: -
Example: drone.land()
3.3.4 setSpeed()
Sets the optional speed of drone’s movements.
Usage: setSpeed(speed)
Return: speed
Name: Type: Description:
speed float Speed value from 0.0 to 1.0 ; from not active to full thrust.
Note: Good for basic movement commands.
Example: drone.setSpeed(0.5)
3.3.5 stop()
Drone stops all movements and holds position.
Usage: stop()
Return: None
Note: Use this command to stop. Setting the speed of movement to 0.0 makes the
drone glide into the same direction as before and not hold its position.
Example: drone.stop()
26
3.3 Movement
Note: Very basic movements for first tests, with only one movement at a time.
Setting all values to 0.0 does not make the drone stop, but glide in the same
(horizontal) direction as before. To stop movement, use stop() instead.
Example: drone.moveLeft(0.4)
3.3.7 move()
Drone moves to all given directions in given speed.
Usage: move(right,forward,up,turn right)
Return: None
Name: Type: Description:
right float Speed value from -1.0 to 1.0 from full speed left to full speed right
movement, 0.0 for passive.
forward float Speed value from -1.0 to 1.0 from full speed backward to full
speed forward movement, 0.0 for passive.
up float Speed value from -1.0 to 1.0 from full speed descent to full speed
ascent movement, 0.0 for passive.
turn right float Speed value from -1.0 to 1.0 from full speed left to full speed right
rotation, 0.0 for passive.
Note: Setting all speed values to 0.0 would not stop movement; use stop()
instead.
Example: drone.move(0.0,0.8,-0.1,0)
27
3.3 Movement
3.3.8 relMove()
Drone moves, relative to start position and angle, to all given directions in given speed.
Usage: relMove(right,forward,up,turn right)
Return: None
Name: Type: Description:
right float Speed value from -1.0 to 1.0 from full speed left to full speed right
movement relative to start position, 0.0 for passive.
forward float Speed value from -1.0 to 1.0 from full speed backward to full speed
forward movement relative to start position, 0.0 for passive.
up float Speed value from -1.0 to 1.0 from full speed descent to full speed
ascent movement, 0.0 for passive.
turn right float Speed value from -1.0 to 1.0 from full speed left to full speed right
rotation, 0.0 for passive.
Note: Use mtrim() before using relMove(). Setting all speed values to 0.0
would not stop movement; use stop() instead.
Example: drone.relMove(0.0,0.8,-0.1,0)
3.3.9 turnAngle()
Drone turns exactly by a given angle.
Usage: turnAngle(degree,maxspeed,optional)
Return: success
Name: Type: Description:
turnangle float degree to turn. negative for left, positive for right rotation.
maxspeed float Speed value from 0.0 to 1.0 from passive to full speed.
If value is 0.0 (passive), value from speed will be used instead.
optional float Accurateness for rotating to given target-angle.
Default for demo-mode is ±0.1◦ for full-mode ±0.005◦ .
sucess bool True, when finished the turn.
28
3.4 NavData
3.4 NavData
3.4.1 NavData variables
NavData
Contains the NavData-values as python dictionary. More details in section 4 (start-
ing on page 47) and the source-code of ps drone.py. Not editable.
State
Contains the drone’s states as a list. More details in section 4.1 (page 48) and the
source-code of ps drone.py. Not editable.
NavDataCount
The Sequential number of the NavData package. Not editable.
NavDataTimeStamp
Time when the NavData package, stored in NavData, was decoded. Not editable.
NavDataDecodingTime
Time needed to decode the NavData package, stored in NavData. Not editable.
NoNavData
Success-tag of decoding the drone’s NavDatas. Will be False if a failure occurs;
values of Navdata will be not actual. Not editable.
3.4.2 useDemoMode()
Switch between the NavData demo- and full-mode.
Usage: useDemoMode(optional)
Return: None
Name: Type: Description:
optional boolean True: Use demo-mode or not set. False: Use full-mode.
Note: The NavData are sent 200 times per second in full mode and contain, by de-
fault, all data. In demo mode, 15 NavData are sent per second and contain,
by default, a subset of data.
Example: drone.useDemoMode(True)
3.4.3 useMDemoMode()
Switch between the NavData demo and full mode in a multi-configuration environment.
Usage: useMDemoMode(optional)
Return: None
Name: Type: Description:
optional boolean True: Use demo-mode or not set. False: Use full-mode.
Note: The NavData are sent 200 times per second in full mode and contain, by de-
fault, all data. In demo mode, 15 NavData are sent per second and contain,
by default, a subset of data.
Example: drone.useMDemoMode(True)
29
3.4 NavData
3.4.4 getNDpackage()
Sets the packages of the NavData sensor measurements to decode.
Usage: getNDpackage([packages])
Return: None
Name: Type: Description:
packages list A list of packages to decode. See name list in 3.1 below.
Note: Use item "all" to get all data.
Example: drone.getNDpackage(["demo","pwm","altitude","chksum"])
3.4.5 addNDpackage()
Adds packages of the NavData sensor measurements to decode.
Usage: addNDpackage([packages])
Return: None
Name: Type: Description:
packages list A list of packages to decode. See name list in 3.1 below.
Note: Use item "all" to add all data.
Example: drone.addNDpackage(["demo","pwm","altitude","chksum"])
3.4.6 delNDpackage()
Ignores packages of the NavData sensor measurements to decode.
Usage: delNDpackage([packages])
Return: None
Name: Type: Description:
packages list A list of packages to decode. See name list in 3.1 below.
Note: Use item "all" to ignore all data.
Example: drone.delNDpackage(["demo","pwm","altitude","chksum"])
30
3.5 Configuration
3.4.7 reconnectNavData()
Reinitializes the NavData communication after a signal loss.
Usage: reconnectNavData()
Return: None
Note: -
Example: drone.reconnectNavData()
3.5 Configuration
ConfigData
Contains the configuration of the drone as a list. Will be updated after a set of
configuration alterations have been transmitted; it will be also updated after the
command getConfig(). More details in section 5 (page 57). Not editable.
ConfigDataCount
Sequential number of received copies of the drone’s configuration which are stored
in ConfigData. Not editable.
ConfigDataTimeStamp
Time when the configuration, stored in ConfigData, was received. Not editable.
ConfigSending
Shows the status of setting configuration. It is True when in process. Not editable.
ConfigSessionID
Contains the drone’s session ID for multi-configuration-mode as a string.
Editable by setConfigSessionID(). (Default: ¨03016321¨)
ConfigUserID
Contains the drone’s user ID for multi-configuration-mode as a string.
Editable by setConfigUserID(). (Default: ¨0a100407¨)
ConfigApplicationID
Contains the drone’s application ID for multi-configuration-mode as a string.
Editable by setConfigApplicationID(). (Default: ¨03016321¨)
sendConfigSaveMode
Indicates that the drone’s reconfiguration settings will be done in a slower save-mode
when True. This variable reacts like a command with max 0.1 second delay when
changed. Manually editable. (Default: False)
For detailed information about configuration-options , see section 5.1 starting on page 57.
31
3.5 Configuration
3.5.2 getConfig()
Requests drone for a copy of its actual configuration.
Usage: getConfig()
Return: None
Note: No update in real time.
Example: drone.getConfig()
3.5.3 setConfig()
Changes drone’s configuration.
Usage: setConfig(parameter,value)
Return: None
Name: Type: Description:
parameter string Changes value of parameter as displayed in ConfigData.
value string Value to set
Note: Settings are not in realtime. ConfigData will be updated automatically
after all undone settings have been processed.
Example: drone.setConfig(¨control:altitude max¨,¨5000¨)
3.5.4 setConfigSessionID()
Sets the session ID for multi-configuration-mode, stores it in ConfigSessionID and
sends it to the drone.
Usage: setConfigSessionID(id)
Return: id
Name: Type: Description:
id string A string of eight hexadecimal digits.
Note: Set it before using multi-configuration-mode. Setting is not in real time.
Example: drone.setConfigSessionID(¨03016321¨)
3.5.5 setConfigUserID()
Sets the session ID for multi-configuration-mode, stores it in ConfigUserID and sends
it to the drone.
Usage: setConfigUserID(id)
Return: id
Name: Type: Description:
id string A string of eight hexadecimal digits.
Note: Set it before using multi-configuration-mode. Setting is not in real time.
Example: drone.setConfigUserID(¨0a100407¨)
32
3.5 Configuration
3.5.6 setConfigApplicationID()
Sets the session ID for multi-configuration-mode, stores it in ConfigApplicationID
and sends it to the drone.
Usage: setConfigApplicationID(id)
Return: id
Name: Type: Description:
id string A string of eight hexadecimal digits.
Note: Set it before using multi-configuration-mode. Setting is not in real time.
Example: drone.setConfigApplicationID(¨03016321¨)
3.5.7 setConfigAllID()
Sets the session, user and application IDs for multi-configuration-mode of the drone, stored
in ConfigSessionID, ConfigUserID and ConfigApplicationID
Usage: setConfigAllID()
Return: None
Note: Settings are not in real time.
Example: drone.setConfigAllID()
3.5.8 sendConfigIDs()
Identifies the following configuration by sending the session, user and application IDs for
the drone’s multi-configuration-mode, as stored in ConfigSessionID, ConfigUserID
and ConfigApplicationID.
Usage: sendConfigIDs()
Return: None
Note: setMConfig() might do what you want.
Example: drone.sendConfigIDs()
drone.setConfigIDs(¨video:video codec¨,¨131¨)
3.5.9 setMConfig()
Changes the drone’s configuration to multi-configuration-mode.
Usage: setMConfig(parameter,value)
Return: None
Name: Type: Description:
parameter string Changes value of parameter as displayed in variable ConfigData.
value string Value of configuration to set.
Note: Settings are not in real time. ConfigData will be updated automatically
after all settings have been processed. Necessary for most video settings.
Example: drone.setMConfig(¨video:video codec¨,¨131¨)
33
3.6 Video
3.6 Video
VideoImage
Contains the actual video-image of the drone as an OpenCV2 image-type, when
video is activated. Not editable.
VideoImageCount
Sequential number of decoded video-images which are stored in VideoImage.
Not editable.
VideoDecodeTimeStamp
Time when the video-image, stored in VideoImage, was decoded. Not editable.
VideoDecodeTime
Time needed to decode the video-image, stored in VideoImage. Not editable.
VideoReady
Indicates the online status of the video processes. Not editable.
SaveVideo
Indicates, that there is no pre-processing of the drone’s video-data-stream.
Not settable. (Default: False)
3.6.2 startVideo()
Activates and processes drone’s video.
Usage: startVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: activates and processes drone’s video,
False: stops drone’s video.
Note: Pictures of the video are available by VideoImage, start may take a second.
Example: drone.startVideo()
3.6.3 stopVideo()
Deactivates drone’s video.
Usage: stopVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: stops drone’s video,
False: activates and processes drone’s video.
Note: -
Example: drone.stopVideo()
34
3.6 Video
3.6.4 saveVideo()
All video pre-processing will be stopped.
Usage: saveVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: video save-mode,
False: optimized video mode.
3.6.5 fastVideo()
Processes the drone’s whole video-stream, when video is activated.
Usage: fastVideo(optional)
Return: It is the default video-mode.
Name: Type: Description:
optional boolean If not set or True: normal video-mode, False: slow video-mode.
Note: Default
Example: drone.fastVideo()
3.6.6 midVideo()
Only key-frames of the drone’s video-stream will be processed, when video is activated.
Usage: midVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: slow video-mode with a short delay,
False: fast video-mode.
Note: Depending on used video-codec, resolution and camera, every 15th to 30th
picture (see table 3.1 below) will be processed with no delay, but compared
to slowVideo() more performance is needed.
Example: drone.midVideo()
35
3.6 Video
3.6.7 slowVideo()
Only key-frames of the drone’s video-stream will be processed, when video is activated.
Usage: slowVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: slow video-mode, False: fast video-mode.
Note: Depending on used video-codec, resolution and camera, every 15th to 30th
picture (see table 3.1 below) will be processed with a delay of 2.5 to 5 seconds,
but compared to midVideo() less performance is needed.
Example: drone.slowVideo()
3.6.8 frontCam()
Switch to drone’s front camera.
Usage: frontCam(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: Switch to front camera,
False: Switch to ground camera.
Note: Default, requires multi-configuration-mode, no real-time-setting.
Example: drone.frontCam()
3.6.9 groundCam()
Switch to drone’s ground camera.
Usage: groundCam(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: Switch to ground camera,
False: Switch to front camera.
Note: Requires multi-configuration-mode, no real-time-setting.
Example: drone.groundCam()
36
3.6 Video
3.6.10 sdVideo()
Sets the drone’s video stream to H.264 encoded, with an image resolution of 640 × 360.
Usage: sdVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: Drone sends H.264-video-stream with 640×360,
False: Drone sends HD H.264-video-stream.
3.6.11 hdVideo()
Sets the drone’s video stream to H.264 encoded, with an image resolution of 1280 × 720.
Usage: hdVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: Drone sends H.264-video with 1280 × 720,
False: Drone sends SD H.264-video-stream.
3.6.12 mp4Video()
Sets the drone’s video stream to MPEG4.2 encoded, with an image resolution of 640×368.
Usage: mp4Video(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: Drone sends MPEG4-video-stream with
640 × 368, False: Drone sends SD H.264-video-stream.
37
3.6 Video
3.6.13 showVideo()
Displays drone’s video in a window.
Usage: showVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: starts displaying drone’s video,
False: hides drone’s video.
Note: Do not change resolution or codec when this function is enabled.
Example: drone.showVideo()
3.6.14 hideVideo()
Hides drone’s video.
Usage: hideVideo(optional)
Return: None
Name: Type: Description:
optional boolean If not set or True: hides drone’s video,
False: starts displaying drone’s video.
Note: -
Example: drone.hideVideo()
3.6.15 videoFPS()
Changes the frame rate of the video.
Usage: videoFPS(fps)
Return: None
Name: Type: Description:
fps integer Frames per second of drone’s video. Values: 1 - 60.
Note: Requires multi-configuration-mode, no real-time-setting.
Example: drone.videoFPS(15)
3.6.16 videoBitrate()
Changes the bitrate of the video stream.
Usage: videoBitrate(br)
Return: None
Name: Type: Description:
br integer Kilobit per second for drone’s video encoding.
Values: 250 - 20000.
Note: Requires multi-configuration-mode, no real-time-setting.
Example: drone.videoBitrate(4000)
38
3.7 Convenient Commands
3.7.1 getBattery()
Gets battery information of the drone.
Usage: getBattery()
Return: (batValue,batStatus)
Name: Type: Description:
batValue integer Battery charge level in percent.
batValue string Drone’s battery status, ¨OK¨ or ¨empty¨.
Note: -
Example: print ¨Battery: ¨+str(drone.getBattery()[0])+¨% ¨
+str(drone.getBattery()[1])
3.7.2 getKey()
Gets the character of a pressed key.
Usage: getKey()
Return: key
Name: Type: Description:
key string Character of a pressed key.
Note: -
Example: drone.getKey()
3.7.3 angleDiff()
Gets the difference between two measured angles.
Usage: angleDiff(base,degrees)
Return: difference
Name: Type: Description:
base float First angle in -180.0 to 180.0 degrees.
degrees float Second angle in -180.0 to 180.0 degrees.
difference float The smallest difference between first and second angle.
Note: -
Example: drone.angleDiff(-170,170)
39
3.7 Convenient Commands
3.7.4 printDefault()
Prints text in default color.
Usage: printDefault(optional)
Return: None
Name: Type: Description:
optional string Prints the optional string in default color, otherwise all following
text will print in default color.
Note: -
Example: drone.printDefault(¨All normal¨)
3.7.5 printRed()
Prints text in red color.
Usage: printRed(optional)
Return: None
Name: Type: Description:
optional string Prints the optional string in red color, otherwise all following.
Note: You may use printDefault() to disable red text.
Example: drone.printRed(¨Error¨)
3.7.6 printGreen()
Prints text in green color.
Usage: printGreen(optional)
Return: None
Name: Type: Description:
optional string Prints the optional string in green color, otherwise all following.
Note: You may use printDefault() to disable green text.
Example: drone.printGreen(¨OK¨)
3.7.7 printYellow()
Prints text in yellow color.
Usage: printYellow(optional)
Return: None
Name: Type: Description:
optional string Prints the optional string in yellow color, otherwise all following.
Note: You may use printDefault() to disable yellow text.
Example: drone.printYellow(¨Warning !¨)
40
3.7 Convenient Commands
3.7.8 printBlue()
Prints text in blue color.
Usage: printBlue(optional)
Return: None
Name: Type: Description:
optional string Prints the optional string in blue color,
otherwise all following.
3.7.9 printPurple()
Prints text in purple color.
Usage: printPurple(optional)
Return: None
Name: Type: Description:
optional string Prints the optional string in purple color,
otherwise all following.
3.7.10 printLineUp()
Following printout will appear one line up.
Usage: printLineUp()
Return: None
Note: -
Example: drone.printLineUp()
3.7.11 doggyHop()
Drone hops like a happy dog.
Usage: doggyHop()
Return: None
Note: -
Example: drone.doggyHop()
41
3.8 Misc commands
3.7.12 doggyNod()
Drone nods.
Usage: doggyNod()
Return: None
Note: -
Example: drone.doggyNod()
3.7.13 doggyWag()
Drone wags like a happy dog.
Usage: doggyWag()
Return: None
Note: -
Example: drone.doggyWag()
Version
Shows the version of the PS-Drone-API. Not editable.
startTime
Stores the PS-Drone-API’s starting-time. Not editable.
showCommands
If set, most commands from PS-Drone-API to the drone and communication between
the processes will be displayed. This variable reacts like a command with max 0.1
second delay when changed. Manually editable. (Default: False)
debug
If set, debug messages will be displayed. This variable reacts like a command with
max 0.1 second delay when changed. Manually editable. (Default: False)
valueCorrection
Enables the correction of most values, when out of range, if set. (Default: True)
42
3.8 Misc commands
3.8.2 reset()
Initiates a soft reset of the drone.
Usage: reset()
Return: None
Note: -
Example: drone.reset()
3.8.3 thrust()
Controls the motor thrust directly.
Usage: thrust(front left, front right, rear left, rear right)
Return: None
Name: Type: Description:
front left int Value from 0 to 255 for the front left motor thrust.
front right int Value from 0 to 255 for the front right motor thrust.
rear left int Value from 0 to 255 for the rear left motor thrust.
rear right int Value from 0 to 255 for the rear right motor thrust.
Note: Overrides the control of the drone’s system.
The order of motors differs from their values in "pwm"-NavData-package.
Example: drone.thrust(25,25,25,25)
3.8.4 pwm()
Controls the motor thrust directly.
Usage: thrust(front left, front right, rear left, rear right)
Return: None
Name: Type: Description:
front left int Value from 0 to 511 for the front left motor thrust.
front right int Value from 0 to 511 for the front right motor thrust.
rear left int Value from 0 to 511 for the rear left motor thrust.
rear right int Value from 0 to 511 for the rear right motor thrust.
Note: Deprecated ! Overrides the control of the drone’s system.
The order of motors differs from their values in "pwm"-NavData-package.
Example: drone.pwm(50,50,50,50)
3.8.5 shutdown()
Lands and disconnects from drone, determines PS-Drone-API.
Usage: shutdown()
Return: None
Note: Will run as last command, when the user’s-program ended, as default.
Example: drone.shutdown()
43
3.8 Misc commands
3.8.6 anim()
Drone does pre-set movement.
Usage: anim(movement, duration)
Return: None
Name: Type: Description:
movement int Number of animation, see list below.
duration int Duration of the animation
Note: -
Example: drone.anim(0,1)
anim discription
0 Short tipping about 30◦ to the left
1 Short tipping about 30◦ to the right
2 Short tipping about 30◦ front down
3 Short tipping about 30◦ front up
4 Slide to the left
5 Slide to the right
6 Spin clockwise
7 Spin clockwise and goes down
8 Yaw shake
9 Dance by rotating
10 Dance left/right
11 Dance forward/backward
12 Dance upward/downward
13 Tipping right then left. Tipping front up then down
14 Tipping left then right. Tipping front down then up
15 Double tipping left, then right. Double tipping front down, then up
16 Flip ahead
17 Flip backward
18 Flip left
19 Flip right
44
3.8 Misc commands
3.8.7 led()
Drone shows pre-set sequences with the LEDs at the end of the arms.
Usage: led(animation, frequency, duration)
Return: None
Name: Type: Description:
animation integer Number of animation, see list below.
frequency float Speed of animation
duration integer Duration of animation
Note: -
Example: drone.led(0,1.5,1)
anim. description
0 All LEDs are red, then all LEDs are green
1 All LEDs are green, then all LEDs are off
2 All LEDs are red, then all LEDs are off
3 All LEDs are orange, then all LEDs are off
4 All LEDs flash fast green/red/off
5 Front LEDs alternate fast yellow/off, rear LEDs are red
6 Front LEDs are green, read LEDs are red
7 All LEDs are red
8 All LEDs are green
9 Front left LED is red, all other are off. The light moves clockwise.
10 All LEDs are off
11 Left LEDs are off, right: rear LED is red, then rear LED is off and front LED
is yellow. Then all LEDs are off
12 Right LEDs are off, left: rear LED is red, then rear LED is off and front LED
is yellow. Then all LEDs are off
13 Rear LEDs are red, then are off and front LEDs are yellow. All LEDs are off
14 Front left LED is green, all other LEDs are red
15 Front right LED is green, all other LEDs are red
16 Rear right LED is green, all other LEDs are red
17 Rear left LED is green, all other LEDs are red
18 Left LEDs are green, right LEDs are red
19 Left LEDs are red, right LEDs are green
20 Front LEDs are green, rear LEDs are red, then all LEDs are off
Table 3.3: Possible options for led() and drone’s behaviour.
45
3.8 Misc commands
3.8.8 aflight()
Makes the drone fly around and follow 2D tags the camera can detect.
Usage: aflight(flag)
Return: None
Name: Type: Description:
flag boolean True: start flight, True: stop flight
3.8.9 at()
Sends a command and its parameters to the drone.
Usage: at(command,[parameters])
Return: None
Name: Type: Description:
command string Drone command.
parameters various Command’s parameter(s)
Note: For valid commands and parameters check AR.Drone 2.0 developer guide.
Example: drone.at(¨PCMD¨, [0,0.0,0.0,0.0,0.0])
46
4 NavData packages
NavData are sent as blocks, including the sensor-measurements and status information;
each block is divided into a bunch of 28 packages which contain a specific set of values.
The names of the packages in this API remain the same as in Parrot’s SDK.
The drone provides two modes for sending its NavData, a ¨demo¨- and a ¨full¨-mode.
Depending on the mode, 15 or 200 NavData are sent per second.
The availability of the NavData-packages also differs depending on whether the demo-
mode is enabled or disabled.
With enabled demo-mode, by default, only the packages "demo", "vision detect" and
"chksum" are available 15 times a second, but most of the time that is enough. With
disabled demo-mode, by default, all 28 packages are sent 200 times per second. There are
also state-tags available; however, like most other packages, they are not very important
and are always sent with each of NavData’s header.
47
4.1 State
4.1 State
No Name 0: 1:
[0] Fly mask Drone landed Drone is flying
[1] Video mask Video disabled Video enabled
[2] Vision mask Vision disabled Vision enabled
[3] Control algo Euler angles control Angular speed control
[4] Altitude control Altitude control inactive Altitude control active
[5] User feedback Start button not pressed Start button pressed
[6] Control command ACK None received
[7] Camera mask Camera not ready Camera ready
[8] Travelling mask disabled enabled
[9] USB key USB flash drive is not ready USB flash drive is ready
[ 10 ] NavData demo All NavData NavData demo
[ 11 ] Navdata bootstrap Options sent No NavData options sent
[ 12 ] Motors status OK Problem
[ 13 ] Communication lost Com is ok Com problem
[ 14 ] Software fault OK Software fault detected
[ 15 ] Batterystatus OK too low
[ 16 ] User emergency landing User EL is OFF User EL is ON
[ 17 ] Timer elapsed Not elapsed Elapsed
[ 18 ] Magnetometer calib No calibration needed Calibration needed
[ 19 ] Angles OK Out of range
[ 20 ] Wind mask OK Too much wind
[ 21 ] Ultrasonic sensor OK Deaf
[ 22 ] Cutout system Not detected Detected
[ 23 ] PIC Version number Bad version number Version number is OK
[ 24 ] ATCodec thread OFF ON
[ 25 ] Navdata thread OFF ON
[ 26 ] Video thread OFF ON
[ 27 ] Acquisition thread OFF ON
[ 28 ] CTRL watchdog Well scheduled Delay (> 5ms)
[ 29 ] ADC watchdog Uart2 is good Delay (> 5ms)
[ 30 ] Com Watchdog Com is ok Com problem
[ 31 ] Emergency landing No emergency Emergency
48
4.2 NavData
4.2 NavData
Most of the packages are not well documented. The following sections contain all infor-
mation found, mostly in crude form. The entries’ names remain the same as in Parrot’s
AR.Drone 2.0 SDK. Parrot’s AR.Drone 2.0 SDK packages’ names are the these names,
covert in ¨NAVDATA ¨ and ¨ TAG¨, e.g. ¨NAVDATA DEMO TAG¨.
4.2.1 ¨demo¨
Pos Datatype Name Note
[ 0 ][ 0 ] bool default
[ 0 ][ 1 ] bool init
[ 0 ][ 2 ] bool landed Landed, or flight-mode not initialled
[ 0 ][ 3 ] bool flying Initialled flight-mode
[ 0 ][ 4 ] bool hovering Better name would be ¨landing¨
[ 0 ][ 5 ] bool test
[ 0 ][ 6 ] bool trans takeoff
[ 0 ][ 7 ] bool trans gofix
[ 0 ][ 8 ] bool trans landing
[ 0 ][ 9 ] bool trans looping
[ 0 ][ 10 ] bool trans no vision
[ 0 ][ 11 ] bool num state
[1] uint32 vbat flying percentage Charge of battery in percent
[ 2 ][ 0 ] float theta Pitch in degrees
[ 2 ][ 1 ] float phi Roll in degrees
[ 2 ][ 2 ] float psi Yaw in degrees
[3] float altitude Altitude in centimetres
[ 4 ][ 0..2 ] float vx/vy/vz Estimated speed in X/Y/Z in mm/s
[5] uint32 num frames Streamed frame index, don’t use !
[ 6 ][ 0..8 ] matrix33 detection camera rot Camera params computed by detection
[ 7 ][ 0..2 ] vector3 detection camera trans Deprecated ! Don’t use !
[8] uint32 detection tag index Deprecated ! Don’t use !
[9] uint32 detection camera type Type of tag
[ 10 ][ 0..8 ] matrix33 drone camera rot Camera parameters computed by drone
[ 11 ][ 0..2 ] vector3 drone camera trans Deprecated ! Don’t use !
4.2.2 ¨time¨
Pos Datatype Name Note
- float time Time in seconds
4.2.3 ¨wifi¨
Pos Datatype Name Note
- uint32 link quality
49
4.2 NavData
4.2.4 ¨magneto¨
Pos Datatype Name Note
[ 0 ][ 0..2 ] int16 mx/my/mz Magnetometer measurements [xyz]
[ 1 ][ 0..2 ] float magneto raw Magneto in the body frame [mG]
[ 2 ][ 0..2 ] float magneto rectified
[ 3 ][ 0..2 ] float magneto offset
[4] float heading unwrapped
[5] float heading gyro unwrapped
[6] float heading fusion unwrapped
[7] uint8 magneto calibration ok
[8] uint32 magneto state
[9] float magneto radius
[ 10 ] float error mean
[ 11 ] float error var
4.2.5 ¨altitude¨
Pos Datatype Name Note
[0] int32 altitude vision [mm]
[1] float altitude vz [mm/2]
[2] int32 altitude ref [mm]
[3] int32 altitude raw [mm]
[4] float obs accZ Observer AccZ [m/s2 ]
[5] float obs alt Observer altitude US [m]
[ 6 ][ 0..2 ] vector3 obs x
[7] uint32 obs state Observer state
[ 8 ][ 0..1 ] Vector2 est vb
[9] uint32 est state Observer flight state
50
4.2 NavData
51
4.2 NavData
4.2.12 ¨references¨
Pos Datatype Name Note
[ 0 ][ 0 ] int32 ref theta Theta ref embedded [milli-deg]
[ 0 ][ 1 ] int32 ref phi Phi ref embedded [milli-deg]
[ 0 ][ 2 ] int32 ref psi Psi ref embedded [milli-deg]
[ 1 ][ 0 ] int32 ref theta I Theta ref int [milli-deg]
[ 1 ][ 1 ] int32 ref phi I Phi ref int [milli-deg]]
[ 2 ][ 0 ] int32 ref pitch Pitch ref embedded [milli-deg]
[ 2 ][ 1 ] int32 ref roll Roll ref embedded [milli-deg]
[ 2 ][ 2 ] int32 ref yaw Yaw ref embedded [milli-deg/s]
[ 3 ][ 0 ] float vx ref Vx Ref [mm / s]
[ 3 ][ 1 ] float vy ref Vy Ref [mm / s]
[ 4 ][ 0 ] float theta mod Theta modele [radian]
[ 4 ][ 1 ] float phi mod Phi modele [radian]
[ 5 ][ 0 ] float kvx
[ 5 ][ 1 ] float kvy
[6] uint32 k mode
[ 7 ][ 0 ] float ui time
[ 7 ][ 1 ] float ui theta
[ 7 ][ 2 ] float ui phi
[ 7 ][ 3 ] float ui psi
[ 7 ][ 4 ] float ui psi accuracy
[ 7 ][ 5 ] int32 ui seq
52
4.2 NavData
4.2.16 ¨watchdog¨
Pos Datatype Name Note
- uint32 watchdog Watchdog controll
4.2.17 ¨trims¨
Pos Datatype Name Note
[0] float angular rates trim
[1] float euler angles trim theta [milli-deg]
[2] float euler angles trim phi [milli-deg]
4.2.18 ¨pwm¨
Pos Datatype Name Note
[ 0 ][ 0..3 ] uint8 motor[1234] [Pulse-width mod]
[ 1 ][ 0..3 ] uint8 sat motor[1234] [Pulse-width mod]
[2] float gaz feed forward [Pulse-width mod]
[3] float gaz altitud [mm/s]
[4] float altitude integral [mm/s]
[5] float vz ref [Pulse-width mod]
[ 6 ][ 0 ] int32 u pitch [Pulse-width mod]
[ 6 ][ 1 ] int32 u roll [Pulse-width mod]
[ 6 ][ 2 ] int32 u yaw [Pulse-width mod]
[7] float yaw u I [Pulse-width mod]
[ 8 ][ 0 ] int32 u pitch planif [Pulse-width mod]
[ 8 ][ 1 ] int32 u roll planif [Pulse-width mod]
[ 8 ][ 2 ] int32 u yaw planif [Pulse-width mod]
[ 8 ][ 3 ] float u gaz planif [Pulse-width mod]
[ 9 ][ 0..3 ] uint16 current motor[1234] [mA]
[ 10 ] float altitude prop [Pulse-width mod]
[ 11 ] float altitude der [Pulse-width mod]
53
4.2 NavData
4.2.19 ¨vision¨
Pos Datatype Name Note
[0] uint32 vision state
[1] int32 vision misc
[2] float vision phi trim
[3] float vision phi ref prop
[4] float vision theta trim
[5] float vision theta ref prop
[6] int32 new raw picture
[ 7 ][ 0..2 ] float theta/phi/psi capture
[8] int32 altitude capture
[9] float time capture
[ 10 ][ 0..2 ] float velocities[xyz] X-/Y-/Z-velocity
[ 11 ][ 0..2 ] float delta phi/theta/psi
[ 12 ] uint32 gold defined
[ 13 ] uint32 gold reset
[ 14 ][ 0 ] float gold x
[ 14 ][ 1 ] float gold y
54
4.2 NavData
4.2.26 ¨games¨
Pos Datatype Name Note
[0] uint32 double tap counter
[1] uint32 finish line counter
55
4.2 NavData
4.2.29 ¨chksum¨
Pos Datatype Name Note
[0] uint32 chksum Transmitted checksum
[1] uint32 Checksums match
56
5 Configuration entries
5.1 General
general:num version config Std: read only
Configuration subsystem’s version.
57
5.1 General
58
5.2 Control
5.2 Control
control:altitude max Std: read/write
Drone’s maximum altitude in millimetres. The altitude is measured by the
pressure-sensor and has no limitation.
59
5.2 Control
60
5.2 Control
anim discription
0 Short tipping about 30◦ to the left
1 Short tipping about 30◦ to the right
2 Short tipping about 30◦ front down
3 Short tipping about 30◦ front up
4 Slide to the left
5 Slide to the right
6 Spin clockwise
7 Spin clockwise and goes down
8 Yaw shake
9 Dance by rotating
10 Dance left/right
11 Dance forward/backward
12 Dance upward/downward
13 Tipping right then left. Tipping front up then down
14 Tipping left then right. Tipping front down then up
15 Double tipping left, then right. Double tipping front down, then up
16 Flip ahead
17 Flip backward
18 Flip left
19 Flip right
Table 5.3: Possible first values for control:flight anim and drone’s
behaviour.
61
5.2 Control
62
5.2 Control
63
5.3 Detect
5.3 Detect
detect:detect type Sess: read/write
Shows what type of tag/marker is detectable.
Modifying this seems useless as the detection works always anyway (tested with
firmware version 2.3.3) as soon as a roundel-/marker-/tag-type has been set in
detect:detections select h or detect:detections select v.
Shell-Tag : 1
Roundel : 2 find them on page 75 & 76
Black Roundel : 4
Stripe : 8
Cap : 16
Shell-Tag V2 : 32
Tower Side : 64
Oriented Roundel : 128 find it on page 77
Table 5.6: Tag detection enabling values.
Add the values to detect more than one tag. Value will be set to 0 when
detect:detect type is modified.
64
5.4 Video
5.4 Video
video:camif fps Std: read only
Actual frame rate of the video interface.
65
5.4 Video
66
5.4 Video
67
5.5 LEDs, Syslog and Pic
anim. description
0 All LEDs are red, then all LEDs are green
1 All LEDs are green, then all LEDs are off
2 All LEDs are red, then all LEDs are off
3 All LEDs are orange, then all LEDs are off
4 All LEDs flash fast green/red/off
5 Front LEDs alternate fast yellow/off, rear LEDs are red
6 Front LEDs are green, read LEDs are red
7 All LEDs are red
8 All LEDs are green
9 Front left LED is red, all other are off. The light moves clockwise.
10 All LEDs are off
11 Left LEDs are off, right: rear LED is red, then rear LED is off and
front LED is yellow. Then all LEDs are off
12 Right LEDs are off, left: rear LED is red, then rear LED is off and
front LED is yellow. Then all LEDs are off
13 Rear LEDs are red, then are off and front LEDs are yellow. All LEDs
are off
14 Front left LED is green, all other LEDs are red
15 Front right LED is green, all other LEDs are red
16 Rear right LED is green, all other LEDs are red
17 Rear left LED is green, all other LEDs are red
18 Left LEDs are green, right LEDs are red
19 Left LEDs are red, right LEDs are green
20 Front LEDs are green, rear LEDs are red, then all LEDs are off
Table 5.12: Possible values for leds:leds anim and drone’s behaviour.
Example: With parameter string ¨3,-1102263091,3¨ all LEDs flash orange
with 0.2 Hz for three seconds.
This setting can also be done by the command led(), described in section 3.8.7
on page 45.
68
5.6 Custom
5.6 Custom
custom:application id Std: read/write
Shows the current application ID in eight hexadecimal digits, stores application
settings or creates them if they do not exist. To delete a set of settings, negate
the ID by putting a minus (-) in front. By ID ¨-all¨ you delete all saved entries.
This setting can also be done by command setConfigApplicationID(),
described in section 3.5.6 on page 33; or set pre-set application-, profile- and
session-IDs by command setConfigAllID() at once, described in section
3.5.7 on page 33.
69
5.7 GPS, Network and Userbox
70
5.7 GPS, Network and Userbox
<timespamp> represents the time since the last boot of the drone.
<date> has (<. . . >) to have the format: YYYYMMDD hhmmss
<tempdir> represents following directory in the drone’s filesystem:
¨/data/video/boxes/tmp flight <date>/¨
Note: The GPS receiver is an extra device and is connected to the drone’s
USB-port.
71
A List of configuration and Tags
72
...
Name Value
control:gyro offset thr x 4.0000000e+00
control:gyro offset thr y 4.0000000e+00
control:gyro offset thr z 5.0000000e-01
control:pwm ref gyros 500
control:osctun value 63
control:osctun test TRUE
control:altitude max 20000
control:altitude min 50
control:outdoor FALSE
control:flight without shell FALSE
control:autonomous flight TRUE
control:flight anim 0,0
network:ssid single player ardrone2 xxxxxx
network:ssid multi player ardrone2 xxxxxx
network:wifi mode 0
network:wifi rate 0
network:owner mac 00:00:00:00:00:00
pic:ultrasound freq 8
pic:ultrasound watchdog 3
pic:pic version 184877090
video:camif fps 30
video:camif buffers 2
video:num trackers 12
video:video storage space 15360
video:video on usb FALSE
video:video file index 2
leds:leds anim 0,0,0
detect:enemy colors 1
detect:enemy without shell 1
syslog:output 7
syslog:max size 102400
syslog:nb files 5
general:localtime 0
general:navdata options 65537
control:control level 0
video:bitrate 1000
video:bitrate ctrl mode 0
video:bitrate storage 4000
custom:application desc Default application configuration
control:euler angle max 2.0943999e-01
control:control iphone tilt 3.4906584e-01
control:control vz max 7.0000000e+02
control:control yaw 1.7453290e+00
...
73
...
Name Value
control:manual trim FALSE
control:indoor euler angle max 2.0943999e-01
control:indoor control vz max 7.0000000e+02
control:indoor control yaw 1.7453290e+00
control:outdoor euler angle max 3.4906584e-01
control:outdoor control vz max 1.0000000e+03
control:outdoor control yaw 3.4906585e+00
custom:profile desc Default profile configuration
control:flying mode 0
control:hovering range 1000
video:codec fps 30
video:video codec 129
video:video slices 0
video:video live socket 0
video:max bitrate 1000
video:video channel 0
detect:groundstripe colors 16
detect:detect type 3
detect:detections select h 0
detect:detections select v hsync 0
detect:detections select v 0
userbox:userbox cmd 0
gps:latitude 5.0000000000000000e+02
gps:longitude 5.0000000000000000e+02
gps:altitude 0.0000000000000000e+00
custom:application id 00000000
custom:profile id 00000000
custom:session id 00000000
custom:session desc 00000000
Listing A.1: Example listing of Ar.Drone 2.0 configuration
74
Figure A.1: Roundel
75
Figure A.2: Modified Roundel for a better detection
76
Figure A.3: Black and white Oriented Roundel
77