简体   繁体   English

Windows下的DJI OSDK

[英]DJI OSDK in Windows

I'm trying to get the DJI OSDK up and running from windows environment, but am hitting a few road blocks along the way. 我试图从Windows环境中启动DJI OSDK并使其运行,但是在此过程中遇到了一些障碍。 Know the SDK has been published for Windows 10, but not yet including the .Net API for M200 / 600 (what I'm trying to interface). 已知该SDK已针对Windows 10发布,但尚未包括适用于M200 / 600的.Net API(我正在尝试进行接口连接)。

So I first figured my best chance for getting it running on Windows is by trying to run a linux sample application from windows (via Visual studio 2017). 因此,我首先想到了让它在Windows上运行的最佳机会是尝试从Windows运行一个Linux示例应用程序(通过Visual Studio 2017)。 Struggled with linux dependencies in the beginning but eventually figured it out by writing a Windows Serial conn class and including pthread.dll for windows (with some minor additional alterations and included #if _WIN32 etc...) 开始时一直与linux依赖项纠缠不清,但最终通过编写Windows Serial conn类并为Windows包含pthread.dll来弄清了它(进行了一些小的附加更改,并包含#if _WIN32等。)

After quite a bit of coding and debugging (also tried Qt sample app via VS tools - whole can of worms on it's own), I'm still struggling with my "Hello world" application from the drone / RPA. 经过大量的编码和调试(也通过VS工具尝试了Qt示例应用程序-蠕虫本身就是一整罐),我仍然在无人机/ RPA的“ Hello world”应用程序中苦苦挣扎。 (Even the rest works where I export it to a DLL and implement in c# environment, but besides the point). (即使其余的工作都可以在我将其导出到DLL并在c#环境中实现的情况下进行,但除此之外)。

After connecting to the platform (basically initialization and serial port opening) the Activate function sends your app ID + key to the RPA and receives an acknowledgement: This being my code: 连接到平台后(基本上是初始化和串行端口打开), Activate函数将您的应用程序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);

The activation function 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,L47:尝试使用波特率230400打开设备COM21 ...

STATUS/1 @ DJI::OSDK::Win_serial_device::init, L75: ...Serial started successfully. STATUS / 1 @ DJI :: OSDK :: Win_serial_device :: init,L75:...序列已成功启动。

ERRORLOG/1 @ getDroneVersion, L1378: Drone version not obtained! ERRORLOG / 1 @ getDroneVersion,L1378:未获得无人机版本! Please do not proceed. 请不要继续。 Possible reasons: Serial port connection: 可能的原因:串行端口连接:

  • SDK is not enabled, please check DJI Assistant2 SDK -> [v] Enable API Control. 未启用SDK,请检​​查DJI Assistant2 SDK-> [v]启用API控制。

  • Baudrate is not correct, please double-check from DJI Assistant2 -> SDK -> baudrate. 波特率不正确,请在DJI Assistant2-> SDK-> baudrate中进行确认。

  • TX and RX pins are inverted. TX和RX引脚反相。

  • 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). 请执行'sudo usermod -a -G Dialout $ USER'(您不需要用用户名替换$ USER)。 Then logout and login again 然后注销并再次登录

ERRORLOG/1 @ activate, L1267: Unable to initialize some vehicle components! ERRORLOG / 1 @激活,L1267:无法初始化某些车辆部件! STATUS/1 @ getErrorCodeMessage, L656: Activate STATUS/1 @ getCommonErrorCodeMessage, L722: ACK_NO_RESPONSE_ERROR STATUS / 1 @ getErrorCodeMessage,L656:激活STATUS / 1 @ getCommonErrorCodeMessage,L722:ACK_NO_RESPONSE_ERROR

...Already checked the suggested issues, but can't pick up anything apparent. ...已经检查了建议的问题,但看不到任何明显的问题。 At this point not knowing if the problem is hardware-, software (with altered code and threading). 在这一点上,不知道问题是否出在硬件,软件(具有更改的代码和线程)上。 If anyone with DJI platforms (M-range), or on the DJI dev. 如果有人使用DJI平台(M系列)或DJI开发人员。 team can please assist? 团队可以帮忙吗? I'm desperate to get this working! 我很想让这个工作! :( :(

I've also shared the code solution on Github DJI OSDK Win Console 我还分享了Github DJI OSDK Win Console上的代码解决方案

Hi Im shenghai and I have been running DJI hardware for non-GPS/LIDAR/Vision based autonomous research for 3 years. 嗨,我和我是圣海,我从事基于非GPS / LIDAR / Vision的自主研究的DJI硬件已经运行了3年。

It is a typical problem which DJI wont tell you the full list. DJI不会告诉您完整列表,这是一个典型的问题。 Here is a checklist that I come up with 这是我提出的清单

(1) Connect API cable first. (1)首先连接API电缆。 Then Run OSDK. 然后运行OSDK。 then connect simulator cable then run DJI assistant. 然后连接模拟器电缆,然后运行DJI Assistant。 There is proper sequence shit which DJI don't feel obliged to share. DJI认为没有必要共享适当的序列垃圾。

(2) Ensure your cable is 3.3, not 5 (2)确保电缆是3.3,而不是5

(3) Tx Rx swap. (3)Tx Rx交换。 Common problem. 常见问题。 Can check by realterm 可以实时检查

(4) Ensure your DJI go app is running and the controller is powered on b4 start serial connection (4)确保您的DJI Go App正在运行且控制器已开启b4启动串行连接

(5) Ensure app id and enc key is correct. (5)确保应用程序ID和Enc密钥正确。 And the account this id and key are associated is also running in ur tablet. 与该ID和密钥关联的帐户也在您的平板电脑中运行。 We encounter this issue for some special compassless firmware, if you have close relationships with DJI they will provide u with lots of shit to test. 对于某些特殊的无指南针固件,我们会遇到此问题,如果您与DJI有着密切的关系,它们将为您提供很多测试条件。

(6) Ensure your Serial have authority. (6)确保您的序列号具有权限。 In ubuntu is sudo chmod a+rw /dev/serial/by-id/usb-XXmanufactoridXX-port0. 在ubuntu中是sudo chmod a + rw / dev / serial / by-id / usb-XXmanufactoridXX-port0。 Windows forgot. Windows忘记了。 haven`t use it for years 多年没有使用它

(7) Ensure your API is enabled in DJI assistant. (7)确保已在DJI Assistant中启用API。 Also for a quick check, disconnect and connect to the assistant, ensure API is still checked. 另外,为了进行快速检查,请断开连接并连接到助手,确保仍检查API。 We have a bad experience with it. 我们对此有不好的经验。 No matter how many time i check, it went uncheck. 无论我检查多少次,都取消检查。 Took us a while to find the bug 花了我们一段时间才能找到错误

(8) Ensure you are running current Assistant 2. For matrix should be DJI assistant for Matrix. (8)确保正在运行当前的Assistant2。对于Matrix,应为Matrix的DJI Assistant。 For a different drone, there is a different version. 对于不同的无人机,有不同的版本。 I know its complex. 我知道它的复杂性。 no idea why they do so. 不知道为什么要这么做。

(9) Ensure you OSDK build is complete and functional. (9)确保您的OSDK构建完整且功能正常。 No missing dependency or funny errors. 没有遗漏的依赖关系或有趣的错误。 It happens a lot with new 3.7 and 3.8 stereo vision system 新的3.7和3.8立体视觉系统经常发生这种情况

That's pretty much all I can think so far. 到目前为止,这几乎是我能想到的全部。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM