DJI Onboard SDK到Mobile SDK的通信-DJI示例不起作用。 (Matrice 600- Raspberry Pi3-iOS)

时间:2019-06-19 10:34:19

标签: ios raspberry-pi dji-sdk drone

我想从带有移动SDK的移动设备向运行该板上SDK的无人机(矩阵600)上的车载计算机(Raspberry Pi 3)发送命令。因此,我正在尝试使DJI的示例工作。我遵循了指南(https://developer.dji.com/onboard-sdk/documentation/guides/component-guide-mobile-communication.html)和链接(https://developer.dji.com/onboard-sdk/documentation/sample-doc/msdk-comm.html)。我将https://github.com/dji-sdk/Onboard-SDK/tree/3.8/sample/linux/mobile中的代码用于板载SDK和iOS示例https://github.com/dji-sdk/Mobile-OSDK-iOS-App

移动应用程序正在说它正在发送命令,但机载程序无法识别任何命令,并且日志未显示任何错误。

除了我在变量中放入的API密钥外,我没有对代码进行任何更改。表示该产品已被注册。另外,由于我尝试过的所有其他示例都在工作,因此无人机与覆盆子之间的UART连接似乎正常。此外,由于其他应用程序(例如DJI-Go)还可以向无人机发送命令,然后执行该命令,因此移动设备与无人机之间的连接正常。

我正在使用DJI助手Windows程序上的模拟器。

我觉得问题已经出在应用程序中,因为我尝试登录代码的不同部分,并且似乎应该执行的代码未执行。我没有开发iOS应用程序,所以我真的不知道到底发生了什么,但也许您可以帮帮我。

例如,此处的代码未执行。这是否意味着他没有完成“发送”? 来自“ Mobile-OSDK-iOS-App / MOS / Network / MOSProductCommunicationManager.m”

[fc sendDataToOnboardSDKDevice:data withCompletion:^(NSError * _Nullable error) {
        if (error) {
            // Handle error locally
        } else {
            NSString *key = [self commandIDStringKeyFromData:data];

            [self.sentCmds setObject:ackBlock forKey:key];
        }
        completion(error);
    }];

在日志中也没有其他类似以下的日志: 来自“ Mobile-OSDK-iOS-App / MOS / ViewController / MOSJSONDynamicController.m”

[self.appDelegate.model addLog:[NSString stringWithFormat:@"Sending CmdID %@ with %ld Arguments", cmdId, (unsigned long)arguments.count]];
        weakCell.commandResultLabel.text = @"Sending...";
        [self.appDelegate.productCommunicationManager sendData:data
                                                withCompletion:^(NSError * _Nullable error) {
                                                    [self.appDelegate.model addLog:[NSString stringWithFormat:@"Sent CmdID %@", cmdId]];
                                                    weakCell.commandResultLabel.text = @"Command Sent!";
                                                }
                                                   andAckBlock:^(NSData * _Nonnull data, NSError * _Nullable error) {

                                                       NSData *ackData = [data subdataWithRange:NSMakeRange(2, [data length] - 2)];
                                                       uint16_t ackValue;
                                                       [ackData getBytes:&ackValue length:sizeof(uint16_t)];

                                                       NSString *responseMessage = [NSString stringWithFormat:@"Ack: %u", ackValue];
                                                       [self.appDelegate.model addLog:[NSString stringWithFormat:@"Received ACK [%@] for CmdID %@", responseMessage, cmdId]];

                                                       weakCell.commandResultLabel.text = responseMessage;
                                                   }];

以下是日志的屏幕截图: enter image description here

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:0)

我发现iOS-Sample-App存储库的标准(主)分支是旧版本3.1,该版本无法正常工作。由于没有相关文档,因此我使用了该文档,因为在签出不同的分支之前,我不知道存在其他版本。

最后,版本3.3最适合我。 这是最新分支/版本(3.4)的链接:https://github.com/dji-sdk/Mobile-OSDK-iOS-App/tree/3.4