Data Transmission
1. Overview
The payload device and the UAV use the data transmission module to transmit control commands between the PSDK and MSDK in a transparent transmission mode over the control command channel. Standard data and user-defined data can be transmitted transparently between PSDK and MSDK over the data transmission channel. The data transmission feature allows you to allocate bandwidth for different data types and monitor the status of multiple data channels.
Note:
- The data transmission module in PSDK transmits data transparently between payload devices, onboard computers, and UAVs. It supports users to design custom data transmission protocols based on actual use cases, allowing payload devices developed with PSDK to communicate with mobile apps or onboard computers in a more complex way.
2. Basic Concepts
Channel Classification
Based on the type of data transmitted and its function, the data transmission channels in PSDK can be divided into command signal transmission channels and high-speed data transmission channels:
- Command Signal Transmission Channel: Highly reliable, dedicated to transmitting signals that require high reliability, such as control commands and status information.
- Data Transmission Channel: Has a larger bandwidth and is primarily used for transmitting large amounts of data that require high real-time performance, such as radar signals and point cloud data.
Channel Bandwidth
- Channel Bandwidth: The amount of data that can be transmitted by the data channel under ideal conditions.
- Real-time Bandwidth: The theoretical amount of data that the data channel can transmit under operational conditions.
- Actual Bandwidth: The actual amount of data transmitted by the data channel.
Channel Bandwidth Limitations
The bandwidth limitation of the data transmission channel refers to the maximum amount of data (in bytes per second) that can be transmitted by the channel within a unit of time. Due to the physical characteristics of the interface components and the actual operating environment, both the command signal transmission channel and the data transmission channel are subject to static and dynamic bandwidth limitations.
Static Bandwidth Limitation
Static bandwidth limitation refers to the fixed bandwidth of the command signal transmission channel, which cannot be changed due to the physical and inherent electrical properties of the materials. For detailed parameters regarding static bandwidth limitations of the data transmission channels, please refer to the table below.
Channel Type | Transmission Direction | Static Bandwidth |
---|---|---|
Command Signal Transmission Channel | Mobile App -> Payload Device Payload Device -> Mobile App AICS -> Payload Device Payload Device -> AICS | 2048 B/s |
Data Transmission Channel | Payload Device -> Mobile App | 4 Mbps |
Dynamic Bandwidth Limitation
Dynamic bandwidth limitation refers to the variation in the maximum data transfer capacity of a data transmission channel caused by factors such as link status and electromagnetic environment. Therefore, the actual bandwidth of the data channel should be smaller than the real-time bandwidth.
Flow Control
- The payload device transmits data to the onboard computer or mobile app via the data channel.
- The PSDK data transmission module requires the user to transmit data according to the bandwidth feedback provided by the UAV. Any data exceeding this bandwidth may result in packet loss.
- The traffic threshold determines the maximum amount of data that can be transmitted through the current data transmission channel. This threshold is determined by factors such as static bandwidth limitation, dynamic bandwidth limitation, and the bandwidth occupation ratio of the channel.
3. Using the Data Transmission Function
To use the data transmission function in PSDK, you need to initialize the data transmission module after creating the project file and completing the PSDK initialization. Then, you can implement the data transmission function and monitor the status of the data channels.
Initializing the Data Transmission Module
Before using the data transmission function, you need to initialize the data transmission module with the following code to ensure the payload device can transmit data properly.
if(0 != UAV_LowSpeedDataChannel_Init()) {
printf("UAV_LowSpeedDataChannel_Init failed\n");
return -1;
}
Implementing Data Sending
The payload device developed with PSDK sends test data to the mobile app or onboard computer via the command signal transmission channel and the data transmission channel.
- Sending Control Commands to the Mobile App The payload device developed with PSDK sends control commands to the mobile app through the command signal transmission channel.
if(0 != UAV_LowSpeedDataChannel_SendData(UAV_CHANNEL_ADDRESS_MASTER_RC_APP, data_type, data, len)) {
printf("UAV_LowSpeedDataChannel_SendData failed\n");
return -1;
}
Note:
- data_type refers to the data type, which can also represent the business type; data refers to the data content; len refers to the data length. The mobile app receives the control commands sent by the payload device via the command signal transmission channel.
- Sending Data to AICS The payload device developed with PSDK sends commands to the Autel Integrated Command System through the command signal transmission channel.
if(0 != UAV_LowSpeedDataChannel_SendData(UAV_CHANNEL_ADDRESS_CLOUD_API, data_type, data, len)) {
printf("UAV_LowSpeedDataChannel_SendData failed\n");
return -1;
}
- Sending Bulk Data to the Mobile App The payload device developed with PSDK sends data to the mobile app through the data transmission channel.
if(0 != UAV_HighSpeedDataChannel_SendDataStreamData(data_type, data, len)) {
printf("UAV_HighSpeedDataChannel_SendDataStreamData failed\n");
return -1;
}
Implementing Data Reception
After constructing and registering the data reception function, the payload device developed with PSDK can receive control commands sent from the mobile device and AICS via the command signal transmission channel.
Constructing the Callback Function
static void UAV_LowSpeedDataChannel_RecvDataCallback(E_UAVChannelID channel, uint8_t data_type, uint8_t *data, uint32_t len)
{
if(UAV_CHANNEL_ADDRESS_MASTER_RC_APP == channel) {
switch(data_type) {
case UAV_DATA_TYPE_CONTROL_CMD:
// Handle control commands
break;
default:
break;
}
} else if(UAV_CHANNEL_ADDRESS_CLOUD_API == channel) {
switch(data_type) {
case UAV_DATA_TYPE_COMMAND:
// Handle commands
break;
default:
break;
}
}
}
Register the Callback Function
if(0 != UAV_LowSpeedDataChannel_RegRecvDataCallback(UAV_CHANNEL_ADDRESS_MASTER_RC_APP, UAV_LowSpeedDataChannel_RecvDataCallback)) {
printf("UAVLowSpeedDataChannel_RegisterRecvDataCallback failed\n");
return -1;
}
if(0 != UAV_LowSpeedDataChannel_RegRecvDataCallback(UAV_CHANNEL_ADDRESS_CLOUD_API, UAV_LowSpeedDataChannel_RecvDataCallback)) {
printf("UAVLowSpeedDataChannel_RegisterRecvDataCallback failed\n");
return -1;
}
// Alternatively, all can be registered at once
if(0 != UAV_LowSpeedDataChannel_RegRecvDataCallback(UAV_CHANNEL_ADDRESS_EVERY, UAV_LowSpeedDataChannel_RecvDataCallback)) {
printf("UAVLowSpeedDataChannel_RegisterRecvDataCallback failed\n");
return -1;
}