esdk 运行时一直报错

已完成

评论

10 条评论

  • jackMa

    麻烦回复下,这效率太低了,psdk论坛你们都回复两三条了,这边18个小时了也没回复。

    0
    评论操作 固定链接
  • DJI Developer Support
    报错信息为: “Updating session key... Ensure the device is pre-bound via pilot and the RSA key information is accurate.”。未通过 Pilot 设备绑定或者密钥丢失。 解决方法:需要将大疆机场与遥控器连接,在 DJI Pilot 弹出的调试界面中点击 “绑定” 按钮以绑定设备。
    0
    评论操作 固定链接
  • jackMa

    不是,我已经修改了秘钥存储位置不在temp下,理论上这个秘钥不会过期吧,而且你看日志,是能够获取到帧数据的,现象是,隔了几帧就会发起连接。如果是未绑定,那应该是一帧都获取不到吧

    0
    评论操作 固定链接
  • jackMa

    刚才试了下,把 private_key 和 pub_key 删除掉,重新到机场侧去绑定边缘计算设备。

    依然会发生的问题,绑定完几秒后(状态已经变成绑定),会闪一下绑定得按钮 。日志控制台也会打印

    Updating session key... Ensure the device is pre-bound via pilot and the RSA key information is accurate。

    但实际更多时候打印的是 466.561][core]-[Info]-[DjiIdentityVerify_Update:123) Update dji sdk policy file successfully 。

    像我上面说的,实际上边缘计算盒是和机场连接成功的,只是几秒就会断联重新连接。麻烦您重视下这个问题。

     

    而且1.1.1还有个问题,我参数传的是 1 5 1 ,理论上frame的长宽应该是 cv::Size(2.25*640, 1.6875*640) ,但是现在实际变成了 cv::Size(1.5*640, 1.125*640),导致我推流蓝屏,这个分辨率不是应该受 StreamQuality 参数固定么。

     

    下面日志能反映出来精分情况,上一条还打印了Update dji sdk policy file successfully ,下面就立马打印了 Updating session key... Ensure the device is pre-bound via pilot and the RSA key information is accurate.

    ```

    [897.085][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.085][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.085][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.086][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.103][core]-[Info]-[DjiIdentityVerify_Update:123) Update dji sdk policy file successfully 
    [897.103][security]-[Debug]-[UpdateSessionKey:421) Udpate session key request.. 
    [897.103][linker]-[Debug]-[DjiProtocol_v1Pack:119) V1-Send: 0xF6->0xA6 0x4995 
    [897.107][linker]-[Debug]-[DjiProtocol_v1Unpack:204) V1-Recv: 0xA6->0xF6 0x4995 
    [897.107][linker]-[Debug]-[DjiCommand_RecvWork:961) Receive msg from linker, id:0x4995 len:5 
    [897.107][linker]-[Debug]-[DjiCommand_DealCmd:736) callback function (cmdset: 0x49 cmdid: 0x95) deal time: 0 ms 
    [897.108][user]-[Debug]-[GetPrivKey:56) private len: 1192 
    [897.108][security]-[Debug]-[requestSessionKey:381) here 
    [897.108][security]-[Info]-[RequestSessionKey:537) Updating session key... Ensure the device is pre-bound via pilot and the RSA key information is accurate. 
    [897.116][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.116][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.116][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.116][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 
    [897.117][security]-[Debug]-[StreamDecrypt:448) decrypt exit, session updating... 

    ```

    0
    评论操作 固定链接
  • DJI Developer Support
    这是运行了两次ESDK Init导致的,不能两个ESDK进程同时订阅码流。需要在一个进程中分别订阅两路码流。
    0
    评论操作 固定链接
  • jackMa

    没有啊,我就初始化了一次esdk init方法。

     

     /**********************************************************************
    *
    * @copyright (c) 2023 DJI. All rights reserved.
    *
    * All information contained herein is, and remains, the property of DJI.
    * The intellectual and technical concepts contained herein are proprietary
    * to DJI and may be covered by U.S. and foreign patents, patents in process,
    * and protected by trade secret or copyright law. Dissemination of this
    * information, including but not limited to data and other proprietary
    * material(s) incorporated within the information, in any form, is strictly
    * prohibited without the express written consent of DJI.
    *
    * If you receive this source code without DJI’s authorization, you may not
    * further disseminate the information, and you must immediately remove the
    * source code and notify DJI of its removal. DJI reserves the right to pursue
    * legal actions against you for any loss(es) or damage(s) caused by your
    * failure to do so.
    *
    *********************************************************************
    */
    #include <unistd.h>

    #include "logger.h"
    #include "sample_liveview.h"
    #include "global_value.h"
    #include "cloud_api/cloud_api.h"
    #include <string>
    #include <fstream>
    #include <iostream>


    using namespace edge_sdk;
    using namespace edge_app;
    using namespace std;

    ErrorCode ESDKInit();

    void CloudAPICustomSerivesMessageHandle(const uint8_t *data, uint32_t len) {
    INFO("cloud services message incoming: %s, len = %d", (char *) data, len);
    uavInfo = (char *) data;
    }

    bool isFileExists_fopen(string &name) {
    if (FILE *file = fopen(name.c_str(), "r")) {
    fclose(file);
    return true;
    } else {
    return false;
    }
    }


    int main(int argc, char **argv) {

    onnxMode = std::string(argv[4]);
    std::string scoreThreshold_str(argv[5]);
    if (onnxMode.empty()) {
    std::cout << "onnxMode para is null , exit" << std::endl;
    return -1;
    }

    onnxName = onnxMode;

    std::string path = "/root/esdk_deploy/onnx_model/";

    onnxMode = path + onnxMode + ".onnx";

    if (!isFileExists_fopen(onnxMode)) {
    std::cout << "onnxMode file is not Exist , exit" << std::endl;
    return -2;
    }

    std::string class_file_path = path + onnxName + ".txt";
    std::cout << "class_file_path=" << class_file_path << std::endl;
    if (!isFileExists_fopen(class_file_path)) {
    std::cout << "class file is not Exist , exit" << std::endl;
    return -3;
    }


    std::ifstream inputFile(class_file_path);
    if (inputFile.is_open()) {
    std::string classLine;
    while (std::getline(inputFile, classLine))
    class_names.push_back(classLine);
    inputFile.close();
    }

    std::cout << "class_names.size()=" << class_names.size() << std::endl;
    if (class_names.empty()) {
    std::cout << "class file content is null , exit" << std::endl;
    return -4;
    }

    if (scoreThreshold_str.empty()) {
    std::cout << "scoreThreshold para is null , exit" << std::endl;
    return -5;
    }


    scoreThreshold = std::stof(scoreThreshold_str);


    argc = 4;

    std::cout << ">>>>>>>>>>> " << argc << std::endl;
    std::cout << ">>>>>>>>>>> " << argv[0] << std::endl;
    std::cout << ">>>>>>>>>>> " << argv[1] << std::endl;
    std::cout << ">>>>>>>>>>> " << argv[2] << std::endl;
    std::cout << ">>>>>>>>>>> " << argv[3] << std::endl;
    std::cout << ">>>>>>>>>>>onnxMode= " << onnxMode << std::endl;
    std::cout << ">>>>>>>>>>>scoreThreshold= " << scoreThreshold << std::endl;


    auto rc = ESDKInit();
    if (rc != kOk) {
    ERROR("pre init failed");
    return -1;
    }


    rc = CloudAPI_RegisterCustomServicesMessageHandler(
    CloudAPICustomSerivesMessageHandle);
    if (rc != kOk) {
    ERROR("register custom services message handler failed");
    return -2;
    }

    int type = 0;
    while (argc < 3 || (type = atoi(argv[1])) > 2) {
    ERROR(
    "Usage: %s [CAMERA_TYPE] [QUALITY] [SOURCE] \nDESCRIPTION:\n "
    "CAMERA_TYPE: "
    "0-FPV. 1-Payload \n QUALITY: 1-540p. 2-720p. 3-720pHigh. "
    "4-1080p. 5-1080pHigh"
    "\n SOURCE: 1-wide 2-zoom 3-IR \n eg: \n %s 1 3 1",
    argv[0], argv[0]);
    sleep(1);
    }

    auto quality = atoi(argv[2]);

    const char type_to_str[2][16] = {"FPVCamera", "PayloadCamera"};

    // create liveview sample
    auto camera = std::string(type_to_str[type]);

    auto liveview_sample = std::make_shared<LiveviewSample>(std::string(camera));

    StreamDecoder::Options decoder_option = {.name = std::string("ffmpeg")};
    auto stream_decoder = CreateStreamDecoder(decoder_option);

    ImageProcessor::Options image_processor_option = {.name = std::string("yolovfastest"),
    .alias = camera, .userdata = liveview_sample};
    auto image_processor = CreateImageProcessor(image_processor_option);

    if (0 != InitLiveviewSample(
    liveview_sample, (Liveview::CameraType)type, (Liveview::StreamQuality)quality,
    stream_decoder, image_processor)) {
    ERROR("Init %s liveview sample failed", camera.c_str());
    } else {
    liveview_sample->Start();
    }

    if (argc == 4) {
    auto src = atoi(argv[3]);
    INFO("set camera soure: %d", src);
    liveview_sample->SetCameraSource((edge_sdk::Liveview::CameraSource)src);
    }

    while (1) sleep(3);

    return 0;
    }
    0
    评论操作 固定链接
  • DJI Developer Support
    示例代码是只初始化了一次。请按照以下步骤进行排查: 1、使用官网提供的smaple测试,检查sample能否成功运行。 2、检查局域网是否存在另外一个机场,如果存在另外一个机场,也会破坏建立的链路。
    0
    评论操作 固定链接
  • jackMa

    牛逼,确实是一个路由器上同时接了机场1和机场2,把机场2断掉就好了。。但是,边缘计算设备和机场的ip都是已经固定得了,为啥会发生这种情况。。。

    感谢提供解决思路!

    0
    评论操作 固定链接
  • jackMa

    现在又有个新问题。

    飞机开机-》运行esdk代码-》(代码运行完好 )-》飞机关机 -》(代码运行完好 )-》飞机开机-》(esdk进程自动退出)

    简短的说就是 飞机重启一次后,esdk进程自动退出。

     

    esdk 控制台日志:

    ```

    [250.364][security]-[Debug]-[PacketEncrypt:527) encrypt happy 
    [250.364][linker]-[Debug]-[DjiProtocol_v1Pack:119) V1-Send: 0xF6->0x02 0x4991 
    [250.517][linker]-[Debug]-[DjiProtocol_v1Pack:119) V1-Send: 0xF6->0x66 0x4990 
    [250.517][init]-[Debug]-[PushHeartbeat:114) sn: SN0000100010101
     
    [250.517][linker]-[Debug]-[DjiProtocol_v1Pack:119) V1-Send: 0xF6->0xA6 0x4990 
    [250.517][init]-[Debug]-[PushHeartbeat:114) sn: SN0000100010101
     
    [250.573][linker]-[Debug]-[DjiProtocol_v1Unpack:204) V1-Recv: 0xCD->0xF6 0x499A 
    [250.574][linker]-[Debug]-[DjiCommand_RecvWork:961) Receive msg from linker, id:0x499A len:272 
    [250.574][security]-[Debug]-[PacketDecrypt:491) decrypt happy 
    [250.574][link_adapter]-[Debug]-[RemoteRequestCommanHandler:146) data_len = 260 
    [250.574][liveview]-[Debug]-[LiveviewCapacityCallback:264) id: 1581F5BMD2328001SZF7/39-0-7/normal-0, capacity: 62, id: 1581F5BMD2328001SZF7/53-0-0/normal-0, capacity: 16 
    [250.574][user]-[Debug]-[LiveviewStatusCallback:96) status: 16 
    [250.580][linker]-[Debug]-[DjiProtocol_v1Unpack:204) V1-Recv: 0xCD->0xF6 0x499A 
    [250.581][linker]-[Debug]-[DjiCommand_RecvWork:961) Receive msg from linker, id:0x499A len:272 
    [250.581][security]-[Debug]-[PacketDecrypt:491) decrypt happy 
    [250.581][link_adapter]-[Debug]-[RemoteRequestCommanHandler:146) data_len = 260 
    [250.581][liveview]-[Debug]-[LiveviewCapacityCallback:264) id: 1581F5BMD2328001SZF7/39-0-7/normal-0, capacity: 62, id: 1581F5BMD2328001SZF7/53-0-0/normal-0, capacity: 16 
    [250.581][user]-[Debug]-[LiveviewStatusCallback:96) status: 16 
    [250.581][linker]-[Debug]-[DjiProtocol_v1Unpack:204) V1-Recv: 0xCD->0xF6 0x499A 
    [250.582][linker]-[Debug]-[DjiCommand_RecvWork:961) Receive msg from linker, id:0x499A len:272 
    [250.582][security]-[Debug]-[PacketDecrypt:491) decrypt happy 
    [250.582][link_adapter]-[Debug]-[RemoteRequestCommanHandler:146) data_len = 260 
    [250.582][liveview]-[Debug]-[LiveviewCapacityCallback:264) id: 1581F5BMD2328001SZF7/39-0-7/normal-0, capacity: 62, id: 1581F5BMD2328001SZF7/53-0-0/normal-0, capacity: 16 
    [250.582][user]-[Debug]-[LiveviewStatusCallback:96) status: 16 
    [250.685][utils]-[Debug]-[DjiCore_RootTask:131) work execution time: 
    [250.685][utils]-[Debug]-[DjiCore_RootTask:132) name                    execution time (ms)       max execution time (ms) 
    [250.685][utils]-[Debug]-[DjiCore_RootTask:134) commandTask                             1               21       
    [250.685][utils]-[Debug]-[DjiCore_RootTask:134) EsdkHeartbeatPushWork                   0               13       
    [250.918][linker]-[Debug]-[DjiProtocol_v1Unpack:204) V1-Recv: 0xCD->0xF6 0x499A 
    [250.919][linker]-[Debug]-[DjiCommand_RecvWork:961) Receive msg from linker, id:0x499A len:272 
    [250.919][security]-[Debug]-[PacketDecrypt:491) decrypt happy 
    [250.919][link_adapter]-[Debug]-[RemoteRequestCommanHandler:146) data_len = 260 
    [250.919][liveview]-[Debug]-[LiveviewCapacityCallback:264) id: 1581F5BMD2328001SZF7/39-0-7/normal-0, capacity: 62, id: 1581F5BMD2328001SZF7/53-0-0/normal-0, capacity: 16 
    [250.921][user]-[Debug]-[LiveviewStatusCallback:96) status: 16 

    ```

    journalctl -f -u 日志:

    ```

    May 09 11:09:49 nvidia-desktop your_script[1334144]: [h264 @ 0xaaaadb340050] top block unavailable for requested intra mode -1
    May 09 11:09:49 nvidia-desktop your_script[1334144]: [h264 @ 0xaaaadb340050] error while decoding MB 74 0, bytestream 249179

    ```

     

    0
    评论操作 固定链接
  • DJI Developer Support
    您好,您这个情况可以尝试重新初始化SDK,从日志上看您的通信已经断开了,拿不到设备的信息。
    0
    评论操作 固定链接

请先登录再写评论。