DJI Onboard SDK 到 Mobile SDK 通信 - DJI 示例不工作。 (矩阵 600- Raspberry Pi3 - iOS)
DJI Onboard SDK to Mobile SDK communication - DJI sample not working. (Matrice 600- Raspberry Pi3 - iOS)
我想从带有移动 SDK 的移动设备向无人机 (Matrice 600) 上的机载计算机 (Raspberry Pi 3) 运行 机载 SDK 发送命令。因此,我试图让 DJI 的样本工作。我按照指南 (https://developer.dji.com/onboard-sdk/documentation/guides/component-guide-mobile-communication.html) and the link (https://developer.dji.com/onboard-sdk/documentation/sample-doc/msdk-comm.html). I used the code from https://github.com/dji-sdk/Onboard-SDK/tree/3.8/sample/linux/mobile for onboard-SDK and the iOS sample https://github.com/dji-sdk/Mobile-OSDK-iOS-App.
移动应用程序说它正在发送命令,但机载程序无法识别任何命令,日志也没有显示任何错误。
除了我放入变量中的 API 键外,我没有对代码进行任何更改。它说该产品已正确注册。此外,无人机和树莓派之间的 UART 连接似乎很好,因为我尝试过的所有其他示例都在工作。此外,移动设备和无人机之间的连接正常,因为 DJI-Go 等其他应用程序能够向无人机发送命令,然后执行这些命令。
我在大疆助手Windows程序上使用模拟器。
我感觉问题已经出在应用程序中了,因为我尝试在代码的不同部分进行登录,似乎应该执行的代码没有执行。我没有开发 iOS 应用程序,所以我真的不知道到底发生了什么,但也许你可以帮助我。
例如这里的代码没有执行。这是否意味着他没有完成 "Sending"?
来自 "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;
}];
日志截图如下:
我发现 iOS-Sample-App 存储库的标准(主)分支是旧版本 3.1,它不起作用。由于没有这方面的文档,我使用了这个,因为在检查不同的分支之前我不知道存在其他版本。
最后,3.3 版最适合我。
这是 link 到最新的 branch/version (3.4):https://github.com/dji-sdk/Mobile-OSDK-iOS-App/tree/3.4
我想从带有移动 SDK 的移动设备向无人机 (Matrice 600) 上的机载计算机 (Raspberry Pi 3) 运行 机载 SDK 发送命令。因此,我试图让 DJI 的样本工作。我按照指南 (https://developer.dji.com/onboard-sdk/documentation/guides/component-guide-mobile-communication.html) and the link (https://developer.dji.com/onboard-sdk/documentation/sample-doc/msdk-comm.html). I used the code from https://github.com/dji-sdk/Onboard-SDK/tree/3.8/sample/linux/mobile for onboard-SDK and the iOS sample https://github.com/dji-sdk/Mobile-OSDK-iOS-App.
移动应用程序说它正在发送命令,但机载程序无法识别任何命令,日志也没有显示任何错误。
除了我放入变量中的 API 键外,我没有对代码进行任何更改。它说该产品已正确注册。此外,无人机和树莓派之间的 UART 连接似乎很好,因为我尝试过的所有其他示例都在工作。此外,移动设备和无人机之间的连接正常,因为 DJI-Go 等其他应用程序能够向无人机发送命令,然后执行这些命令。
我在大疆助手Windows程序上使用模拟器。
我感觉问题已经出在应用程序中了,因为我尝试在代码的不同部分进行登录,似乎应该执行的代码没有执行。我没有开发 iOS 应用程序,所以我真的不知道到底发生了什么,但也许你可以帮助我。
例如这里的代码没有执行。这是否意味着他没有完成 "Sending"? 来自 "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;
}];
日志截图如下:
我发现 iOS-Sample-App 存储库的标准(主)分支是旧版本 3.1,它不起作用。由于没有这方面的文档,我使用了这个,因为在检查不同的分支之前我不知道存在其他版本。
最后,3.3 版最适合我。 这是 link 到最新的 branch/version (3.4):https://github.com/dji-sdk/Mobile-OSDK-iOS-App/tree/3.4