Any working code samples for PSDK using E-port on M350?
已完成I am new to the PSDK. I have the E-port development kit attached to the M350's E-port such that the cable's B side is up on the dev kit and the B side is facing outwards on the drone side, and its green light turns on. The E-port is recognized as /dev/ttyACM0 on my computer (generic Linux computer, not manifold2). I compiled the sample code at https://github.com/dji-sdk/Payload-SDK successfully after inputting my credentials and changing LINUX_UART_DEV1 to "/dev/ttyACM0" in hal_uart.h.
When I run the executable ./build/bin/dji_sdk_demo_linux or ./build/bin/dji_sdk_demo_linux, all I get is the following error over and over again:
[16.341][adapter]-[Info]-[DjiAccessAdapter_Init:170) Try identify UART0 connection failed. Probably because SDK adapter or aircraft not finish init or UART connect error.
I have tried different baud rates, tried setting the dev kit as host (but then my computer does not recognize it), and it never shows up in DJI Assistant 2 as a Payload SDK device.
I assume I need to be connecting to it in the software as a network device, not a UART, but I am completely new to the PSDK and I'm not sure how to do this.
Does anyone have any input, or a working code sample for the E-port development kit?
-
The M350 E-PORT port uses UART and USB to communicate with the onboard computer, and the UART only uses LINUX_UART_DEV1, which corresponds to the E-PORT TTL pin (TX/RX/GND). The USB drone as the host ( E-PORT board switch to host), and connects to the onboard computer(USB device), There are three ways,choose one of them: 1. Connect to the USB device port (or USB OTG) of the onboard computer, and use the USB BULK channel. 2. Connect to the USB device port (or USB OTG) of the onboard computer, and use the USB RNDIS channel. 3. The E-PORT is connected to the USB network card module, and then USB network card is connected to the network port of the on-board computer through a network cable. -
Do you have any code sample for this? I am trying to configure the code at https://github.com/dji-sdk/Payload-SDK to work in any of these 3 ways and it allows me to specify LINUX_UART_DEV1 and the network but that's all I am able to do.
Is there a way to configure the code at https://github.com/dji-sdk/Payload-SDK to work in the ways you have suggested? I am changing the macros in dji_sdk_config.h CONFIG_HARDWARE_CONNECTION but none of the options have changed anything (DJI_USE_ONLY_UART, DJI_USE_UART_AND_USB_BULK_DEVICE, DJI_USE_UART_AND_NETWORK_DEVICE). Do I need to have the e-port dev board connected to the computer with something else in addition to a USB cable?
-
DJI Developer Support Do you have some advice for the given error when running dji_sdk_demo_linux_cxx:
[0.000][core]-[Info]-[DjiCore_Init:101) Payload SDK Version : V3.5.0-beta.0-build.1765
[1.044][adapter]-[Info]-[DjiAccessAdapter_Init:186) Identify aircraft series is Matrice 350 Series
[1.044][adapter]-[Info]-[DjiAccessAdapter_Init:206) Identify mount position type is Extension Port Type
[1.050][adapter]-[Info]-[DjiAccessAdapter_Init:301) Identity uart0 baudrate is 921600 bps
[3.081][adapter]-[Info]-[DjiPayloadNegotiate_Init:197) Waiting payload negotiate finish.
[4.081][adapter]-[Info]-[DjiPayloadNegotiate_Init:197) Waiting payload negotiate finish.
[5.081][adapter]-[Info]-[DjiPayloadNegotiate_Init:197) Waiting payload negotiate finish.
[6.081][adapter]-[Info]-[DjiPayloadNegotiate_Init:197) Waiting payload negotiate finish.
[7.082][adapter]-[Info]-[DjiPayloadNegotiate_Init:197) Waiting payload negotiate finish.
[8.082][adapter]-[Error]-[DjiAccessAdapter_Init:312) Payload negotiate error, returnCode = 225
terminate called after throwing an instance of '[8.082][adapter]-[Error]-[DjiAccessAdapter_Init:318) Payload negotiate error, returnCode = 225
std::runtime_error[8.082][core]-[Error]-[DjiCore_Init:121) Access adapter init error, stat:225
'
what(): Core init error.
Aborted -
So I finally got the Flight Control (menu option "1") and the Gimbal control (menu option "a") working with the C++ sample app for a Matrice 350 using a E-port adapter kit and the PSDK development kit with a Raspberry Pi motherboard. I'll first share just the E-port adapter and its setup to get the Flight Control part of the sample app to work. After that on another message I'll share the combination of the E-port and the PSDK port (or called the Gimbal port) setup.
A few tips that I learned the hard way chasing down runtime errors that made no sense to me.
- Check that the adapter board connections (especially the USB-TTL's Gnd, Tx, Rx connectors) are secure and well connected, otherwise you will get weird errors during runtime.
- Also, keep all cables and the adapter board away from and not blocking any of the camera's and/or sensors all around the drone, otherwise that too can lead to weird errors of the aircraft not being able to fly.
- If you're house if anything like mine where I cannot get a clear RTK signal, turn of RTK, otherwise your drone will fail to take off.
Here is my E-port development kit setup and the changes that I made to get it to work.
Now for the setup descriptions:
- The E-port on the drone is connected to the adapter board as specified in the following DJI drone connection document,
- The adapter board is connected to the Raspberry Pi motherboard (RPi mobo) via 2 connections: (a) First connection: Adapter board USB-C to Ethernet adapter --> Ethernet cable to Raspberry Pi motherboard, (b) Second connection: The 3 pins on the adapter board labelled GND, TX, RX connected using a USB-TTL adapter (gnd-gnd, Rx-Tx, Tx-Rx) to the bottom USB port on the RPi mobo,
- The flight simulator is running on a Windows PC through the DJI Assistant 2 (Enterprise series) and the PC <-- USB-A - USB-C --> M350 USB-C port,
- The RC Plus controller is set to be in N-mode (there is no P-mode),
- The M350 has all of its arms extended and locked,
- Commented out all of the macros in the C++ dji_sdk_config.h file for: CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON, CONFIG_MODULE_SAMPLE_WIDGET_ON, CONFIG_MODULE_SAMPLE_WIDGET_SPEAKER_ON, CONFIG_MODULE_SAMPLE_POWER_MANAGEMENT_ON and CONFIG_MODULE_SAMPLE_DATA_TRANSMISSION_ON
- Commented out all of the macros in the sample_c dji_sdk_config.h file except: CONFIG_MODULE_SAMPLE_XPORT_ON and CONFIG_MODULE_SAMPLE_GIMBAL_EMU_ON
- Modified the dji_sdk_config.h in both the C/C++ samples to: #define CONFIG_HARDWARE_CONNECTION DJI_USE_ONLY_UART
- Modified the hal_network.h file as follows:
- Line 45: #define LINUX_NETWORK_DEV "eth0" // because my raspberry pi mobo has eth0 as its main network interface
- Line 55: #define USB_NET_ADAPTER_VID (0x0B95)
- Line 56: #define USB_NET_ADAPTER_PID (0x1790)
I have successfully run the build/bin/dji_sdk_demo_linux_cxx sample. I have tested menu option (0) and then menu option (1) for Flight Control with the 0, 1 and 4 sub menu options.
请先登录再写评论。
评论
9 条评论