Skip to content
puku0x edited this page Apr 30, 2016 · 20 revisions

This page introduces the APIs of CV Drone.

ARDrone::open(const char *ardrone_addr)

  • ardrone_addr: IP adrress of AR.Drone.
  • Initializes the AR.Drone.
  • When it succeed it returns 1, if it failed it returns 0.

ARDrone::update(void)

  • Updates all datas of the AR.Drone.
  • When it succeed it returns 1, if it failed it returns 0.
  • NOTE: Only for backward compatibility.

ARDrone::close(void)

  • Finalizes the AR.Drone.
  • This function is automatically called.

ARDrone::getImage(void)

  • Obtains a frame from the camera of AR.Drone.
  • When it succeed it returns cv::Mat or IplImage*, if it failed it returns an empty cv::Mat() or NULL.

ARDrone::getVersion(void)

  • Obtains AR.Drone's version.

ARDrone::getRoll(void)

  • Obtains AR.Drone's role angle [rad]

ARDrone::getPitch(void)

  • Obtains AR.Drone's pitch angle [radian].

ARDrone::getYaw(void)

  • Obtains AR.Drone's yaw angle [radian].

ARDrone::getAltitude(void)

  • Obtains AR.Drone's altitude [m].

ARDrone::getVelocity(double *vx, double *vy, double *vz)

  • *vx: The pointer to X (Front side of AR.Drone) velocity [m/s].
  • *vy: The pointer to Y (Left side of AR.Drone) velocity [m/s].
  • *vz: The pointer to Z (Upper side of AR.Drone) velocity [m/s].
  • Obtains AR.Drone's velocities.
  • This function returns a norm[m/s] of velocity vectors.

ARDrone::getPosition(double *latitude, double *longitude, double *elevation)

  • *latitude: The pointer to north-latitude of AR.Drone 2.0.
  • *longitude: The pointer to east-longitude of AR.Drone 2.0.
  • *elevation: The pointer to elevation of AR.Drone 2.0.
  • Obtains GPS information from the AR.Drone 2.0 Flight Recorder.
  • This function returns 1 when the GPS data is reliable.

ARDrone::getBatteryPercentage(void)

  • Obtains AR.Drone's battery percentage.

ARDrone::takeoff(void)

  • Takes off the AR.Drone.

ARDrone::landing(void)

  • Lands the AR.Drone.

ARDrone::emergency(void)

  • Emergency stop.
  • Not recommended.

ARDrone::move(double vx, double vy, double vr)

  • vx: X velocity [m/s].
  • vy: Y velocity [m/s].
  • vr: Rotational speed [rad/s].
  • Moves the AR.Drone in 2D plane.

ARDrone::move3D(double vx, double vy, double vz, double vr)

  • vx: X velocity [m/s].
  • vy: Y velocity [m/s].
  • vz: Z velocity [m/s].
  • vr: Rotational speed [rad/s].
  • Moves the AR.Drone in 3D space.

ARDrone::onGround(void)

  • Checks AR.Drone is on ground or not.
  • If YES it returns 1, if NO it returns 0.

ARDrone::setFlatTrim()

  • Calibrates the flat trim of AR.Drone.
  • You should set your AR.Drone on a flat plane.

ARDrone::setCalibration(int device)

  • device: Device ID (Magnetometer = 0)
  • Calibrates the magnetometer of AR.Drone 2.0.

ARDrone::setCamera(int channel)

  • channel: Camera channel (0-3).

  • Changes the camera channel.

    Horizontal Camera Horizontal Camera Horizontal Camera Horizontal Camera

ARDrone::setAnimation(int id, int duration)

  • id: Flight animation ID (0-20)
  • duration: Duration [ms]
  • Runs specified flight animation.

ARDrone::setLED(int id, float freq, int duration)

  • id: LED animation ID (0-20)
  • freq: Frequency [Hz]
  • duration: Duration [s]
  • Runs specified LED animation.

ARDrone::setVideoRecord(bool activate)

  • activate: Start/stop recording
  • Starts recording video in a USB key.
  • You should set a USB key with > 100MB to your drone.
  • Don't forget calling setVideoRecord(false) at the end of recording.
  • You should disconnect AR.Drone first, when the video was not saved to USB.
  • This function is only for AR.Drone 2.0.

ARDrone::setOutdoorMode(bool activate)

  • activate: Enable/disable outdoor mode
  • Changes current mode to outdoor mode.
  • NOTE: This is an experimental function.

ARDrone::willGetNewImage(void)

  • Checks whether the video thread has received a new image since the last getImage().
  • NOTE: This is an experimental function.

For more details of ARDrone class, please see ardrone.h.