首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >使用DJI SDK的避障传感器数据(V4.3.2)

使用DJI SDK的避障传感器数据(V4.3.2)
EN

Stack Overflow用户
提问于 2017-10-22 05:43:26
回答 1查看 331关注 0票数 0

我目前正在使用Inspire 2& M210 RTK。有人可以帮助我使用Mobile-SDK从无人机获取避障传感器输出的数据吗?我想在不断更新的数值中获得无人机前面物体的精确距离读数。有什么代码示例吗?我是DJI SDK的新手,因此任何帮助都将不胜感激。提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2017-10-29 06:45:36

在开始之前,请记住,您收到的距离并不完全准确。

有几种方法可以使用移动SDK访问传感器。

1/使用DJIFlightAssistant的避障部分的传统接口

实现didUpdateVisionDetectionState method

  • In DJIFlightAssistantDelegate

  • Implement

  • DJIVisionDetectionState对象的委托,有一个detectionSectors属性,它是具有didUpdateVisionDetectionState method

  • In的DJIVisionDetectionStateDJIObstacleDetectionSector数组

2/使用这些键,您可以开始收听Flight Controller key DJIFlightAssistantParamDetectionSectors。调用的块将包含一个具有obstacleDistanceInMetersDJIObstacleDetectionSector数组

代码语言:javascript
运行
复制
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.
})
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46868419

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档