libkovan  1
The kovan standard library
ardrone.h File Reference
#include "export.h"
#include "vtable.h"

Go to the source code of this file.

Enumerations

enum  drone_camera { FRONT_CAMERA, BOTTOM_CAMERA }
 

Functions

VF EXPORT_SYM int drone_connect ()
 Establishes a connection between the drone and the Link. This function must be called before any other ardrone functions. More...
 
VF EXPORT_SYM void drone_disconnect ()
 
VF EXPORT_SYM void drone_calibrate ()
 Calibrates the drone's accelerometers to understand what "flat" is. More...
 
VF EXPORT_SYM int get_drone_version ()
 
VF EXPORT_SYM void drone_takeoff ()
 Makes the drone takeoff and stabilize itself. This command will return immeadiately. More...
 
VF EXPORT_SYM void drone_land ()
 This function will be used to land the drone at its current position. More...
 
VF EXPORT_SYM int get_drone_battery ()
 retrieves the cached battery value More...
 
VF EXPORT_SYM void drone_clear_position ()
 Clears the accumulated absolute x, y, and z positions of the AR.Drone. More...
 
VF EXPORT_SYM float get_drone_x ()
 Retrieves the x value relative to the drones starting position. Negative values indicate the drone has moved to the left of it's starting position. More...
 
VF EXPORT_SYM float get_drone_y ()
 Retrieves the y value relative to the drones starting position. Negative values indicate the drone has moved backwards from it's starting position. More...
 
VF EXPORT_SYM float get_drone_z ()
 Retrieves the y value relative to the drones starting position. Negative values indicate the drone has moved down from it's starting position. More...
 
VF EXPORT_SYM float get_drone_x_velocity ()
 Retrieves the current velocity in the right or left direction. More...
 
VF EXPORT_SYM float get_drone_y_velocity ()
 Retrieves the current velocity in the forward or backwards direction. More...
 
VF EXPORT_SYM float get_drone_z_velocity ()
 Retrieves the current velocity in the upward or downwards direction. More...
 
VF EXPORT_SYM float get_drone_pitch ()
 Retrieves the current pitch of the AR.Drone, in degrees. More...
 
VF EXPORT_SYM float get_drone_roll ()
 Retrieves the current roll of the AR.Drone, in degrees. More...
 
VF EXPORT_SYM float get_drone_yaw ()
 Retrieves the current rotation in the clockwise (positive) or counterclockwise (negative) direction. More...
 
VF EXPORT_SYM float get_drone_altitude ()
 Retrieves the current altitude of the AR.Drone, in meters. More...
 
VF EXPORT_SYM int drone_camera_open (enum drone_camera camera)
 Opens the AR.Drone's camera as the camera input device. You must use camera_close() once finished. More...
 
VF EXPORT_SYM int set_drone_mac_address (const char *const address)
 Sets the Drone's MAC Address Pair to be the given string. More...
 
VF EXPORT_SYM int drone_pair ()
 Automatically detects the host MAC Address and pairs the drone with it. More...
 
VF EXPORT_SYM int set_drone_ssid (const char *const ssid)
 
VF EXPORT_SYM void drone_move (float x_tilt, float y_tilt, float z_vel, float yaw_vel)
 Tells the drone to move with the given parameters. More...
 
VF EXPORT_SYM void drone_hover ()
 Tells the drone that it should stop moving and hover at its current location. More...
 
VF EXPORT_SYM void set_drone_emergency_stop_enabled (int enabled)
 
VF EXPORT_SYM int get_drone_emergency_stop_enabled ()
 

Detailed Description

Author
Braden McDorman

Enumeration Type Documentation

Enumerator
FRONT_CAMERA 
BOTTOM_CAMERA 

Function Documentation

VF EXPORT_SYM void drone_calibrate ( )

Calibrates the drone's accelerometers to understand what "flat" is.

VF EXPORT_SYM int drone_camera_open ( enum drone_camera  camera)

Opens the AR.Drone's camera as the camera input device. You must use camera_close() once finished.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Parameters
cameraFRONT_CAMERA for the horizontal camera, BOTTOM_CAMERA for the vertical camera.
Returns
1 on success, 0 on failure
VF EXPORT_SYM void drone_clear_position ( )

Clears the accumulated absolute x, y, and z positions of the AR.Drone.

Precondition
drone_connect must have been previously called to esåtablish a connection to the drone.
See also
get_drone_x
get_drone_y
get_drone_z
VF EXPORT_SYM int drone_connect ( )

Establishes a connection between the drone and the Link. This function must be called before any other ardrone functions.

VF EXPORT_SYM void drone_disconnect ( )
VF EXPORT_SYM void drone_hover ( )

