Available AutoScript Functions

Here you will find a description of every available function you can use to control the AR.Drone, divided into the main modules (control`,``sensors, util).

AR.Drone control

control.backward_distance(speed, centimeters)

Moves the drone backward, and stops it after the specified distance has been traveled. Shortcut for move_distance(0, speed, 0, 0, centimeters)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • centimeters (float) – The distance to be traveled, in centimeters.
Returns:

True if the command could be send successfully, False otherwise.

control.backward_time(speed, millis)

Moves the drone backward, and stops it after the specified amount of time has elapsed. Shortcut for move_time(0, speed, 0, 0, millis)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • millis (int) – The time to wait before stoping the drone, in milliseconds.
Returns:

True if the command could be send successfully, False otherwise.

control.backward(speed)

Moves the drone backward. Shortcut for move(0, speed, 0, 0). To stop it, call the hover() command.

Parameters:speed (float) – The speed at which the drone should be flying. See move().
Returns:True if the command could be send successfully, False otherwise.
control.down_distance(speed, centimeters)

Moves the drone down, and stops it after the specified distance has been traveled. Shortcut for move_distance(0, 0, -speed, 0, centimeters)

Warning

Not implemented yet! Do not use.

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • centimeters (float) – The distance to be traveled, in centimeters.
Returns:

True if the command could be send successfully, False otherwise.

control.down_time(speed, millis)

Moves the drone down, and stops it after the specified amount of time has elapsed. Shortcut for move_time(0, 0, 0, -speed, millis)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • millis (int) – The time to wait before stoping the drone, in milliseconds.
Returns:

True if the command could be send successfully, False otherwise.

control.down(speed)

Moves the drone backward. Shortcut for move(0, 0, 0, -speed). To stop it, call the hover() command.

Parameters:speed (float) – The speed at which the drone should be flying. See move().
Returns:True if the command could be send successfully, False otherwise.
control.flip(direction)

Sends the flip command to the AR.Drone. Only works with 2.0 drones.

Returns:True if the command could be send successfully, False otherwise.
control.forward_distance(speed, centimeters)

Moves the drone forward, and stops it after the specified distance has been traveled. Shortcut for move_distance(0, -speed, 0, 0, centimeters)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • centimeters (float) – The distance to be traveled, in centimeters.
Returns:

True if the command could be send successfully, False otherwise.

control.forward_time(speed, millis)

Moves the drone forward, and stops it after the specified amount of time has elapsed. Shortcut for move_time(0, -speed, 0, 0, millis)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • millis (int) – The time to wait before stoping the drone, in milliseconds.
Returns:

True if the command could be send successfully, False otherwise.

control.forward(speed)

Moves the drone forward. Shortcut for move(0, -speed, 0, 0). To stop it, call the hover() command.

Parameters:speed (float) – The speed at which the drone should be flying. See move().
Returns:True if the command could be send successfully, False otherwise.
control.hover()

Hovers the drone, so it tries to stay at a fixed position. Equivalent to calling move(0, 0, 0, 0).

Returns:True if the command could be send successfully, False otherwise.
control.land()

Sends a land command to the drone.

Returns:True if the command could be send successfully, False otherwise.
control.left_distance(speed, centimeters)

Moves the drone left, and stops it after the specified distance has been traveled. Shortcut for move_distance(-speed, 0, 0, 0, centimeters)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • centimeters (float) – The distance to be traveled, in centimeters.
Returns:

True if the command could be send successfully, False otherwise.

control.left_time(speed, millis)

Moves the drone left, and stops it after the specified amount of time has elapsed. Shortcut for move_distance(-speed, 0, 0, 0, millis)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • millis (int) – The time to wait before stoping the drone, in milliseconds.
Returns:

True if the command could be send successfully, False otherwise.

control.left(speed)

Moves the drone left. Shortcut for move_distance(-speed, 0, 0, 0). To stop it, call the hover() command.

Parameters:speed (float) – The speed at which the drone should be flying. See move().
Returns:True if the command could be send successfully, False otherwise.
control.move_distance(phi, theta, gaz, yaw, centimeters)

Moves the drone as in move(), but stops it automatically after the specified distance has been traveled.

Warning

If the vertical camera of your AR.Drone does not work or data is somehow not sent back correctly, this can be dangerous. This function uses speed to calculate the traveled distance, and this speed data is computed by analyzing the vertical cameras pictures. Will be problematic if what the drone is flying over has no distinguishable features!

Parameters:
  • phi (float) – See move().
  • theta (float) – See move().
  • gaz (float) – See move().
  • yaw (float) – See move().
  • centimeters (float) – The distance to be traveled, in centimeters.
Returns:

True if the command could be send successfully, False otherwise.

control.move_time(phi, theta, gaz, yaw, millis)

Moves the drone as in move(), but stops it automatically after the specified amount of time.

Parameters:
  • phi (float) – See move().
  • theta (float) – See move().
  • gaz (float) – See move().
  • yaw (float) – See move().
  • millis (int) – The time to wait before stoping the drone, in milliseconds.
Returns:

True if the command could be send successfully, False otherwise.

control.move(phi, theta, gaz, yaw)

Moves the drone. The parameters are fractions of the maximum allowed angle, and have to be in the range from -1.0 (corresponding to the maximum tilt into one direction) to 1.0 (corresponding to the maximum tilt into the other direction).

Warning

This function will cause the drone to move with the specified parameters for an infinite amount of time. You will need to call the hover() command to stop it.

Parameters:
  • phi (float) – Roll angle (-1.0: full angle to left hand side; 1.0: full angle to right hand side)
  • theta (float) – Pitch angle (-1.0: full speed in forward direction; 1.0: full speed in backward direction)
  • gaz (float) – Vertical speed (Exception as it is no angle. -1.0 would then be full speed down, 1.0 full speed up)
  • yaw (float) – Yaw speed (Also no angle. -1.0 would be full speed in counterclockwise direction, 1.0 full speed in clockwise direction)
Returns:

True if the command could be send successfully, False otherwise.

control.right_distance(speed, centimeters)

Moves the drone right, and stops it after the specified distance has been traveled. Shortcut for move_distance(speed, 0, 0, 0, centimeters)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • centimeters (float) – The distance to be traveled, in centimeters.
Returns:

True if the command could be send successfully, False otherwise.

control.right_time(speed, millis)

Moves the drone right, and stops it after the specified amount of time has elapsed. Shortcut for move_distance(speed, 0, 0, 0, millis)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • millis (int) – The time to wait before stoping the drone, in milliseconds.
Returns:

True if the command could be send successfully, False otherwise.

control.right(speed)

Moves the drone right. Shortcut for move_distance(speed, 0, 0, 0). To stop it, call the hover() command.

Parameters:speed (float) – The speed at which the drone should be flying. See move().
Returns:True if the command could be send successfully, False otherwise.
control.rotate(speed, degs, clockwise)

Rotates the drone by the specified angle at the specified speed in the specified direction. Yes, it does exactly what you specified. And no, in the next sentence there will not be the word specified again.

Warning

Somehow, this does not always work as expected. I don’t yet know why, but I hope I’ll find the error soon.

Parameters:
  • speed (float) – The rotation speed
  • degs (float) – How many degrees the drone should rotate (>=0, please)
  • clockwiseTrue for clockwise rotation, False for counterclockwise rotation
Returns:

True if the command could be send successfully, False otherwise.

control.takeOff()

Sends a take off command to the drone. This will only send the command and continue immediately, so you’ll probably want to wait 4-6 seconds before calling any other functions.

Returns:True if the command could be send successfully, False otherwise.
control.up_distance(speed, centimeters)

Moves the drone up, and stops it after the specified distance has been traveled. Shortcut for move_distance(0, 0, speed, 0, centimeters)

Warning

Not implemented yet! Do not use.

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • centimeters (float) – The distance to be traveled, in centimeters.
Returns:

True if the command could be send successfully, False otherwise.

control.up_time(speed, millis)

Moves the drone up, and stops it after the specified amount of time has elapsed. Shortcut for move_time(0, 0, 0, speed, millis)

Parameters:
  • speed (float) – The speed at which the drone should be flying. See move().
  • millis (int) – The time to wait before stoping the drone, in milliseconds.
Returns:

True if the command could be send successfully, False otherwise.

control.up(speed)

Moves the drone up. Shortcut for move(0, 0, 0, speed). To stop it, call the hover() command.

Parameters:speed (float) – The speed at which the drone should be flying. See move().
Returns:True if the command could be send successfully, False otherwise.

Sensor data retrieving

sensors.getAcceleration(axis)

Reads the accelerometer’s value on the specified axis.

Parameters:axis (string) – “X”, “Y” or “Z”
Returns:The acceleration on the specified axis, in g.
sensors.getAltitude()

Reads the drone’s altitude.

Returns:The altitude in m.
sensors.getBatteryLevel()

Reads the battery’s level.

Returns:The battery level in %.
sensors.getOrientation(axis)

Reads the gyroscope’s value on the specified axis.

Parameters:axis (string) – “YAW”, “PITCH” or “ROLL”
Returns:The angle on the specified axis, in degrees, as a value between -180 and +180.
sensors.getOrientation360(axis, clockwise)

Reads the gyroscope’s value on the specified axis.

Parameters:
  • axis (string) – “YAW”, “PITCH” or “ROLL”
  • clockwise (boolean) – The direction in which to count, if True then in clockwise direction.
Returns:

The angle on the specified axis, in degrees, as a value between 0 and 360. E.g. if the drone is tilted 10 degrees to the right, the value would not be 10 but 100 degrees, if clockwise is True. Useful for measuring yaw angles.

sensors.getLinearVelocity(axis)

Reads the drone’s speed on the specified axis.

Parameters:axis (string) – “X”, “Y”, or “Z”
Returns:The drone’s speed on the specified axis, in m/s.
util.isConnected()

Checks if AutoFlight is receiving data from the drone.

Returns:True if connected, False otherwise
util.isFlying()

Checks if the drone is flying.

Returns:True if flying, False otherwise

Utilities and other

util.flatTrim()

Sends the “flat trim” command to the AR.Drone. This command calibrates the drone’s inertial measurement unit, so it probably is nonsense if you call this while not on a flat surface.

Returns:True if the command could be send successfully, False otherwise.
util.calibrateMagnetometer()

Sends the “magnetometer calibration” command to the AR.Drone. This command will make the drone rotate on its yaw axis a couple of times, so be careful when calling this.

Returns:True if the command could be send successfully, False otherwise.
util.startRecording()

Starts recording video to the default location.

Returns:True if command completed successfully, False otherwise.
util.stopRecording()

Stops recording video.

Returns:True if command completed successfully, False otherwise.
util.toggleRecording()

Toggles video recording. (Starts recording if it’s currently not recording, stops recording if it’s currently recording.)

Returns:True if command completed successfully, False otherwise.
util.savePicture(path)

Takes a picture and saves it as JPEG to the specified file.

Parameters:path (string) – The filename of the picture.
Returns:True if command completed successfully, False otherwise.