Olympe API Reference Documentation

class olympe.Drone

Drone controller class

Use this class to send and/or receive SDK messages to a simulated or physical drone.

Please refer to the Olympe user guide for more information.


import olympe
from olympe.messages.ardrone3.Piloting import TakeOff

drone = olympe.Drone("")
__init__(ip_addr, drone_type=None, avahi=False, dcport=44444, mpp=False, loglevel=3, logfile=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, video_buffer_queue_size=2)
  • ip_addr (str) – the drone IP address

  • drone_type (int) – (optional) the drone device type ID

  • avahi (bool) – use avahi discovery if True (defaults to False). Avahi discovery is only relevant for legacy drones.

  • dcport (int) – drone control port (default to 44444)

  • mpp (bool) – True if Olympe needs to connect to a drone through an MPP

  • loglevel (int) – drone logger log level (defaults to olympe.tools.logger.level.info)

  • logfile (FileObjectLike) – drone logger file (defaults to sys.stdout)


Make all step to make the connection between the device and the pc

Return type



Disconnects current device (if any) Blocks until it is done or abandoned

Return type



Returns the state of the connection to the drone

Return type


start_video_streaming(resource_name='live', media_name='DefaultVideo')

Starts a video streaming session

  • resource_name (str) –

    video streaming ressource. This parameter defaults to “live” for the live video stream from the drone front camera. Alternatively, resource_name can also point to a video file on the drone that is available for replay. In the later case, it takes the form “replay/RESOURCE_ID” where RESOURCE_ID can be obtained through the drone media REST API at


    • ”live”

    • ”replay/100000010001.MP4”

    • ”replay/200000020002.MP4”

  • media_name (str) –

    video stream media name. A video stream resource (e.g. “live” or “replay/..”) may provide multiple media tracks. Use the media_name parameter to select the media from the available medias. This parameter defaults to “DefaultVideo”. If the requested media is unavailable, the default media will be selected instead without reporting any error.

    Possible values:

    • ”DefaultVideo”

    • ”ParrotThermalVideo” (available with an ANAFI Thermal when replaying a thermal video).

Return type



Stops the live video stream from the drone front camera

Return type


set_streaming_output_files(h264_data_file=None, h264_meta_file=None, raw_data_file=None, raw_meta_file=None)

Records the video streams from the drone

  • xxx_meta_file: video stream metadata output files

  • xxx_data_file: video stream frames output files

  • h264_***_file: files associated to the H264 encoded video stream

  • raw_***_file: files associated to the decoded video stream

This function MUST NOT be called when the video streaming is active. Otherwise raises a RuntimeError exception. Setting a file parameter to None disables the recording for the related stream part.

set_streaming_callbacks(h264_cb=None, raw_cb=None, end_cb=None, flush_cb=None)

Set the callback functions that will be called when a new video stream frame is available or when the video stream has ended.

Video frame callbacks: - h264_cb is associated to the H264 encoded video stream - raw_cb is associated to the decoded video stream

Each video frame callback function takes an VideoFrame() parameter The end_cb callback function is called when the (replayed) video stream ends and takes no parameter. The return value of all these callback functions are ignored. If a callback is not desired, just set it to None.

__call__(expectations, **kwds)

This method can be used to:

  • send command messages and waiting for their associated expectations

  • monitor spontaneous drone event messages

  • check the state of the drone

It asynchronously process arsdk command and event message and expectations.

Please refer to the Olympe User Guide for more information.


expectations – An SDK message expectation expression

Return type


Please refer to the Olympe user guide for more information.


Returns the list of all commands available in olympe or the docstring of a specific command

type pattern


param pattern

a string that should be part of a command’s name


list or string

  • if no pattern is given, a list of all commands available

  • if the pattern is not exactly a command name, a list of commands containing the pattern

  • if pattern is the name of a command, the docstring of the command as a string (use print to display it)


Returns the drone current state for the event message given in parameter


message (ArsdkMessage) – an event message type


an ordered dictionary containing the arguments of the last received event message that matches the message ID provided in parameter

check_state(message, *args, **kwds)

Returns True if the drone state associated to the given message is already reached. Otherwise, returns False


Query the drone current state return a dictionary of every drone state whose message name contains the query string :return: dictionary of drone state :param: query, the string to search for in the message received from the drone.


Start interface to send piloting commands

Return type


piloting_pcmd(roll, pitch, yaw, gaz, piloting_time)

Send command to the drone to move it. This function is a non-blocking function.

  • roll (int) – roll consign for the drone (must be in [-100:100])

  • pitch (int) – pitch consign for the drone (must be in [-100:100])

  • yaw (int) – yaw consign for the drone (must be in [-100:100])

  • gaz (int) – gaz consign for the drone (must be in [-100:100])

  • piloting_time (float) – The time of the piloting command

Return type



Stop interface to send piloting commands

Return type


class olympe.VideoFrame

This function increments the reference counter of the underlying buffer(s)


This function decrements the reference counter of the underlying buffer(s)


Returns a dictionary of video frame info


Returns a 2-tuple (VMetaFrameType, dictionary of video frame metadata)


This function return a 2-tuple (frame_pointer, frame_size) where frame_pointer is a ctypes pointer and frame_size the frame size in bytes.

See: https://docs.python.org/3/library/ctypes.html


This function returns an non-owning numpy 1D (h264) or 2D (YUV) array on this video frame

class olympe.ReturnTuple

A namedtuple used as a return type

This namedtuple class definition is roughly equivalent to:

    [('OK', bool), ('message', str), ('value', typing.Any), ('error_code', int)]

A ReturnTuple is implicitly convertible to bool and evaluates to OK.


alias of olympe.arsdkng.expectations.ArsdkExpectationBase

class olympe.tools.logger.level
debug = 4
info = 3
warning = 2
error = 1
critical = 0