我正在尝试为我的自定义iOS类采用DJIMutableWaypointMission,因为我希望在其上实现一些自定义验证代码(尚待编写)。一切似乎都能正常工作,我可以设置所有参数和航路点,但是当我尝试使用DJIMissionControl安排实例时,出现DJIMissionControlElementErrorInvalidMissionOperator错误,并带有以下描述:“传递的元素是没有有效操作员的任务。” < / p>
这是我的自定义任务班:
//
// WaypointMissionTimelineElement.swift
// ReactNativeDjiMobile
//
// Created by Adam Rosendorff on 2019/03/06.
//
import Foundation
import DJISDK
public class WaypointMissionTimelineElement: DJIMutableWaypointMission {
init(parameters: NSDictionary) {
super.init()
guard let autoFlightSpeedParameter = parameters["autoFlightSpeed"] as? Float else {
// TODO: (Adam) Throw an error here!
return
}
guard let maxFlightSpeedParameter = parameters["maxFlightSpeed"] as? Float else {
// TODO: (Adam) Throw an error here!
return
}
guard let waypointsParameter = parameters["waypoints"] as? [Any] else {
// TODO: (Adam) Throw an error here!
return
}
// guard let
// autoFlightSpeed = parameters["autoFlightSpeed"] as? Float
// maxFlightSpeed = parameters["maxFlightSpeed"] as? Float
// else {
// // TODO: (Adam) Throw an error here!
// }
self.autoFlightSpeed = autoFlightSpeedParameter
self.maxFlightSpeed = maxFlightSpeedParameter
var waypoints: [DJIWaypoint] = []
for case let waypointData as [String: Double] in waypointsParameter {
let waypointCoordinate = CLLocationCoordinate2D.init(latitude: waypointData["latitude"]!, longitude: waypointData["longitude"]!)
let waypoint = DJIWaypoint.init(coordinate: waypointCoordinate)
waypoint.altitude = Float(waypointData["altitude"]!)
waypoints.append(waypoint)
}
self.addWaypoints(waypoints)
}
}
我还需要在自定义类上设置什么以允许其计划并作为航点任务运行?
谢谢!