It is not as complicated as it might look at first sight. First, make sure you are running 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 necessary to install OpenCV2. If you do not have any experience with Linux, try Knoppix, the Linux Mint 17 live image or install a Linux (Linux Mint 17 MATE Edition is pretty nice) on a virtual machine (f.e. virtualBox).

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.

First flight

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

<space> take-off or land
<0> stop moving
<w> move forward
<s> move backward
<a> move left
<d> move right
<q> turn lef
<e> turn right

Try pressing numbers, <*>, <+>, or <->, any not listed key will land the drone and end the demo.

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()  # Initializes 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 (from 0.2 = 20%) 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
Download sample firstTry.py

Before drone.startup(), it is possible to configure the PS-Drone, for example, to change the drone’s IP. Please take a look in the documentary for all options.

startup() connects to the drone, configures the basics and activates the sensor-datastream also known as “NavData”. A documentation about the drone’s sensors and the returned values will also be in the documentary.

The command takeoff() makes the drone fly. After the drone has reached its hovering state (at around 75cm), it runs some internal calibrations. However, usually the take-off-sequence takes around seven seconds altogether, movement-commands before a clearly completed take-off might cause unexpected (but not critical) behavior.
The commands land() makes the drone land.

Note: Only these commands enable the drone to take off, go up into the air, descend again and finally come back to the ground, just using the commands moveUp() or moveDown() would not bring the expected success.

The basic movement-commands are:
 
moveForward(val)
moveBackward(val)
moveLeft(val)
moveRight(val)
moveUp(val)
moveDown(val)
turnLeft(val)
turnRight(val)
stop()

The values for these basic movement-commands determine the speed of the movement and are optional. The values should be between 0.0 and 1.0 as they represent the drone’s speed from 0% to 100%. If you do not set the speed-value, the drone will move with its default speed. You can alter this default speed (which is preset by 0.2) by using the command setSpeed(val).

The command stop() stops the drone’s movement and makes it hold its position. Setting a movement-command with the speed-value 0.0 will not have the same effect; the drone will glide in its last (horizontal) direction, just getting slower due to air drag (see also next section for further information).

Due to its firmware, it is not possible for the drone to hold its exact position while turning on its own axis; it tends to move sideways. The extent of these unwanted movements depends on the condition of the propellers and the drone in general (the more damaged, the stronger the drifting-effects).

By default, the AR.Drone 2.0 continues to perform the last movement-command forever, until it receives a new movement-command. Therefore, PS-Drone has “self-control” as a security feature. It means that if your program crashes, this API detects it, sends the command to land to the drone and shuts it down properly. In case the PS-Drone has no chance to react (for example because your computer crashed or the drone has flown too far away) you are doomed ! By the way: Houseplants and cats do not like being attacked by an uncontrolled drone on the rampage - believe me !

However, it is not necessary to land and shut down the drone at the end of your program.