我正在使用Phantom 4 Pro无人机,它具有精确的着陆能力 . 我正在使用Swift和iPad来控制无人机 . 在DJI Go软件中,我可以启用它,并且它可以正常工作 . 但是,在我正在处理的应用程序中,任何启用它的调用都会失败 .
这是尝试启用它的代码:
static func setPrecisionLandingEnabled(precisionLandingEnabled: Bool, _ completeFunction: @escaping (Error?) -> Void) throws {
guard let djiKeyManager = DJISDKManager.keyManager() else {
GLog.Log("Error in Flight Controller Observer. Problem getting djiKeyManager in \(#file) \(#function)")
throw FlightControllerManager.FlightControllerError.cantGetKeyManager
}
guard let precisionLandingEnabledKey = DJIFlightControllerKey(param: DJIFlightAssistantParamPrecisionLandingEnabled) else {
GLog.Log("Error in Flight Controller Observer. Problem getting precisionLandingEnabledKey in \(#file) \(#function)")
throw FlightControllerManager.FlightControllerError.cantGetKey
}
djiKeyManager.setValue(precisionLandingEnabled, for: precisionLandingEnabledKey, withCompletion: completeFunction)
}
当我调用该函数时,DJI SDK的完成功能返回以下错误:
Error Domain = DJISDKErrorDomain Code = -1013 \“当前产品不支持此功能 . (代码:-1013)\”
我检查过,在发出与精确着陆有关的“起飞”调用时没有传入任何参数 . 那么,当我知道无人机具有此功能(由DJI自己的应用程序验证)时,为什么会出现此错误?在启用此功能之前,无人机是否必须首先飞行?或者在启用此功能之前是否还有其他必须满足的条件?
1 回答
它在我看来你应该创建一个
DJIFlightAssistant
对象,然后使用现有的方法setPrecisionLandingEnabled(_: Bool, completion: DJICompletionBlock)
你为什么要编写自己的
setPrecisionLandingEnabled()
方法?