The workflow for the autonomous flights is the following:
- Create a ARMavlinkFileGenerator with ARMAVLINK_FileGenerator_New
- Add items to the file generator with ARMAVLINK_FileGenerator_AddMissionItem. You can create missionItems easily with ARMAVLINK_MissionItemUtils...
- Create the mavlink file with ARMAVLINK_FileGenerator_CreateMavlinkFile. Once this function has been called, the mavlink file is on your file system.
- Check that the drone is able to run a mavlink file with the event FlightPlanStateComponentStateListChanged:
void onCommandReceived (eARCONTROLLER_DICTIONARY_KEY commandKey, ARCONTROLLER_DICTIONARY_ELEMENT_t *elementDictionary, void *customData)
if ((commandKey == ARCONTROLLER_DICTIONARY_KEY_COMMON_FLIGHTPLANSTATE_COMPONENTSTATELISTCHANGED) && (elementDictionary != NULL))
ARCONTROLLER_DICTIONARY_ARG_t *arg = NULL;
ARCONTROLLER_DICTIONARY_ELEMENT_t *dictElement = NULL;
ARCONTROLLER_DICTIONARY_ELEMENT_t *dictTmp = NULL;
HASH_ITER(hh, elementDictionary, dictElement, dictTmp)
HASH_FIND_STR (dictElement->arguments, ARCONTROLLER_DICTIONARY_KEY_COMMON_FLIGHTPLANSTATE_COMPONENTSTATELISTCHANGED_COMPONENT, arg);
if (arg != NULL)
eARCOMMANDS_COMMON_FLIGHTPLANSTATE_COMPONENTSTATELISTCHANGED_COMPONENT component = arg->value.I32;
HASH_FIND_STR (dictElement->arguments, ARCONTROLLER_DICTIONARY_KEY_COMMON_FLIGHTPLANSTATE_COMPONENTSTATELISTCHANGED_STATE, arg);
if (arg != NULL)
uint8_t State = arg->value.U8;
GPS and Calibration of this event should be set to 1.
- Send your mavlink file to the drone using the ftp port 61 with filePath FILENAME.
- Once the Mavlink file has been received by the drone, you can send the StartMavlinkPlay command with your file name and with the type ARCOMMANDS_COMMON_MAVLINK_START_TYPE_FLIGHTPLAN:
deviceController->common->sendMavlinkStart(deviceController->common, FILENAME, ARCOMMANDS_COMMON_MAVLINK_START_TYPE_FLIGHTPLAN);
- If autonomous flight has been started, event MavlinkFilePlayingStateChanged is triggered with param state set to playing.
- Otherwise, event MavlinkFilePlayingStateChanged is triggered with param state set to stopped and event MavlinkPlayErrorStateChanged is triggered with an explanation of the error.
If this doesn't work, try changing the name of your mavlink file to flightplan.mavlink.
Hope this helps,