Windows 中的 DJI OSDK

DJI OSDK in Windows

我正在尝试从 windows 环境中启动和 运行ning DJI OSDK,但在此过程中遇到了一些障碍。知道已为 Windows 10 发布了 SDK,但尚未包括 M200 / 600 的 .Net API(我正在尝试连接的内容)。

所以我首先想到在 Windows 运行 上获得它的最佳机会是尝试 运行 a linux 来自 windows 的示例应用程序(通过 Visual studio 2017)。开始时与 linux 依赖性作斗争,但最终通过编写 Windows Serial conn class 并包含 [= 来解决这个问题38=] for windows(有一些小的额外改动,包括#if _WIN32 等...)

经过相当多的编码和调试(还通过 VS 工具尝试了 Qt 示例应用程序——它本身就是一整套蠕虫病毒),我仍在努力处理来自无人机/RPA 的 "Hello world" 应用程序. (即使其余的工作我将它导出到 DLL 并在 c# 环境中实现,但除此之外)。

连接到平台后(主要是初始化和串行端口打开)激活函数 将您的应用程序 ID + 密钥发送到 RPA 并收到确认:这是我的代码:

    bool threadSupport = true;  //disable first so that able to debug
    vehicle = new Vehicle(Port, baud, threadSupport, AdvancedSensing);

    //test if connection works fine
    if (!vehicle->protocolLayer->getDriver()->getDeviceStatus())
    {
        //not working, delete current instances
        delete (vehicle);
        vehicle = nullptr;  //set back to null pointer
    }

    DJI::OSDK::Vehicle::ActivateData actData;
    actData.ID = appID;
    actData.encKey = new char[65];
    strcpy(actData.encKey, key);
    actData.version = getFWVersion();

    ACK::ErrorCode ack = vehicle->activate(&actData, 1);

激活函数returns'invalid feedback':

STATUS/1 @ DJI::OSDK::Win_serial_device::init, L47: Attempting to open device COM21 with baudrate 230400...

STATUS/1 @ DJI::OSDK::Win_serial_device::init, L75: ...Serial started successfully.

ERRORLOG/1 @ getDroneVersion, L1378: Drone version not obtained! Please do not proceed. Possible reasons: Serial port connection:

  • SDK is not enabled, please check DJI Assistant2 SDK -> [v] Enable API Control.

  • Baudrate is not correct, please double-check from DJI Assistant2 -> SDK -> baudrate.

  • TX and RX pins are inverted.

  • Serial port is occupied by another program. * Permission required. Please do 'sudo usermod -a -G dialout $USER' (you do not need to replace $USER with your username). Then logout and login again

ERRORLOG/1 @ activate, L1267: Unable to initialize some vehicle components! STATUS/1 @ getErrorCodeMessage, L656: Activate STATUS/1 @ getCommonErrorCodeMessage, L722: ACK_NO_RESPONSE_ERROR

...已经检查了建议的问题,但无法找到任何明显的问题。此时不知道问题是硬件还是软件(代码和线程发生了变化)。如果有 DJI 平台(M 系列)或 DJI 开发人员。团队可以帮忙吗?我非常想让这个工作! :(

我也在 Github DJI OSDK Win Console

上分享了代码解决方案

嗨,我是 shenghai,我已经 运行ning DJI 硬件进行基于 non-GPS/LIDAR/Vision 的自主研究 3 年了。

这是一个典型的问题,DJI 不会告诉你完整的列表。这是我想出的清单

(1) 先连接 API 电缆。然后 运行 OSDK。然后连接模拟器线然后运行 DJI助手。有一些 DJI 觉得没有义务分享的正确顺序。

(2) 确保您的电缆是 3.3,而不是 5

(3) Tx Rx 交换。常见问题。可以通过realterm查看

(4) 确保您的 DJI go 应用 运行ning 并且控制器已开机 b4 开始串行连接

(5) 确保app id 和enc key 正确。并且此 ID 和密钥关联的帐户也在您的平板电脑中 运行ning。我们遇到这个问题是因为一些特殊的无罗盘固件,如果你与 DJI 有密切的关系,他们会给你提供很多东西来测试。

(6) 确保你的Serial有权限。在 ubuntu 中是 sudo chmod a+rw /dev/serial/by-id/usb-XXmanufactoridXX-port0。 Windows忘记了。好多年没用了

(7) 确保您的API已在大疆助手中开启。同样为了快速检查,断开并连接到助手,确保 API 仍然被选中。我们对此有不好的体验。无论我检查多少次,它都未选中。我们花了一些时间才找到错误

(8) 确保你运行正在使用当前的助手 2。对于 Matrix 应该是 DJI 的 Matrix 助手。对于不同的无人机,有不同的版本。我知道它很复杂。不知道他们为什么这样做。

(9) 确保您的 OSDK 构建完整且正常运行。没有丢失的依赖项或有趣的错误。新的 3.7 和 3.8 立体视觉系统经常发生这种情况

目前我能想到的差不多就是这些了。