Save data from a service

Hi,

I’d like to know how to write data (images, txt files, etc…) on an external memory from a service. Could I get a sample on how to do this ?

Thanks !
Eliott

2 Likes

Hello @e267,

The AirSDK supports it but It is currently not documented.

Depending where the code is added:

  • From the Flight Supervisor state machine (Python) it is possible to get a path to write data from the mission object:
mission_data_root = self.mission.env.get_root_data_dir()
  • From a custom Service (C++ or Pyhton), it is possible to get a path to write data from the following environment variable:
const char *missionDataRoot = getenv("MISSION_DATA");
if (missionDataRoot != NULL) {
	...
}

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

Typically, the path on the system is:

/mnt/user-internal/missions-data/your-mission-uid/
3 Likes

Thanks !

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.