Storage and persistence#

Air SDK allows to write persistent data to the drone’s storage (internal or SD card). Temporary data not persistent across reboots can also be written.

Important

Please note that there is no confidentiality of data written on the drone’s storage: any mission can read data written by another mission. Therefore, it is up to the mission developer to handle the security of the data.

Mission data storage#

Air SDK provides each mission with a mission data directory in the drone’s internal memory that is persistent across reboots. The path to this internal storage directory can be retrieved:

  • from the Flight Supervisor state machine (Python) using the mission object:

    mission_data_root = self.mission.env.get_root_data_dir()
    
  • from the following environment variable in Services:

    • in C++:

      const char *missionDataRoot = getenv("MISSION_DATA");
      if (missionDataRoot != nullptr) {
          ...
      }
      
    • in Python:

      import os
      missionDataRoot = os.getenv('MISSION_DATA')
      if missionDataRoot is not None:
          ...
      

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. Please note that the mission data directory is stored in the drone’s internal storage.

Mission temporary data#

Air SDK provides each mission with a temporary data directory that is not persistent across reboots. This directory can be accessed:

  • from the Flight Supervisor with the function get_root_data_tmp_dir()

  • from the Services with the environment variable MISSION_DATA_TMP

SD card storage#

An Air SDK mission can also write to the drone’s SD card.

Important

Please note that the drone’s SD card storage is shared between multiple missions in addition to the photos and videos recorded by the drone. The available SD card memory bandwidth may vary while the drone is performing a video recording. Hence, it is not recommended to use the SD card storage intensively and/or while the drone is performing a video recording or photo capture.

The storage is mounted under /mnt/user.

Before accessing the SD card storage, the user must verify that the drone firmware has mounted it and considers it ready. The drone firmware indicates that the SD card is ready through the user.storage.status property. This property can be accessed using:

  • the gprop command line utility on the drone

    # gprop user.storage.status
    ready
    
  • from a C or C++ service using the sys_prop_get() function from libputils:

    #include <putils/properties.h>
    ...
    char prop[SYS_PROP_VALUE_MAX];
    sys_prop_get(“user.storage.status”, prop, "0");
    if (strcmp(prop, "ready") == 0) {
      /* The storage is ready to be used */
    }
    

Configuration files#

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

  • from Flight Supervisor:

    mission_configuration_root = self.mission.env.get_product_cfg_dir()
    
  • from Guidance:

    • in C++:

      std::string missionConfigurationRoot = guidance->getConfigDir();
      
    • in Python:

      mission_configuration_root = guidance.get_config_dir()
      
  • from Services:

    • in C++:

      const char *missionConfigurationRoot = getenv("MISSION_PRODUCT_ROOT_CFG");
      if (missionConfigurationRoot != nullptr) {
          ...
      }
      
    • in Python:

      import os
      mission_configuration_root = os.getenv('MISSION_PRODUCT_ROOT_CFG')
      if mission_configuration_root is not None:
          ...