2017-10-21 122 views
0

我目前正在使用M210 RTK的Inspire 2 &。任何人都可以幫助我使用Mobile-SDK從無人機獲取障礙避免傳感器數據輸出嗎?我希望從持續更新的無人機前面的物體讀取確切的距離。任何代碼示例?我對DJI SDK比較陌生,所以任何幫助都將不勝感激。提前致謝!使用DJI SDK(V4.3.2)避障傳感器數據

回答

1

在進入此之前,請記住,您收到的距離不完全準確。

有幾種方法可以通過移動SDK訪問傳感器。使用的DJIFlightAssistant

2 /使用按鍵,您可以開始收聽Flight Controller key DJIFlightAssistantParamDetectionSectors。叫將包含DJIObstacleDetectionSector陣列中的塊,其具有obstacleDistanceInMeters

guard let detectionSectorsKey = DJIFlightControllerKey(param: DJIFlightAssistantParamDetectionSectors) else { 
    // failed to create the key 
    return; 
} 

guard let keyManager = DJISDKManager.keyManager()? else { 
    // failed to access the keyManager. You're most likely not registered yet. 
    return; 
} 

keyManager.startListeningForChanges(on: detectionSectorsKey, withListener: self, andUpdate: { (oldValue, newValue) in 
    let sectors = newValue?.value as! [DJIObstacleDetectionSector] 

    //do stuff. 
})