1
iOS에서 DJI Drone의 GPS 좌표를 원합니다. Takeoff 때 GPS 위치를 얻으려면 메서드 나 속성이 필요합니다.GPS의 정확한 위치를 얻는 데 사용되는 기능 iOS 용 DJI Drone의 좌표
iOS에서 DJI Drone의 GPS 좌표를 원합니다. Takeoff 때 GPS 위치를 얻으려면 메서드 나 속성이 필요합니다.GPS의 정확한 위치를 얻는 데 사용되는 기능 iOS 용 DJI Drone의 좌표
당신은 기본적으로 두 가지 옵션이 있습니다 : DJIFlightController에
1/위임을 일명 DJIFlightControllerDelegate Protocol
당신은이 방법을 구현하고 위치가됩니다 DJIFlightControllerState 개체를 얻을 것이다:
- (void)flightController:(DJIFlightController *_Nonnull)fc didUpdateState:(DJIFlightControllerState *_Nonnull)state {
CLLocation *myCurrentLocation = state.aircraftLocation;
// Do something here.
}
을 2/키 인터페이스 사용 및이 키 DJIFlightControllerParamAircraftLocation (SDK 키 참조) 이 키는 CLLocation을 포함하는 값을 사용자에게 보냅니다.
그럼 당신은 간단한 모든 업데이트
guard let locationKey = DJIFlightControllerKey(param: DJIFlightControllerParamAircraftLocation) else {
NSLog("Couldn't create the key")
return
}
guard let keyManager = DJISDKManager.keyManager() else {
print("Couldn't get the keyManager")
// This will happen if not registered
return
}
keyManager.startListeningForChanges(on: locationKey, withListener: self) { (oldValue, newValue) in
if newValue != nil {
let location = newValue!.value as! CLLocation
// do something
}
}
에
guard let locationKey = DJIFlightControllerKey(param: DJIFlightControllerParamAircraftLocation) else {
NSLog("Couldn't create the key")
return
}
guard let keyManager = DJISDKManager.keyManager() else {
print("Couldn't get the keyManager")
// This will happen if not registered
return
}
if let locationValue = keyManager.getValueFor(locationKey) {
let location = locationValue.value as! CLLocation
// do something
}
을 얻거나 듣고 그냥이 완료되면 청취를 중단하는 것을 잊지 마세요 할 수있는 중.
이 정보가 도움이되기를 바랍니다.
추 신 : Swift와 Obj-C를 섞어서 사용할 수 있습니다.