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'>)
  • 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:ReturnTuple

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

Return type:ReturnTuple

Returns the state of the connection to the drone

Return type:ReturnTuple

Starts the live video streaming from the drone front camera

Return type:ReturnTuple

Stops the live video stream from the drone front camera

Return type:ReturnTuple
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_data_cb=None, h264_meta_cb=None, raw_data_cb=None, raw_meta_cb=None)

Set the callbacks that will be called when a new video stream frame is available.

The callbacks return values are ignored.

  • xxx_meta_cb are called with a dict containing the metadata of the received frame
  • xxx_data_cb are called with a bytearray containing the data of the received frame
  • h264_***_cb are associated to the H264 encoded video stream
  • raw_***_cb are associated to the decoded video stream

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.

Parameters:expectations – An SDK message expectation expression
Return type:ArsdkExpectationBase

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

Parameters:message (ArsdkMessage) – an event message type
Returns: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:ReturnTuple
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:ReturnTuple
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