其他分享
首页 > 其他分享> > DJI 飞控 onboard SDK(一)

DJI 飞控 onboard SDK(一)

作者:互联网

sdk例程调试记录

@author:sgh
@QQ:3241952956
在这里插入图片描述
这里在MDK工程里cpp和c混用了,不知道这样做的意义是什么
在这里插入图片描述
编译ok,不需要更改其他配置
在这里插入图片描述
小知识:#elif等价于#else + #if
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
这个文件讲的比较详细建议看这个
放个百度网盘链接链接:https://pan.baidu.com/s/1sN3e8LSWiEJchafCL0YSHQ
提取码:t1mt

准备工作:app id和key

在这里插入图片描述
在这里插入图片描述
飞行控制功能的官方文档
注册ID和相关说明
代码没怎么看,先去注册账号
在这里插入图片描述
id注册成功

准备工作:硬件连接

在这里插入图片描述
找到个f407的板子,就不做代码修改了
在这里插入图片描述
这里的usart3和usart2写反了,
实际上配置是和板子原理图一致
找到了引脚定义
在这里插入图片描述
在这里插入图片描述
接线,烧写程序
在这里插入图片描述
在这里插入图片描述
放一下例程链接
链接:https://pan.baidu.com/s/1XMmCSnIAJ-vZYH2Y8EZp0w
提取码:4e59

通过串口来调试

在这里插入图片描述
在这里插入图片描述
尝试了在main函数开头直接define的方式来进入例程,串口打印如下

_q鍌傢?9遛9歋TM32F4Discovery Board initialization finished!
Sample App for STM32F4Discovery Board:

Prerequisites:

  1. Vehicle connected to the Assistant and simulation is ON
  2. Battery fully chanrged
  3. DJIGO App connected (for the first time run)
  4. Gimbal mounted if needed

STATUS/1 @ DJI::OSDK::Vehicle::parseDroneVersionInfo, L727: Device Serial No. = 0DBDE4T002007P

STATUS/1 @ DJI::OSDK::Vehicle::parseDroneVersionInfo, L729: Hardware = N3

STATUS/1 @ DJI::OSDK::Vehicle::parseDroneVersionInfo, L730: Firmware = 3.3.8.47

STATUS/1 @ DJI::OSDK::Vehicle::getDroneVersionCallback, L1541: Device Serial No. = 0DBDE4T002007P

STATUS/1 @ DJI::OSDK::Vehicle::getDroneVersionCallback, L1544: Hardware = N3

STATUS/1 @ DJI::OSDK::Vehicle::getDroneVersionCallback, L1545: Firmware = 303082F

ERRORLOG/1 @ DJI::OSDK::Vehicle::initVirtualRC, L1103: Virtual RC is not supported on this platform!

STATUS/1 @ DJI::OSDK::Vehicle::parseDroneVersionInfo, L727: Device Serial No. = 0DBDE4T002007P

STATUS/1 @ DJI::OSDK::Vehicle::parseDroneVersionInfo, L729: Hardware = N3

STATUS/1 @ DJI::OSDK::Vehicle::parseDroneVersionInfo, L730: Firmware = 3.3.8.47

STATUS/1 @ DJI::OSDK::Vehicle::getDroneVersionCallback, L1541: Device Serial No. = 0DBDE4T002007P

STATUS/1 @ DJI::OSDK::Vehicle::getDroneVersionCallback, L1544: Hardware = N3

STATUS/1 @ DJI::OSDK::Vehicle::getDroneVersionCallback, L1545: Firmware = 303082F

ERRORLOG/1 @ DJI::OSDK::Vehicle::initVirtualRC, L1103: Virtual RC is not supported on this platform!

STATUS/1 @ DJI::OSDK::Vehicle::activate, L1276: version 0x303082F

STATUS/1 @ DJI::OSDK::ACK::getErrorCodeMessage, L656: DJI::OSDK::Vehicle::activateCallback
STATUS/1 @ DJI::OSDK::ACK::getCMDSetActivationMSG, L705: ACTIVATE_SUCCESS