Tells the drone that it should stop moving and hover at its current location.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
VF EXPORT_SYM void drone_land ( )

This function will be used to land the drone at its current position.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Postcondition
The drone should slowly descend to the ground from its current height.
VF EXPORT_SYM void drone_move ( float  x_tilt,
float  y_tilt,
float  z_vel,
float  yaw_vel 
)

Tells the drone to move with the given parameters.

Parameters
enableA value indicating if movement is enabled. 0 - True 1 - False
x_tiltA value from zero to one indicating the percentage of maximum tilt in the left or right direction negative values are left and positive values are right. Ex: -.5 means Half of the total tilt left
y_tiltA value from zero to one indicating the percentage of maximum tilt in the forward or backward direction negative values are left and positive values are right. Ex: -.5 means Half of the total tilt backwards.
yaw_velA value indicating the rotational velocity of the dronein milieters per second
z_velA value indicating the change in altitude in milimeters per second
VF EXPORT_SYM int drone_pair ( )

Automatically detects the host MAC Address and pairs the drone with it.

Returns
1 for success, 0 for failure
See also
set_drone_mac_address
VF EXPORT_SYM void drone_takeoff ( )

Makes the drone takeoff and stabilize itself. This command will return immeadiately.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Postcondition
The drone should reach its normal operating height
See also
drone_takeoff_block
VF EXPORT_SYM float get_drone_altitude ( )

Retrieves the current altitude of the AR.Drone, in meters.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
A float indicating the altitude of the AR.Drone in meters.
VF EXPORT_SYM int get_drone_battery ( )

retrieves the cached battery value

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
An integer representing the current battery level
VF EXPORT_SYM int get_drone_emergency_stop_enabled ( )

Gets the previously set emergency stop enabled flag.

See also
set_drone_emergency_stop_enabled
Returns
1 if emergency stop is enabled, 0 otherwise
VF EXPORT_SYM float get_drone_pitch ( )

Retrieves the current pitch of the AR.Drone, in degrees.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
A float indicating the pitch of the AR.Drone in degrees.
VF EXPORT_SYM float get_drone_roll ( )

Retrieves the current roll of the AR.Drone, in degrees.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
A float indicating the roll of the AR.Drone in degrees.
VF EXPORT_SYM int get_drone_version ( )
Returns
The version of the currently connected drone. For example, an AR.Drone 1 will return the integer 1. The value -1 is returned upon error.
VF EXPORT_SYM float get_drone_x ( )

Retrieves the x value relative to the drones starting position. Negative values indicate the drone has moved to the left of it's starting position.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
x value away from the drones starting position in milimeters verify it is in fact milimeters
VF EXPORT_SYM float get_drone_x_velocity ( )

Retrieves the current velocity in the right or left direction.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
A float indicating the millimeters per second
VF EXPORT_SYM float get_drone_y ( )

Retrieves the y value relative to the drones starting position. Negative values indicate the drone has moved backwards from it's starting position.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
y value away from the drones starting position in milimeters
VF EXPORT_SYM float get_drone_y_velocity ( )

Retrieves the current velocity in the forward or backwards direction.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
A float indicating the velocity in millimeters per second
VF EXPORT_SYM float get_drone_yaw ( )

Retrieves the current rotation in the clockwise (positive) or counterclockwise (negative) direction.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
A float indicating the degrees rotated from the original orientation
VF EXPORT_SYM float get_drone_z ( )

Retrieves the y value relative to the drones starting position. Negative values indicate the drone has moved down from it's starting position.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
z value away from the drones starting position in milimeters
VF EXPORT_SYM float get_drone_z_velocity ( )

Retrieves the current velocity in the upward or downwards direction.

Precondition
drone_connect must have been previously called to establish a connection to the drone.
Returns
A float indicating the velocity in millimeters per second
VF EXPORT_SYM void set_drone_emergency_stop_enabled ( int  enabled)

When developing programs for the AR.Drone, it is often useful to be able to "emergency land". This will turn the Link's side button into a dedicated AR.Drone "kill switch". Note that using side_button in conjunction with this function may result in undefined behavior.

Parameters
enabled0 for off, 1 for on
VF EXPORT_SYM int set_drone_mac_address ( const char *const  address)

Sets the Drone's MAC Address Pair to be the given string.

Parameters
macAddressA string representing the MAC Address to pair
Returns
1 for success, 0 for failure
See also
drone_pair
VF EXPORT_SYM int set_drone_ssid ( const char *const  ssid)

Sets the SSID of the Drone to the given ssid.

Attention
This setting will not take effect until the AR.Drone is restarted.
Returns
1 for success, 0 for failure.