我目前正在使用Inspire 2& M210 RTK。有人可以帮助我使用Mobile-SDK从无人机获取避障传感器输出的数据吗?我想在不断更新的数值中获得无人机前面物体的精确距离读数。有什么代码示例吗?我是DJI SDK的新手,因此任何帮助都将不胜感激。提前感谢!
发布于 2017-10-29 06:45:36
在开始之前,请记住,您收到的距离并不完全准确。
有几种方法可以使用移动SDK访问传感器。
1/使用DJIFlightAssistant的避障部分的传统接口
实现didUpdateVisionDetectionState method
2/使用这些键,您可以开始收听Flight Controller key DJIFlightAssistantParamDetectionSectors。调用的块将包含一个具有obstacleDistanceInMeters的DJIObstacleDetectionSector数组
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.
})
https://stackoverflow.com/questions/46868419
复制相似问题