Data decoding method and system for unmanned aerial vehicle air-ground communication
By employing multi-threaded asynchronous processing and data receiving queue splicing technology, the problem of data latency in UAV ground-to-air communication was solved, achieving efficient data decoding and integrity assurance, thus ensuring the normal operation of the UAV telemetry and control system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-28
- Publication Date
- 2026-03-31
AI Technical Summary
There is a serious data delay problem in UAV ground-to-air communication. The existing single-threaded frame-by-frame decoding method cannot process newly arriving data in time under high-frequency communication, resulting in serious data delay.
A multi-threaded asynchronous data decoding method is adopted. The basic parsing thread extracts complete data frames and stores the incomplete parts into the data receiving queue. The first-in-first-out characteristic of the data receiving queue is used to splice the data frames together, and the data frames that are not outdated are decoded.
It improved the decoding efficiency of UAV ground-to-air communication, ensured the integrity and real-time nature of data, reduced data loss caused by unpacking or repacking, and guaranteed the normal operation of telemetry and control work.
Smart Images

Figure CN121239296B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of communications, and more particularly to a data decoding method and system for UAV ground-to-air communication. Background Technology
[0002] UAV air-to-ground communication, that is, the data interaction between the UAV flight control computer and the ground telemetry and control software, has the following characteristics:
[0003] The flight control computer of a drone needs to monitor a large amount of data, which means that the ground control software takes a long time to decode the data each time.
[0004] The monitoring and control of UAV flight control computers require extremely high real-time performance, which means that the ground control software receives data at a high frequency and needs to process the latest data messages in real time.
[0005] During the air-to-ground communication process of drones, they are frequently affected by external factors such as electromagnetic environment and air-to-ground distance, resulting in excessively high frequency of unpacking or repacking.
[0006] In existing technologies, UAV ground-to-air communication scenarios adopt a single-threaded frame-by-frame decoding method. That is, after receiving a frame of data, a regular decoding process is performed, and after decoding is completed, the next frame of data is processed, and so on. This method can solve the problem of packet splitting or packet merging due to network latency. However, when the UAV communication frequency is high, there is a defect that the data decoding time is too long to process the newly arrived data in time, resulting in serious data delay. Summary of the Invention
[0007] This invention addresses the significant data delays in current UAV ground-to-air communication by providing a data decoding method and system for UAV ground-to-air communication that can improve decoding efficiency.
[0008] To solve the above-mentioned technical problems, the present invention provides the following technical solution:
[0009] In a first aspect, the present invention proposes a data decoding method for UAV air-to-ground communication, used to receive and decode communication data transmitted by the UAV, comprising the following steps:
[0010] Capture data packets from the target communication interface and extract the corresponding byte data, generate the corresponding byte array and temporarily store it in the data set;
[0011] When a byte array is detected in the data set, a corresponding basic parsing thread is created for each byte array based on the time order.
[0012] The basic parsing thread extracts the first data frame from the corresponding byte array and stores the part of the byte array that is not the first data frame as bytes to be concatenated into the data receiving queue. The first data frame is a complete data frame. If there is a complete data frame in the byte array, the data frame is used as the first data frame. If there is no complete data frame in the byte array, all bytes in the byte array are used as bytes to be concatenated.
[0013] When the first data frame is obtained, the first data frame is decoded;
[0014] The bytes in the data receiving queue are identified and spliced byte by byte to obtain the corresponding second data frame. That is, all bytes to be spliced obtained by the basic parsing thread are placed in the data receiving queue for splicing and identification, and the complete data frame obtained by splicing and identification is used as the second data frame.
[0015] When the second data frame is obtained, an outdated check is performed on the second data frame;
[0016] If it is determined that the second data frame has not expired, the second data frame is decoded.
[0017] In this embodiment, the captured byte array is processed asynchronously by multiple threads to solve the timeliness problem of high-frequency data processing in UAV ground-to-air communication. At the same time, the incomplete data frame parts in each byte array are spliced together, and the spliced second data frame that is not outdated is decoded to increase the amount of effective data and ensure the normal operation of telemetry and control.
[0018] As one possible implementation method, the parsing steps performed by the basic parsing thread are as follows:
[0019] Perform synchronization header identification byte by byte on the corresponding byte array; when the corresponding byte is identified as a synchronization header:
[0020] Based on the bytes, information identification is performed to obtain the length information of the corresponding data frame;
[0021] Based on the length information, determine whether the data frame in the byte array is complete. If so, extract the data frame as the first data frame based on the length information and use the remaining bytes as the bytes to be concatenated. If not, use all bytes in the byte array as the bytes to be concatenated.
[0022] As one possible implementation method:
[0023] When the first data frame is obtained, the current frame sequence number is updated based on the frame sequence number corresponding to the first data frame;
[0024] When the second data frame is received:
[0025] Compare the current frame number with the frame number corresponding to the second data frame;
[0026] When the frame number corresponding to the second data frame is greater than the current frame number, it is determined that the second data frame has not expired. At this time, the current frame number is updated based on the frame number corresponding to the second data frame.
[0027] When the frame number corresponding to the second data frame is less than the current frame number, the second data frame is determined to be outdated, and the second data frame is recorded in the log.
[0028] This application optimizes the utilization of computing resources by performing an outdated determination on the spliced second data frame before decoding.
[0029] As one possible implementation method, the specific steps for identifying and concatenating bytes in the data receiving queue byte by byte to obtain the corresponding second data frame are as follows:
[0030] When there are bytes of data in the data receiving queue, they are retrieved byte by byte, and it is determined whether the currently retrieved byte is a synchronization header.
[0031] When the retrieved byte is identified as a synchronization header, the byte is stored in the cleared array to be concatenated;
[0032] When the asynchronous header of the extracted bytes is identified, a splicing judgment is performed;
[0033] If the array to be concatenated is empty, it is determined that no concatenation will be performed, and the bytes are discarded.
[0034] If there is an array to be concatenated, it is determined to concatenate. At this time, the bytes are stored in the array to be concatenated, and it is determined whether the array to be concatenated forms a complete data frame. When the array to be concatenated forms a complete data frame, all bytes in the array to be concatenated are retrieved to generate the corresponding second data frame.
[0035] This application utilizes multi-threaded asynchronous parsing of the byte array obtained from packet capture, along with the first-in-first-out characteristic of the data receiving queue, to effectively arrange scattered bytes, restore and decode data that has been split or reassembled as much as possible, and retain historical records for outdated data frames.
[0036] As one possible implementation, the first data frame or the second data frame to be decoded is taken as the target data frame, the target data frame is verified, and the target data frame that passes the verification is decoded.
[0037] Secondly, the present invention provides a data decoding system for UAV ground-to-air communication, used to receive and decode communication data transmitted by the UAV, including:
[0038] The capture module is used to capture data packets from the target communication interface, extract the corresponding byte data, generate the corresponding byte array, and temporarily store it in the data set;
[0039] The basic parsing module is used to create corresponding basic parsing threads for each byte array based on time order when a byte array is detected in the data set; it is also used to extract the first data frame in the corresponding byte array based on the basic parsing thread, and store the part of the byte array that is not the first data frame as bytes to be concatenated into the data receiving queue.
[0040] A special parsing module is used to identify and concatenate bytes in the data receiving queue byte by byte to obtain the corresponding second data frame;
[0041] The obsolescence determination module is used to determine whether the second data frame is obsolete when the second data frame is obtained;
[0042] The decoding module is used to decode the first data frame when the first data frame is obtained; it is also used to decode the second data frame that is determined to be not outdated.
[0043] As one possible implementation, the basic parsing thread is configured as follows:
[0044] Perform synchronization header identification on a byte-by-byte basis for the corresponding byte array. When the corresponding byte is identified as a synchronization header:
[0045] Based on the bytes, information identification is performed to obtain the length information of the corresponding data frame;
[0046] Based on the length information, determine whether the data frame in the byte array is complete. If so, extract the data frame as the first data frame based on the length information and use the remaining bytes as the bytes to be concatenated. If not, use all bytes in the byte array as the bytes to be concatenated.
[0047] As one possible implementation, the outdated determination module includes:
[0048] The update unit is used to update the current frame sequence number based on the frame sequence number corresponding to the first data frame when the first data frame is obtained; it is also used to update the current frame sequence number based on the frame sequence number corresponding to the second data frame that has not expired.
[0049] The judgment unit is used to compare the current frame number and the frame number corresponding to the second data frame when the second data frame is obtained. If the frame number corresponding to the second data frame is greater than the current frame number, the second data frame is determined to be not outdated. If the frame number corresponding to the second data frame is less than the current frame number, the second data frame is determined to be outdated, and the second data frame is recorded based on the log.
[0050] As one possible implementation method, the special parsing module includes:
[0051] The listening unit is used to retrieve data byte by byte when there is byte data in the data receiving queue.
[0052] Create a new unit:
[0053] Used to determine whether the currently retrieved byte is a synchronization header;
[0054] It is also used to store the extracted byte into a cleared array to be concatenated when the extracted byte is identified as a synchronization header;
[0055] It is also used to make a splicing judgment when identifying the asynchronous header of the extracted bytes; if the array to be spliced is empty, it is determined not to splice, and the bytes are discarded; if there is an array to be spliced, it is determined to splice, and the bytes are stored in the array to be spliced.
[0056] The verification unit is used to determine whether the array to be concatenated forms a complete data frame after the bytes are stored in the array to be concatenated. When the array to be concatenated forms a complete data frame, all bytes in the array to be concatenated are extracted to generate the corresponding second data frame.
[0057] As one possible implementation, the decoding module is used to take the first data frame or the second data frame to be decoded as the target data frame, verify the target data frame, and decode the target data frame that passes the verification.
[0058] This invention, by adopting the above technical solutions, has significant technical effects:
[0059] This invention can balance decoding efficiency and data integrity in UAV air-to-ground communication.
[0060] The objectives and other advantages of this invention can be realized and obtained from the description, claims and drawings. Attached Figure Description
[0061] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0062] Figure 1 This is a schematic diagram illustrating the workflow of a data decoding method for UAV ground-to-air communication according to the present invention.
[0063] Figure 2 This is a schematic diagram illustrating a data decoding method for UAV ground-to-air communication.
[0064] Figure 3 This is a schematic diagram of the module connections for a data decoding method for UAV ground-to-air communication according to the present invention. Detailed Implementation
[0065] The present invention will be further described in detail below with reference to the embodiments. The following embodiments are explanations of the present invention, but the present invention is not limited to the following embodiments.
[0066] Explanation of technical terms:
[0067] Packet merging occurs when multiple data packets are combined together, resulting in the receiver receiving multiple data packets at once.
[0068] Unpacking: A complete data packet is split into multiple parts, and the receiver needs to receive it multiple times to obtain the complete data packet.
[0069] Thread: The smallest unit of computation that the operating system can schedule;
[0070] Multithreaded asynchronous: Multiple tasks can be performed simultaneously and independently;
[0071] Communication interface: This manual specifically refers to the software-level communication interface, that is, the communication interface corresponding to the ground measurement and control software. This manual only covers serial ports and network ports for this communication interface.
[0072] Queue: A linear data structure that can be understood as a data container that follows the first-in, first-out principle, meaning that data stored first will be read first.
[0073] Data frame: A protocol data unit at the data link layer, which is the smallest unit of each information transmission and exchange;
[0074] Synchronization header: The header of each data frame, used to determine the start position of the data frame;
[0075] Length information: The data frames described in this specification have a length prefix, that is, a length field is added to the header of the data packet to indicate the length of the data packet. During the receiving process, the length field is read first to determine the length information of the data frame before reading the data of the specified length.
[0076] Currently, UAV air-to-ground communication generally uses a single-threaded frame-by-frame decoding method. In practical applications, while the ground control software is decoding a certain data frame, the flight control computer may continuously send out a large amount of data, causing data backlog and resulting in severe delays.
[0077] A common method to improve decoding efficiency is to use multi-threaded parallel decoding, which involves multiple threads simultaneously capturing data packets and decoding them independently within their respective threads. This approach can improve data processing speed at high communication frequencies, but because it cannot handle packet splitting or packet merging, the relevant data will be directly discarded. In UAV air-to-ground communication scenarios, packet splitting and merging occur frequently, leading to a significant loss of valid data and making it difficult to ensure reliable measurement and control of UAVs. Therefore, even though single-threaded frame-by-frame decoding has severe latency, those skilled in the art do not consider multi-threaded parallel decoding of communication data transmitted by UAVs.
[0078] Reference Figure 1 This application provides a data decoding method that can balance decoding efficiency and data integrity in UAV air-to-ground communication. The specific steps are as follows:
[0079] S100: Capture data packets from the target communication interface and extract the corresponding byte data, generate the corresponding byte array and temporarily store it in the data set;
[0080] In practical applications, after establishing air-to-ground communication, a data set is created to temporarily store the data captured in each serial packet capture in the communication interface. The data set stores data in units of arrays (byte[]), that is, all bytes in the captured data packets are combined into corresponding byte arrays and temporarily stored in the data set.
[0081] S200: Multi-threaded asynchronous extraction of complete data frames from each byte array as the first data frame, and storage of incomplete data frame portions as bytes to be concatenated into the data receiving queue.
[0082] The specific steps are as follows:
[0083] S210. When a byte array is detected in the data set, a corresponding basic parsing thread is created for each byte array based on the time order.
[0084] Reference Figure 1 , Figure 1 The dashed lines represent different basic parsing threads;
[0085] In this embodiment, a loop judgment step is set to create corresponding basic parsing threads for each byte array based on time order. Specifically:
[0086] Iterate through the data set to determine if a byte array exists.
[0087] When a byte array is detected in the data set, a thread creation step is triggered, that is, a new thread is created, and the earliest stored byte array is retrieved from the data set in chronological order. The newly created thread is used as the basic parsing thread corresponding to the retrieved byte array, thus completing the loop judgment of the current round.
[0088] If no byte array is detected in the data set, the current round of loop judgment is directly determined to be complete, and the next round of loop judgment is entered.
[0089] Since the communication frequency between the UAV ground and air communication is set, the byte array of each packet captured and stored in the data set has a timestamp that can reflect its order. In this embodiment, the basic parsing thread is triggered, and the timestamps of the parallel start of each basic parsing thread also have an order. In practical applications, those skilled in the art can also set the cycle interval of the loop judgment according to actual needs. This specification does not limit it in detail.
[0090] In this embodiment, a basic parsing thread corresponding to each byte array is established in a triggered manner. While parsing each byte array separately to improve decoding efficiency, the timing characteristics between byte arrays are preserved to facilitate the subsequent concatenation of bytes to be concatenated.
[0091] S220. Based on the basic parsing thread, the first data frame in the corresponding byte array is intercepted, and the part of the byte array that is not the first data frame is stored in the data receiving queue as the bytes to be concatenated.
[0092] That is, the basic parsing thread identifies the complete data frame in the corresponding byte array to obtain the first data frame and / or the bytes to be concatenated;
[0093] When there is no packet splitting or packet merging, the byte array is a complete data frame, and the byte array is used as the first data frame.
[0094] When packet splitting or packet merging occurs, and the byte array contains a complete data frame, the data frame is extracted as the first data frame, and the remaining bytes are used as bytes to be concatenated.
[0095] When packet splitting or packet merging occurs, and the byte array does not contain a complete data frame, each byte in each byte array is treated as a byte to be concatenated.
[0096] In this embodiment, the specific steps for the basic parsing thread to retrieve the corresponding byte array from the array collection and parse the byte array are as follows:
[0097] S221. Perform synchronization header identification on a byte-by-byte basis for the corresponding byte array;
[0098] S222. When the corresponding asynchronous header is identified, the byte is taken as the byte to be concatenated.
[0099] S223. When the corresponding byte is identified as a synchronization header, the bytes after the synchronization header are parsed to obtain the first data frame and / or the bytes to be concatenated.
[0100] In this embodiment, information is first identified based on the bytes to obtain the length information of the corresponding data frame; then, based on the length information, it is determined whether the data frame in the byte array is complete. If so, the data frame is truncated based on the length information as the first data frame, and the remaining bytes are used as bytes to be concatenated; otherwise, each byte in the byte array is used as a byte to be concatenated.
[0101] Identifying the synchronization header and length information is a prior art technique and will not be described in detail in this specification.
[0102] S224. Send the bytes to be concatenated to the data receiving queue, which will then store them byte by byte.
[0103] As one possible implementation, the identified bytes to be concatenated are sent to the data receiving queue byte by byte. Specifically, the data receiving queue is locked based on the timestamp (creation time) corresponding to the basic parsing thread. For the basic parsing thread that has acquired the lock, the identified bytes to be concatenated are sent to the data receiving queue byte by byte until all bytes to be concatenated in the corresponding byte array have been sent. The lock is then released for use by the next basic parsing thread.
[0104] This scheme locks the data receiving queue based on the creation order of the basic parsing threads, thereby ensuring the orderly storage of bytes to be concatenated.
[0105] The above solution requires frequent locking and unlocking. Based on this drawback, another feasible solution is proposed: after the basic parsing thread completes the parsing of the corresponding byte array, it packages all the bytes to be concatenated and sends them to the data receiving queue, which stores them byte by byte. This solution, based on the time difference between the basic parsing threads and the first-in-first-out characteristic of the data receiving queue, can achieve the ordered arrangement of the bytes to be concatenated without locking.
[0106] This embodiment employs a multi-threaded asynchronous processing of byte arrays and a design that stores the bytes to be concatenated in a data receiving queue. By improving decoding efficiency through multi-threaded asynchronous processing, it cleverly utilizes the first-in-first-out characteristic of the data receiving queue, allowing any excess bytes to be concatenated from each byte array to be concatenated through the data receiving queue. This avoids situations where too little valid data is obtained, which could affect normal measurement and control.
[0107] S300: Identify and concatenate the bytes in the data receiving queue byte by byte to obtain the corresponding second data frame;
[0108] In this embodiment, a separate processing thread retrieves bytes from the data receiving queue byte by byte, and then identifies and concatenates them.
[0109] In this embodiment, all bytes to be concatenated obtained by the basic parsing thread are stored in the same data receiving queue. At this time, the bytes in the data receiving queue are arranged in order. The corresponding second data frame can be obtained by identifying and extracting the complete data frame in the data receiving queue.
[0110] In this embodiment, the specific steps for identifying and concatenating bytes in the data receiving queue byte by byte to obtain the corresponding second data frame are as follows:
[0111] S310. When there are byte data in the data receiving queue, retrieve them byte by byte and determine whether the currently retrieved byte is a synchronization header.
[0112] S320. When the extracted byte is identified as a synchronization header, the byte is stored in the cleared array to be concatenated.
[0113] When the retrieved bytes are identified as a synchronization header, there are two possibilities;
[0114] One scenario is when there are no data frames to be spliced, and the array to be spliced is empty. In this case, bytes can be directly stored into the array to be spliced to splice the corresponding data frames.
[0115] Another scenario is that there is currently data to be spliced. In this case, the array to be spliced is not empty. When the synchronization header of a new data frame is detected, it can be determined that the data frame to be spliced is incomplete. Therefore, the array to be spliced is cleared and the byte corresponding to the synchronization header is stored to update the data frame to be spliced.
[0116] S330. When the asynchronous header of the extracted bytes is identified, a splicing judgment is performed.
[0117] S340. If the array to be concatenated is empty, it is determined that no concatenation will be performed, and the bytes are discarded.
[0118] That is, when the array to be concatenated is empty, the bytes are discarded;
[0119] S350. If there is an array to be concatenated, it is determined to concatenate. At this time, the bytes are stored in the array to be concatenated, and it is determined whether the array to be concatenated forms a complete data frame. When the array to be concatenated forms a complete data frame, all bytes in the array to be concatenated are taken out to generate the corresponding second data frame.
[0120] That is, if the array to be concatenated is not empty, it means that this byte is a byte of the current data frame to be concatenated, and the byte is stored in the array to be concatenated;
[0121] In this embodiment, after each byte is stored in the array to be concatenated, it is determined whether the concatenation is complete based on the corresponding length information. When it is determined that the concatenation is complete, the bytes are retrieved from the array to be concatenated, thereby clearing the array to be concatenated and obtaining the second data frame.
[0122] This embodiment, through the design of the data receiving queue and the array to be concatenated, can concatenate the bytes to be concatenated output by each basic parsing thread and extract data frames, ensuring the amount of valid data obtained in the final decoding.
[0123] S400: When the second data frame is obtained, the second data frame is judged to be outdated;
[0124] The second data frame obtained by splicing based on the data receiving queue has a certain lag. In order to save computing resources and ensure timeliness, this embodiment performs an expiration judgment on the second data frame after obtaining it. If the second data frame is not expired, the decoding process is entered. If the second data frame is expired, only data log recording is performed to facilitate subsequent data tracking and review.
[0125] The specific steps for determining timeout in this embodiment are as follows:
[0126] When the first data frame is obtained, the current frame sequence number is updated based on the frame sequence number corresponding to the first data frame;
[0127] When the second data frame is received:
[0128] Compare the current frame number with the frame number corresponding to the second data frame;
[0129] When the frame number corresponding to the second data frame is greater than the current frame number, it is determined that the second data frame has not expired. At this time, the current frame number is updated based on the frame number corresponding to the second data frame.
[0130] When the frame sequence number corresponding to the second data frame is less than the current frame sequence number, the second data frame is determined to be outdated, and the second data frame is recorded in the log.
[0131] The identification of frame sequence numbers of data frames is prior art and will not be described in detail in this specification. Those skilled in the art can set the timing of frame sequence number identification according to actual needs. For example, the frame sequence number can be identified and recorded at the same time as the length information is identified during the corresponding parsing process, or the frame sequence number can be identified separately after the complete data frame is obtained. This specification does not limit it in detail.
[0132] S500: Decode the obtained first data frame and the second data frame that has not expired;
[0133] In this embodiment, the first data frame or the second data frame to be decoded is taken as the target data frame, the target data frame is verified, and the target data frame that passes the verification is decoded.
[0134] Verification of data frames is an existing technology, so it will not be described in detail in this specification.
[0135] Because UAV air-to-ground communication scenarios have high timeliness requirements, and verifying data frames requires complex calculations based on all bytes of the data frame, it takes a certain amount of processing time. The frame sequence number, located in the basic information bytes following the synchronization header, allows for faster judgment. Furthermore, compared to the first data frame, the second data frame is more prone to becoming outdated and containing errors. This embodiment first determines whether the second data frame is outdated based on its frame sequence number. If it is outdated, no verification or decoding is required, thus optimizing both timeliness and computational resources.
[0136] The following detailed explanation of the data decoding method disclosed in this application is provided through a specific case. In this case, the basic parsing thread sends all parsed bytes to be concatenated together to the data receiving queue. A separate processing thread then retrieves the bytes to be concatenated byte by byte from the data receiving queue for identification and concatenation. (Refer to...) Figure 2 The specific process is as follows:
[0137] A1. Based on the basic parsing thread, extract and parse the byte array obtained from the Ath packet capture, and obtain the first data frame corresponding to frame sequence number Seq=4, as well as the tail part of the data frame corresponding to Seq=3 and the head part of the data frame corresponding to Seq=5, which are to be concatenated.
[0138] A2. Update the current frame number based on frame number Seq=4, and decode the data of the first data frame corresponding to frame number Seq=4;
[0139] In this case, all bytes to be concatenated in the byte array are sent to the data receiving queue for processing. Therefore, the first data frame received by the basic parsing thread must not be outdated, and the current frame sequence number can be updated and decoded directly.
[0140] A3. Store the tail portion of the data frame corresponding to Seq=3 and the header portion of the data frame corresponding to Seq=5 into the data receiving queue.
[0141] In existing multi-threaded parallel technologies, the tail portion of the data frame corresponding to frame sequence number Seq=5 will be executed in another thread and cannot be reassembled. It is usually filtered and discarded. This case, however, is designed for communication scenarios where packets are frequently split or reassembled. The remaining bytes are inserted into the data receiving queue for temporary storage and reuse, thereby increasing the amount of valid data obtained and ensuring the normal operation of the system.
[0142] B. Based on the basic parsing thread, the byte array obtained from the Bth packet capture is retrieved and parsed. No complete data frame is identified. All bytes are stored as bytes to be concatenated in the data receiving queue. That is, the tail part of the data frame corresponding to frame number Seq=5 and the head part of frame number Seq=6 are stored in the data receiving queue.
[0143] C1. Based on the basic parsing thread, extract and parse the byte array obtained from the Cth packet capture, output the first data frame corresponding to frame sequence number Seq=7, as well as the tail part of the data frame corresponding to frame sequence number Seq=6 and the head part of data frame sequence number Seq=8, which are the bytes to be concatenated.
[0144] C2. Update the current frame sequence number based on frame sequence number Seq=7, and decode the data of the first data frame corresponding to frame sequence number Seq=7;
[0145] C3. Store the bytes to be concatenated corresponding to the tail portion of the data frame with frame sequence number Seq=6 and the header portion of the data frame with frame sequence number Seq=8 as bytes to be concatenated into the data receiving queue.
[0146] D. The data receiving queue always performs byte-by-byte concatenation and identification of the data in the queue;
[0147] D1. Receive and store the tail portion of the data frame corresponding to the frame sequence number Seq=3, which is sent as the byte to be concatenated, and the header portion of the data frame corresponding to the data frame sequence number Seq=5.
[0148] In this case, the synchronization header corresponding to frame sequence number Seq=3 was not detected at the beginning, and the array to be concatenated was empty at this time. After the tail part of frame sequence number Seq=3 entered the data receiving queue, this part of the data was identified and discarded byte by byte until the synchronization header corresponding to frame sequence number Seq=5 was identified. The synchronization header and subsequent bytes were stored in the array to be concatenated, and the corresponding length information and frame sequence number were obtained.
[0149] D2. Receive and store the bytes to be concatenated corresponding to the tail portion of the frame sequence number Seq=5 sent in step B, and the bytes to be concatenated corresponding to the head portion of the data frame sequence number Seq=6.
[0150] If the data receiving queue has already processed all bytes in the queue before receiving the bytes to be concatenated sent in step B, the array to be concatenated has not reached the corresponding length. Concatenation will continue after data enters the data receiving queue.
[0151] If the bytes to be concatenated sent in step B are received, and there are still bytes in the data receiving queue that have not been retrieved, then the newly received bytes to be concatenated are inserted into the tail of the queue to wait for concatenation.
[0152] Until the length of the array to be concatenated meets the length information obtained from parsing, the data in the array to be concatenated is taken out as the second data frame, and an outdated judgment is made based on the previously identified frame sequence number Seq=5, so it is verified and decoded.
[0153] Continue to identify the synchronization header for the remaining bytes in the queue until the synchronization header corresponding to frame sequence number Seq=6 is identified, and then put it into the previously cleared concatenation array for concatenation.
[0154] D3. Receive and store the bytes to be concatenated corresponding to the tail portion of the frame sequence number Seq=6 sent in step C3, and the bytes to be concatenated corresponding to the head portion of the data frame sequence number Seq=8.
[0155] The update step for the current frame number is completed in the main thread;
[0156] The basic processing thread parses the byte array obtained from the Cth packet capture to obtain the complete first data frame (Seq=7) and several bytes to be concatenated;
[0157] The first data frame (Seq=7) will switch from the basic processing thread to the main thread to write the frame sequence number and perform data frame verification and decoding.
[0158] Each byte to be concatenated will be stored in the data receiving queue byte by byte. At this time, a separate processing thread will retrieve the bytes to be concatenated from the data receiving queue and put them into the concatenation array at the same time the bytes to be concatenated are stored, until the current data frame is completely concatenated or a new synchronization header is detected.
[0159] Compared to switching from the basic processing thread to the main thread, switching from a separate processing thread to the main thread takes less time. Furthermore, the separate processing thread asynchronously and in parallel retrieves bytes from the data receiving queue for concatenation. Therefore, in practical applications, the first data frame (Seq=7) captured by the basic parsing thread and the second data frame (Seq=6) concatenated by the separate processing thread are written to the frame sequence number almost simultaneously. That is, at time M, both Seq=7 and Seq=6 may be written first. If Seq=6 is written first, a verification and decoding step is performed on the second data frame. If Seq=7 is written first, the second data frame corresponding to Seq=6 is outdated. This data frame is stored as historical data and marked as outdated in the log, providing data support for subsequent UAV retrospective analysis.
[0160] If a byte-by-byte insertion into the data receiving queue is adopted, the splicing of the corresponding second data frame can be further accelerated. Those skilled in the art can choose a suitable byte-to-be-sent scheme according to actual needs.
[0161] In summary, this design addresses network scenarios where packets are frequently split or reassembled. Through a data receiving queue, it performs secondary decoding of split or reassembled data on a multi-threaded parallel basis. Utilizing the time difference between each frame in UAV air-to-ground communication and the frame sequence number (Seq) of each data frame, combined with the first-in-first-out (FIFO) characteristic of the data receiving queue, it effectively arranges scattered bytes, restoring and decoding split or reassembled data as much as possible. Simultaneously, it retains historical records for outdated data frames, improving decoding efficiency while ensuring the normal execution of ground telemetry and control tasks.
[0162] This application also proposes an implementation method for a data decoding system for UAV ground-to-air communication, used to receive and decode communication data transmitted by the UAV, referring to... Figure 3 ,include:
[0163] The capture module 100 is used to capture data packets from the target communication interface, extract the corresponding byte data, generate the corresponding byte array, and temporarily store it in the data set;
[0164] The basic parsing module 200 is used to create corresponding basic parsing threads for each byte array based on time order when a byte array is detected in the data set, extract the first data frame in the corresponding byte array based on the basic parsing thread, and store the part of the byte array that is not the first data frame as bytes to be concatenated into the data receiving queue.
[0165] A special parsing module 300 is used to identify and concatenate bytes in the data receiving queue byte by byte to obtain the corresponding second data frame;
[0166] The timeout determination module 400 is used to determine the timeout of the second data frame when the second data frame is obtained;
[0167] The decoding module 500 is used to decode the first data frame when the first data frame is obtained; it is also used to decode the second data frame that is determined to be not outdated.
[0168] Specifically, the basic parsing thread is configured as follows:
[0169] Perform synchronization header identification on a byte-by-byte basis for the corresponding byte array;
[0170] When the corresponding byte is identified as a synchronization header:
[0171] Based on the bytes, information identification is performed to obtain the length information of the corresponding data frame;
[0172] Based on the length information, determine whether the data frame in the byte array is complete. If so, extract the data frame as the first data frame based on the length information and use the remaining bytes as the bytes to be concatenated. If not, use all bytes in the byte array as the bytes to be concatenated.
[0173] Specifically, the timeout determination module 400 includes:
[0174] The update unit is used to update the current frame sequence number based on the frame sequence number corresponding to the first data frame when the first data frame is obtained; it is also used to update the current frame sequence number based on the frame sequence number corresponding to the second data frame that has not expired.
[0175] The judgment unit is used to compare the current frame number and the frame number corresponding to the second data frame when the second data frame is obtained. If the frame number corresponding to the second data frame is greater than the current frame number, the second data frame is determined to be not outdated. If the frame number corresponding to the second data frame is less than the current frame number, the second data frame is determined to be outdated, and the second data frame is recorded based on the log.
[0176] Specifically, the special parsing module 300 includes:
[0177] The listening unit is used to retrieve data byte by byte when there is byte data in the data receiving queue.
[0178] Create a new unit:
[0179] Used to determine whether the currently retrieved byte is a synchronization header;
[0180] It is also used to store the extracted byte into a cleared array to be concatenated when the extracted byte is identified as a synchronization header;
[0181] It is also used to make a splicing judgment when identifying the asynchronous header of the extracted bytes; if the array to be spliced is empty, it is determined not to splice, and the bytes are discarded; if there is an array to be spliced, it is determined to splice, and the bytes are stored in the array to be spliced.
[0182] The verification unit is used to determine whether the array to be concatenated forms a complete data frame after the bytes are stored in the array to be concatenated. When the array to be concatenated forms a complete data frame, all bytes in the array to be concatenated are extracted to generate the corresponding second data frame.
[0183] Specifically, the decoding module 500 is used to take the first data frame or the second data frame to be decoded as the target data frame, verify the target data frame, and decode the target data frame that passes the verification.
[0184] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.
[0185] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0186] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0187] This invention is described with reference to flowchart illustrations and / or block diagrams of the method, terminal device (system), and computer program product according to the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0188] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0189] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0190] It should be noted that:
[0191] The phrase "an embodiment" or "an embodiment" used in this specification means that a particular feature, structure, or characteristic described in connection with the embodiment is included in at least one embodiment of the invention. Therefore, the phrase "an embodiment" or "an embodiment" appearing in various places throughout the specification does not necessarily refer to the same embodiment.
[0192] Although preferred embodiments of the invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the invention.
[0193] Furthermore, it should be noted that the shapes and names of the parts and components described in the specific embodiments described in this specification may differ. All equivalent or simple variations made to the structure, features, and principles described in this patent concept are included within the protection scope of this patent. Those skilled in the art to which this invention pertains may make various modifications or additions to the described specific embodiments or use similar methods to replace them, as long as they do not depart from the structure of this invention or exceed the scope defined in these claims, they should all fall within the protection scope of this invention.
Claims
1. A method for decoding data of UAV air-ground communication, for receiving and decoding communication data transmitted by a UAV, characterized in that, The method comprises the following steps: grabbing data packets from a target communication interface and extracting corresponding byte data, generating a corresponding byte array and temporarily storing it in a data set; when detecting that there is a byte array in the data set, creating a corresponding basic parsing thread for each byte array based on time sequence; intercepting a first data frame in the corresponding byte array based on the basic parsing thread, and storing the part of the byte array that is not the first data frame as a byte to be spliced in a data receiving queue with a first-in-first-out characteristic; when the first data frame is obtained, decoding the first data frame; identifying and splicing the bytes based on the data receiving queue byte by byte to obtain a corresponding second data frame; when the second data frame is obtained, performing timeliness judgment on the second data frame; if it is determined that the second data frame is not outdated, decoding the second data frame; The specific steps of identifying and splicing the bytes based on the data receiving queue byte by byte to obtain a corresponding second data frame are as follows: when there is byte data in the data receiving queue, take out the byte by byte and judge whether the current taken byte is a synchronization header; when it is identified that the taken byte is a synchronization header, store the byte in the empty to-be-spliced array; if the taken byte is not a synchronization header, perform splicing judgment; if the to-be-spliced array is empty, it is determined not to splice, at which time the byte is discarded; if there is a to-be-spliced array, it is determined to splice, at which time the byte is stored in the to-be-spliced array, and it is judged whether the to-be-spliced array forms a complete data frame; when the to-be-spliced array forms a complete data frame, take out all the bytes in the to-be-spliced array to generate a corresponding second data frame. 2.The method of claim 1, wherein, The parsing steps performed by the basic parsing thread are as follows: identifying the synchronization header of the corresponding byte array byte by byte; when it is identified that the corresponding byte is a synchronization header: identifying information based on the byte to obtain length information of the corresponding data frame; based on the length information, judging whether the data frame in the byte array is complete; if yes, intercepting the data frame as a first data frame based on the length information, and storing the remaining bytes as to-be-spliced bytes; if no, storing all the bytes in the byte array as to-be-spliced bytes. 3.The method of claim 1, wherein: When the first data frame is obtained, update the current frame number based on the frame number corresponding to the first data frame; when the second data frame is obtained: compare the current frame number with the frame number corresponding to the second data frame; when the frame number corresponding to the second data frame is greater than the current frame number, it is determined that the second data frame is not outdated, at which time the current frame number is updated based on the frame number corresponding to the second data frame; when the frame number corresponding to the second data frame is less than the current frame number, it is determined that the second data frame is outdated, at which time the second data frame is recorded in the log.
4. The data decoding method for UAV air-ground communication according to any one of claims 1 to 3, characterized in that, The first data frame or the second data frame to be decoded is taken as a target data frame, the target data frame is verified, and the target data frame that passes the verification is decoded. 5.A data decoding system for unmanned aerial vehicle (UAV) air-ground communication, configured to receive and decode communication data transmitted by a UAV, characterized in that, It comprises: a grabbing module for grabbing data packets from a target communication interface and extracting corresponding byte data, generating a corresponding byte array and temporarily storing it in a data set; The basic analysis module is configured to create a corresponding basic analysis thread for each byte array based on time sequence when it is detected that the byte array exists in the data set; The special analysis module is configured to identify and splice the bytes in the data receiving queue based on the bytes byte by byte to obtain a corresponding second data frame; the out-of-date judgment module is configured to perform out-of-date judgment on the second data frame when the second data frame is obtained; and the decoding module is configured to decode the first data frame when the first data frame is obtained. The special analysis module is configured to identify and splice the bytes in the data receiving queue based on the bytes byte by byte to obtain a corresponding second data frame; the out-of-date judgment module is configured to perform out-of-date judgment on the second data frame when the second data frame is obtained; and the decoding module is configured to decode the first data frame when the first data frame is obtained. The special analysis module is configured to identify and splice the bytes in the data receiving queue based on the bytes byte by byte to obtain a corresponding second data frame; the out-of-date judgment module is configured to perform out-of-date judgment on the second data frame when the second data frame is obtained; and the decoding module is configured to decode the first data frame when the first data frame is obtained. The special analysis module includes a listening unit configured to take out the bytes byte by byte when there are byte data in the data receiving queue; a new unit configured to determine whether the currently taken byte is a synchronization header; and a verification unit configured to determine whether the taken byte is a synchronization header when the taken byte is a synchronization header, and store the byte in an empty splicing array; and determine whether to splice when the taken byte is not a synchronization header; if the splicing array is empty, it is determined not to splice, and the byte is discarded; if there is a splicing array, it is determined to splice, and the byte is stored in the splicing array; and determine whether the splicing array forms a complete data frame after the byte is stored in the splicing array, and generate a corresponding second data frame by taking out all the bytes in the splicing array when the splicing array forms a complete data frame. The basic analysis thread is configured to identify the synchronization header of the corresponding byte array byte by byte, and when the corresponding byte is identified as a synchronization header, perform information identification based on the byte to obtain length information of the corresponding data frame; 6. The data decoding system for UAV air-ground communication according to claim 5, wherein, based on the length information, determine whether the data frame in the byte array is complete, if yes, intercept the data frame as a first data frame based on the length information, and the remaining bytes as splicing bytes, and if not, all the bytes in the byte array as splicing bytes. The out-of-date judgment module includes an update unit configured to update the current frame number based on the frame number corresponding to the first data frame when the first data frame is obtained; and update the current frame number based on the frame number corresponding to the second data frame that is not out-of-date; and a judgment unit configured to compare the current frame number with the frame number corresponding to the second data frame when the second data frame is obtained, and determine that the second data frame is not out-of-date when the frame number corresponding to the second data frame is greater than the current frame number; and determine that the second data frame is out-of-date when the frame number corresponding to the second data frame is less than the current frame number, and record the second data frame based on the log.
7. The data decoding system for UAV air-ground communication according to claim 5, wherein, The decoding module is configured to take the first data frame or the second data frame to be decoded as a target data frame, perform verification on the target data frame, and decode the target data frame that passes the verification.
8. The data decoding system for UAV air-ground communication according to any one of claims 5 to 7, characterized in that,
Citation Information
Patent Citations
IPv6 (Internet Protocol Version 6) message fragmentation recombination method based on multi-thread interaction processing
CN112653639A
Multi-unmanned aerial vehicle streaming media shunting and converging system and method
CN117544604A