param

Enables reading/writing of parameter values to/from the Crazyflie.

When a Crazyflie is connected it’s possible to download a TableOfContent of all the parameters that can be written/read.


Classes

Param

Param(crazyflie)

Used to read and write parameter values in the Crazyflie.


Methods

def add_update_callback(self, group=None, name=None, cb=None)

Add a callback for a specific parameter name. This callback will be executed when a new value is read from the Crazyflie.


def get_default_value(self, complete_name, callback)

Get the default value of the specified parameter. The supplied callback will be called with the name of the parameter as well as the default value. None if there is an error.

Parameters

Name Description
complete_name The ‘group.name’ name of the parameter to store
callback The callback should take complete_name and default value as argument

def get_value(self, complete_name, timeout=60)

Read a value for the supplied parameter. This can block for a period of time if the parameter values have not been fetched yet.


def persistent_clear(self, complete_name, callback=None)

Clear the current value of the specified persistent parameter from eeprom. The supplied callback will be called with True as an argument on success and with False as an argument on failure.

Parameters

Name Description
complete_name The ‘group.name’ name of the parameter to store
callback Optional callback should take complete_name and boolean status as arguments

def persistent_get_state(self, complete_name, callback)

Get the state of the specified persistent parameter. The state will be returned in the supplied callback. The state is represented as a namedtuple with members: is_stored, default_value and stored_value. The state is None if the parameter is not persistent or if something goes wrong.

Member Description
is_stored True if the value is stored to eeprom
default_value The default value supplied by the firmware
stored_value Value stored in eeprom, None if not is_stored

Parameters

Name Description
complete_name The ‘group.name’ name of the parameter to store
callback Callback, takes complete_name and PersistentParamState namedtuple as arg

def persistent_store(self, complete_name, callback=None)

Store the current value of the specified persistent parameter to eeprom. The supplied callback will be called with True as an argument on success, and with False as an argument on failure.

Parameters

Name Description
complete_name The ‘group.name’ name of the parameter to store
callback Optional callback should take complete_name and boolean status as arguments

def refresh_toc(self, refresh_done_callback, toc_cache)

Initiate a refresh of the parameter TOC.


def remove_update_callback(self, group, name=None, cb=None)

Remove the supplied callback for a group or a group.name


def request_param_update(self, complete_name)

Request an update of the value for the supplied parameter.


def request_update_of_all_params(self)

Request an update of all the parameters in the TOC


def set_value(self, complete_name, value)

Set the value for the supplied parameter.


def set_value_raw(self, complete_name, type, value)

Set a parameter value using the complete name and the type. Does not need to have received the TOC.


ParamTocElement

ParamTocElement(ident=0, data=None)

An element in the Log TOC.

TocElement creator. Data is the binary payload of the element.


Class variables

EXTENDED_PERSISTENT

RO_ACCESS

RW_ACCESS

types

Methods

def get_readable_access(self)

def is_extended(self)

def is_persistent(self)

def mark_persistent(self)