GSFlightPlanPilotingItf

@objc
public protocol GSFlightPlanPilotingItf : ActivablePilotingItf, PilotingItf

Flight Plan piloting interface for drones.

Allows to make the drone execute predefined flight plans. 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:

id<GSFlightPlanPilotingItf> fplan = (id<GSFlightPlanPilotingItf>)[drone getPilotingItf:GSPilotingItfs.flightPlan];

Note

This protocol is for Objective-C only. Swift must use the protocol FlightPlanPilotingItf.
  • Latest flight plan file upload state.

    Declaration

    Swift

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

    Negative value when not available.

    Declaration

    Swift

    @objc(latestMissionItemExecuted)
    var gsLatestMissionItemExecuted: UInt { 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.

    Note

    activate(restart:) will call activate(restart: type:), default value of type is flightPlan

    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

  • 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, interpreter: FlightPlanInterpreter) -> Bool

    Parameters

    restart

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

    interpreter

    instructs how the flight plan must be interpreted by the drone.

    Return Value

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

  • Tells whether a given reason is partly responsible of the unavailable state of this piloting interface.

    Declaration

    Swift

    func hasUnavailabilityReason(_ reason: FlightPlanUnavailabilityReason) -> Bool

    Parameters

    reason

    the reason to query

    Return Value

    true if the piloting interface is partly unavailable because of the given reason.