Plan

public struct Plan : Equatable

A plan file representation.

Parrot Plan format documentation

  • The current Plan format version.

    Declaration

    Swift

    public static let Version: String
  • The current plan format type.

    Declaration

    Swift

    public static let Filetype: String
  • The Parrot version of the items.

    That is the version of the Mavlink commands that will be used. The current API uses MavlinkStandard.MavlinkCommand which implicitly means V2.

    cf https://developer.parrot.com/docs/mavlink-flightplan/messages_v2.html cf Plan.generate(plan:atFilepath:groundStation:) for more information on the mission.items field.

    Declaration

    Swift

    public static let ItemsVersion: String
  • The static configuration of the plan.

    Declaration

    Swift

    public let staticConfig: StaticConfig?
  • The list of items of the plan.

    Declaration

    Swift

    public let items: [Item]
  • Constructor

    Declaration

    Swift

    public init(staticConfig: Plan.StaticConfig? = nil, items: [Plan.Item])

    Parameters

    staticConfig

    the static config of the plan.

    items

    the list of items of the plan.

  • Declaration

    Swift

    public subscript(command index: Int) -> MavlinkStandard.MavlinkCommand? { get }

    Parameters

    index

    the command index

    Return Value

    the command at index if any.

  • Declaration

    Swift

    public subscript(config index: Int) -> Config? { get }

    Parameters

    index

    the config index

    Return Value

    the config at index if any.

  • Generates a plan file in the given filepath URL with the given items and configurations.

    The resulting file will contain the plan file which is a JSON based format. The principal sections of the plan format are:

    • mission: an object that contains the mavlink command “items” array.
    • mission.items: an array of MavlinkCommand representations. Enriched with the optional “config” key which is an index in the config array (cf below)
    • configs: an object that contains the config “items” array.
    • configs.items: a dictionary of Config representations to string indices.

    Throws

    throws:

    Declaration

    Swift

    public static func generate(plan: Plan, at fileUrl: URL,
                                groundStation: String = "GroundSdk") throws

    Parameters

    plan

    the plan representation to write out to filepath.

    fileUrl

    a local file URL where the output will be written.

    groundStation

    the ground station id that creates the plan.

  • Generates plan file data.

    cf Plan.generate(plan:atFilepath:groundStation:) for more information.

    Throws

    Declaration

    Swift

    public static func generate(plan: Plan, groundStation: String = "GroundSdk") throws -> Data

    Parameters

    plan

    the plan representation to write out to filepath.

    groundStation

    the ground station id that creates the plan.

    Return Value

    a plan file (in JSON format)

  • Parses a plan file in the given filepath URL.

    The resulting object will contain the plan file which is a JSON based format.

    Throws

    • Plan.Error.unavailable if the service is not available.
    • Plan.Error.fileDoesNotExist if filepath does not exist.
    • Plan.Error.parseError if during the parsing any content of the plan file can not be converted.
    • any JSON decoder errors that can occur during decoding.

    Declaration

    Swift

    public static func parse(fileUrl: URL) throws -> Plan

    Parameters

    fileUrl

    a local file URL where an existing plan resides.

    Return Value

    a plan representation instance.

  • Parses a plan file data.

    The resulting object will contain the plan file which is a JSON based format.

    Throws

    • Plan.Error.unavailable if the service is not available.
    • Plan.Error.parseError if during the parsing any content of the plan file can not be converted.
    • any JSON decoder errors that can occur during decoding.

    Declaration

    Swift

    public static func parse(planData: Data) throws -> Plan

    Parameters

    filepath

    a local file URL where an existing plan resides.

    Return Value

    a plan representation instance.

  • A Plan generation/parsing error

    See more

    Declaration

    Swift

    public enum Error : Swift.Error, Equatable
  • The item of a plan file. It can either be a command or a configuration.

    See more

    Declaration

    Swift

    public enum Item : Equatable
  • The config of a particular plan item.

    See more

    Declaration

    Swift

    public struct Config : Equatable
  • The static config of a plan.

    See more

    Declaration

    Swift

    public struct StaticConfig : Equatable