FlightPlanPilotingItf

public protocol FlightPlanPilotingItf : ActivablePilotingItf, PilotingItf

Flight Plan piloting interface for drones.

Allows to make the drone execute predefined flight plans. A flight plan is defined using a file in Mavlink format. For further information, please refer to Parrot FlightPlan Mavlink documentation.

This piloting interface remains .unavailable until all FlightPlanUnavailabilityReason have been cleared:

  • A Flight Plan file (i.e. a mavlink file) has been uploaded to the drone (see uploadFlightPlan(filepath:))
  • The drone GPS location has been acquired
  • The drone is properly calibrated
  • The drone is in a state that allows it to take off

Then, when all those conditions hold, the interface becomes .idle and can be activated to begin or resume Flight Plan execution, which can be paused by deactivating this piloting interface.

This piloting interface can be retrieved by:

drone.getPilotingItf(flightPlan)
  • Latest flight plan file upload state.

    Declaration

    Swift

    var latestUploadState: FlightPlanFileUploadState { get }
  • Index of the latest mission item completed.

    Declaration

    Swift

    var latestMissionItemExecuted: Int? { get }
  • Set of reasons why this piloting interface is unavailable.

    Empty when state is .idle or .active.

    Declaration

    Swift

    var unavailabilityReasons: Set<FlightPlanUnavailabilityReason> { get }
  • Error raised during the latest activation.

    It is put back to .none as soon as activate(restart:) is called.

    Declaration

    Swift

    var latestActivationError: FlightPlanActivationError { get }
  • Whether the current flight plan on the drone is the latest one that has been uploaded from the application.

    Declaration

    Swift

    var flightPlanFileIsKnown: Bool { get }
  • Whether the flight plan is currently paused.

    If true, the restart parameter of activate(restart:) can be set to false to resume the flight plan instead of playing it from the beginning. If isPaused is false, this parameter will be ignored and the flight plan will be played from its beginning.

    When this piloting interface is deactivated, any currently playing flight plan will be paused.

    Declaration

    Swift

    var isPaused: Bool { get }
  • Uploads a Flight Plan file to the drone.

    When the upload ends, if all other necessary conditions hold (GPS location acquired, drone properly calibrated), then the interface becomes idle and the Flight Plan is ready to be executed.

    Declaration

    Swift

    func uploadFlightPlan(filepath: String)

    Parameters

    filepath

    local path of the file to upload

  • Activates this piloting interface and starts executing the uploaded flight plan.

    The interface should be .idle for this method to have effect. The flight plan is resumed if the restart parameter is false and isPaused is true. Otherwise, the flight plan is restarted from its beginning.

    If successful, it deactivates the current piloting interface and activate this one.

    Declaration

    Swift

    func activate(restart: Bool) -> Bool

    Parameters

    restart

    true to force restarting the flight plan. If isPaused is false, this parameter will be ignored.

    Return Value

    true on success, false if the piloting interface can’t be activated