-
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 themission.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:
Plan.Error.unavailable
if the service is not available.Plan.Error.noItems
ifitems
is empty.Plan.Error.fileExists
iffilepath
points to an existing file.- any JSON encoder errors that can occur during generation.
- any FileManager errors that can occur during path manipulations.
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
Plan.Error.unavailable
if the service is not available.Plan.Error.noItems
ifitems
is empty.- any JSON encoder errors that can occur during generation.
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
iffilepath
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 moreDeclaration
Swift
public enum Error : Swift.Error, Equatable
-
The item of a plan file. It can either be a command or a configuration.
See moreDeclaration
Swift
public enum Item : Equatable
-
The config of a particular plan item.
See moreDeclaration
Swift
public struct Config : Equatable
-
The static config of a plan.
See moreDeclaration
Swift
public struct StaticConfig : Equatable