STATUS/1 @ DJI::OSDK::DataSubscription::verifyCallback, L220: Verify subscription successful.
STATUS/1 @ DJI::OSDK::ACK::getErrorCodeMessage, L656: DJI::OSDK::Vehicle::controlAuthorityCallback
STATUS/1 @ DJI::OSDK::ACK::getCMDIDSetControlMSG, L801: OBTAIN_CONTROL_IN_PROGRESS

STATUS/1 @ DJI::OSDK::ACK::getErrorCodeMessage, L656: DJI::OSDK::Vehicle::controlAuthorityCallback
STATUS/1 @ DJI::OSDK::ACK::getCMDIDSetControlMSG, L801: OBTAIN_CONTROL_SUCCESS

Starting executing position control sample:

STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L298: Start package 0 result: 0.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L300: Package 0 info: freq=10, nTopics=2.Takeoff failed. Motors failed to start!

STATUS/1 @ DJI::OSDK::DataSubscription::removePackageCallback, L440: Remove package 0 successful.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L298: Start package 0 result: 0.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L300: Package 0 info: freq=50, nTopics=2.
STATUS/1 @ DJI::OSDK::ACK::getErrorCodeMessage, L656: DJI::OSDK::DataBroadcast::setFrequencyCallback
STATUS/1 @ DJI::OSDK::ACK::getCMDSetActivationMSG, L705: ACTIVATE_SUCCESS
Task timeout!

STATUS/1 @ DJI::OSDK::DataSubscription::removePackageCallback, L440: Remove package 0 successful.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L298: Start package 0 result: 0.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L300: Package 0 info: freq=50, nTopics=2.
STATUS/1 @ DJI::OSDK::ACK::getErrorCodeMessage, L656: DJI::OSDK::DataBroadcast::setFrequencyCallback
STATUS/1 @ DJI::OSDK::ACK::getCMDSetActivationMSG, L705: ACTIVATE_SUCCESS
Task timeout!

STATUS/1 @ DJI::OSDK::DataSubscription::removePackageCallback, L440: Remove package 0 successful.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L298: Start package 0 result: 0.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L300: Package 0 info: freq=50, nTopics=2.
STATUS/1 @ DJI::OSDK::ACK::getErrorCodeMessage, L656: DJI::OSDK::DataBroadcast::setFrequencyCallback
STATUS/1 @ DJI::OSDK::ACK::getCMDSetActivationMSG, L705: ACTIVATE_SUCCESS
Task timeout!

STATUS/1 @ DJI::OSDK::DataSubscription::removePackageCallback, L440: Remove package 0 successful.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L298: Start package 0 result: 0.
STATUS/1 @ DJI::OSDK::DataSubscription::addPackageCallback, L300: Package 0 info: freq=10, nTopics=2.
STATUS/1 @ DJI::OSDK::ACK::getErrorCodeMessage, L656: DJI::OSDK::Control::actionCallback
STATUS/1 @ DJI::OSDK::ACK::getCMDIDTaskMSG, L836: CONTROLLER_MOTOR_OFF
Landing failed. Aircraft is still in the air.

STATUS/1 @ DJI::OSDK::DataSubscription::removePackageCallback, L440: Remove package 0 successful.
中间在active的时候花了点时间,因为要联网

在这里插入图片描述
机翼转了一下就停了,左下方参数也没有变化,可能是例程运行失败
根据代码,应该是先起飞再以1.2的高度四处晃晃,最后下降
根据串口打印,程序应该是在起飞任务中报错并停止执行
结论:结合源代码和串口打印,各个功能函数已经进入执行,但是因为不明原因存在问题
在这里插入图片描述在这里插入图片描述
网课链接
在这里插入图片描述
在这里插入图片描述
能函数已经进入执行,但是因为不明原因存在问题
网课链接

标签:STATUS,ACK,OSDK,Vehicle,DJI,onboard,DataSubscription,SDK
来源: https://blog.csdn.net/qq_45818518/article/details/110783887