TCP packet sticking optimization method of specialized robot based on complex communication conditions
By classifying the data transmitted by special robots and designing the package header, and optimizing memory block operations with C++ interface functions, the problem of sticking the packet in TCP communication under complex conditions is solved, the security and computing efficiency of data transmission are improved, and the stability of robot control is ensured.
Patent Information
- Application Number
- CN202410576280.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2025-05-02
AI Technical Summary
In the special robot industry, TCP communication is prone to sticking packets under complex communication conditions, resulting in data parsing errors and robots out of control. The prior art has failed to effectively solve the problem of sticky packets, especially in terms of bandwidth transmission burden and header design.
By classifying the transmitted data, different transmission cycles of important and non-important information are set, and the data packet header is designed using special character segmentation method. The specific steps include using C++ interface functions to open up memory blocks, initialize memory blocks, receive TCP data, and parsing data through pointer offset and deep copy optimization.
It effectively reduces the possibility of sticking packets, improves the safety and reliability of data transmission, reduces deep copy operations, improves computing efficiency, and ensures the stability and security of robot control.
Smart Images

Figure CN119922247A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of data packet sticking optimization, and in particular to a TCP packet sticking optimization method for a special robot under complex communication conditions. Background Art
[0002] In the robotics industry, especially the special robotics industry, communication technology is particularly important. The usage scenarios of special robots are relatively complex. For example, when a forest firefighting robot is extinguishing a fire in the mountains, the communication may be interfered with due to the large number of obstructions such as shrubs. The pipeline robot is in the city's underground pipeline network, and the communication interference caused by urban electronic equipment is particularly serious. In addition to the communication interference outside the robot, the electromagnetic interference caused by the robot's own electronic devices to the communication equipment is also particularly serious.
[0003] If the communication data is not smooth, the robot may be out of control. TCP uses a three-way handshake, which is more reliable than UDP and is widely used in the special robot industry. When the communication equipment is seriously interfered, TCP will have a serious sticky packet phenomenon, which will lead to data parsing errors and cause the robot to lose control. The existing technology has the following defects:
[0004] 1. All information in the existing technology is set to a unified time period, which increases the bandwidth transmission burden;
[0005] 2. The existing solution for sticking packages does not focus on the design of the package header and the low efficiency of deep copying. Summary of the invention
[0006] Purpose of the invention: The purpose of the present invention is to provide a TCP packet sticking optimization method for a special robot under complex communication conditions, which can solve the problem of lost data operation and ensure the safe and stable control of the robot.
[0007] Technical solution: The TCP sticky packet optimization method of the special robot under complex communication conditions includes the following steps:
[0008] (1) Classify the transmitted data information into two categories: important information and non-important information;
[0009] (2) Set the transmission period of non-important information to 1 second and the transmission period of important information to 100 ms;
[0010] (3) Use special character segmentation to set the data packet header, specify a data protocol with higher security, and set the data packet header, i.e., the start bit, to 0XFFFF;
[0011] (4) Use the C++ interface memcpy function to open a 255-byte data memory block;
[0012] (5) Use the C++ interface memset function to initialize the memory block;
[0013] (6) Use the initialized memory block to receive the data received by TCP and record the length s of the existing data in the array;
[0014] (7) Determine whether the length s of the data stored in the memory block is greater than the length 8 of the command line;
[0015] (8) If the length s of the data stored in the existing memory block is less than the length 8 of the command line, then continue to receive data;
[0016] (9) If the length s of the data stored in the existing memory block is greater than the length 8 of the command line, the command line start bit is searched from the memory block bit by bit, and the command line size data is read from the start bit;
[0017] (10) Determine whether the size of the data stored in the memory block is greater than the command line length 8. If yes, repeat the steps starting from step (8). If no, proceed to the next step.
[0018] (11) The pointer is offset to determine whether the data is ended. If the result is yes, the data is ended. If the result is no, the steps are repeated starting from step (6).
[0019] Furthermore, the 255-byte data memory block is equal to the number of sticky packet data, thereby avoiding data loss and memory waste, and does not affect the efficiency and performance of the program.
[0020] Furthermore, the uniform initialization to 0 can avoid the system from randomly allocating data values in the memory, thereby avoiding affecting the data matching result.
[0021] Furthermore, the size of data stored in the memory block is s-8.
[0022] Furthermore, the memory block is a space for storing data in a computer system, and the array is a sequence of numerical values.
[0023] Compared with the prior art, the present invention has the following significant effects: 1. The present application adopts the method of classifying the transmission data, reducing the transmission period of non-important information and reducing the possibility of sticky packets;
[0024] 2. This application adopts a special character segmentation method and uses a specific packet header 0XFFFF (data that will not appear in the vehicle body information). Compared with the traditional packet header setting, it increases security and reliability. Then, in the segmented parsing method, a large block of memory is opened. Taking a single command line of 8 bytes as an example, 255 bytes of data memory are opened, and then the data stream is received. Then, the data header is searched bit by bit for the data group, and the stream is taken. Compared with the traditional stream taking method, the data after the stream is taken is moved and copied to the first position of the memory, and the pointer movement method is used to reduce deep copying and improve computing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a schematic diagram of the process of the present invention;
[0026] Figure 2 A diagram showing the judgment sequence of the present invention;
[0027] Figure 3 FIG2 is a second diagram of the judgment sequence of the present invention;
[0028] Figure 4 It is the pointer offset diagram of the present invention; DETAILED DESCRIPTION
[0029] The present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0030] The TCP sticky packet optimization method of special robots under complex communication conditions includes the following steps, refer to Figure 1 :
[0031] Step 1: Classify the transmitted data information into two categories: important information and non-important information.
[0032] Step 2: Set the transmission period of non-important information to 1 second and the transmission period of important information to 100 ms.
[0033] Step 3, use the special character segmentation method to set the data packet header, specify a data protocol with higher security, and set the data packet header, i.e., the start bit, to 0XFFFF.
[0034] Step 4, use the C++ interface memcpy function to allocate a 255-byte data memory block; the 255 quantization is summarized based on the actual situation. If the memory allocated to store data is too small and the number of sticky packets is too large, data will be lost; on the contrary, if the amount of data allocated is much larger than the number of sticky packets, it will cause memory waste, indirectly affecting the efficiency and performance of the program.
[0035] Step 5, use the C++ interface memset function to initialize the memory block; uniformly initialize it to 0. If the memory is not initialized, the system will randomly assign data values to the memory, which will affect the data matching results.
[0036] Step 6, use the initialized memory block to receive the data received by TCP, and record the length s of the existing data in the array.
[0037] Step 7, determine whether the length s of the data stored in the memory block is greater than the command line length 8.
[0038] Step 8: If the length s of the data stored in the existing memory block is less than the length 8 of the command line, then continue to receive data;
[0039] Step 9: If the length s of the data stored in the existing memory block is greater than the length 8 of the command line, the command line start bit is searched bit by bit in the memory block, and the command line size data is read from the start bit.
[0040] Step 10, determine whether the size s-8 of the memory block storing data is greater than the command line length 8. If the result is yes, repeat the steps starting from step 8. If the result is no, proceed to the next step.
[0041] Step 11, offset the pointer to determine whether the data is ended. If the result is yes, end the data. If the result is no, repeat the steps starting from step 6.
Claims
1. A TCP packet sticking optimization method for special robots under complex communication conditions, characterized in that: The following steps are involved: (1) Classify the transmitted data information into two categories: important information and non-important information; (2) Set the transmission period of non-important information to 1 second and the transmission period of important information to 100 ms; (3) Use special character segmentation to set the data packet header, specify a data protocol with higher security, and set the data packet header, i.e., the start bit, to 0XFFFF; (4) Use the C++ interface memcpy function to open a 255-byte data memory block; (5) Use the C++ interface memset function to initialize the memory block; (6) Use the initialized memory block to receive the data received by TCP and record the length s of the existing data in the array; (7) Determine whether the length s of the data stored in the memory block is greater than the length 8 of the command line; (8) If the length s of the data stored in the existing memory block is less than the length 8 of the command line, then continue to receive data; (9) If the length s of the data stored in the existing memory block is greater than the length 8 of the command line, the command line start bit is searched from the memory block bit by bit, and the command line size data is read from the start bit; (10) Determine whether the size of the data stored in the memory block is greater than the command line length 8. If yes, repeat the steps starting from step (8). If no, proceed to the next step. (11) The pointer is offset to determine whether the data is ended. If the result is yes, the data is ended. If the result is no, the steps are repeated starting from step (6).
2. The TCP packet sticking optimization method for special robots under complex communication conditions according to claim 1 is characterized in that: The 255-byte data memory block is equal to the number of sticky packet data, thereby avoiding data loss and memory waste and not affecting the efficiency and performance of the program.
3. The TCP packet sticking optimization method for special robots under complex communication conditions according to claim 1 is characterized in that: The uniform initialization to 0 can prevent the system from randomly allocating data values in the memory and thus avoid affecting the data matching results.
4. The TCP packet sticking optimization method for special robots under complex communication conditions according to claim 1 is characterized in that: The size of the data stored in the memory block is s-8.
5. The TCP packet sticking optimization method for special robots under complex communication conditions according to claim 1 is characterized in that: The memory block is a space for storing data in a computer system, and the array is a sequence of numerical values.