Storage and persistence#

Air SDK allows to write custom mission data to the drone’s storage that will be persisted across launches and reboots.

To persist data Air SDK provides you with a writable path. This path can be retrieved either from the Flight Supervisor state machine (Python) using the mission object:

mission_data_root = self.mission.env.get_root_data_dir()

or from the following environment variable in guidance or services, both in C++ and Python. The following example being in C++:

const char *missionDataRoot = getenv("MISSION_DATA");
if (missionDataRoot != NULL) {
    ...
}

The data written to that path will be available through MTP/PTP under the folder missions-data when the drone is connected to a computer through USB.

Note

Please note that it is not possible for a mission to write to the SD card. Only the default photo and video recording can be done on the SD card.

Configuration files#

The path to configuration files of the mission in its root filesystem (where etc, share, … directories can be found) can be retrieved in python with:

mission_configuration_root = self.mission.env.get_product_cfg_dir()

In C++ with:

const char *missionConfigurationRoot = getenv("MISSION_PRODUCT_ROOT_CFG");
if (missionConfigurationRoot != NULL) {
    ...
}