Data transmission methods, apparatus, electronic devices and computer-readable storage media

CN116055571BActive Publication Date: 2026-04-03CHENGDU CRP ROBOT TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-29
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

In the field of industrial robot communication control, reliable and efficient network communication between devices is difficult to achieve, and expanding communication functions requires extensive code modifications, which leads to longer project cycles and difficulty in controlling progress.

Method used

Communication data packets in binary format include command words, packet length, control words, and structured variable-length areas. Data is transmitted via Transmission Control Protocol or User Datagram Protocol, and the transmission mode is adjusted according to packet length and priority, simplifying the extension process.

Benefits of technology

It improved data transmission efficiency, simplified the expansion process, and enhanced user experience and project schedule control.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116055571B_ABST
    Figure CN116055571B_ABST
Patent Text Reader

Abstract

This invention provides a data transmission method, apparatus, electronic device, and computer-readable storage medium. The communication data command packet is in binary format and includes: a command word, a packet length, a control word, and a structured variable-length area; both the command word and the packet length are 32-bit binary integers; the command word includes control instructions; the method includes: determining the transmission protocol in the command word of the communication data command packet; sending the communication data command packet to a peripheral device based on a Transmission Control Protocol (TCP) or User Datagram Protocol (UDP); or, receiving the communication data command packet sent by the peripheral device based on TCP or UDP; improving transmission efficiency by selecting a transmission protocol; using binary format for data transmission, resulting in high transmission efficiency; dividing the communication data packet into multiple functional areas, simplifying the expansion process; and identifying each communication data command packet through a command word, improving scalability and user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of communication control technology, and in particular to a data transmission method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] In the field of industrial robot communication control, achieving reliable and efficient network communication between devices has always been a major challenge for equipment manufacturers. At the same time, when there are new communication function requirements, it is often found that it is difficult to expand. In the process of expansion, a lot of code between robots and devices is often modified, which prolongs the project cycle and makes it difficult to control the project progress. Summary of the Invention

[0003] In view of this, the purpose of the present invention is to provide a data transmission method, apparatus, electronic device, and computer-readable storage medium that improves transmission efficiency by selecting a transmission protocol, converts communication data packets into binary format, divides communication data packets into multiple functional areas, simplifies the expansion process, improves scalability, and enhances user experience.

[0004] In a first aspect, embodiments of the present invention provide a data transmission method, wherein the communication data command packet is in binary format and includes: a command word, a packet length, a control word, and a structured variable-length area; both the command word and the packet length are 32-bit binary integers; the command word includes control instructions; the packet length is used to characterize the length of the communication data command packet; the data transmission method includes: determining the transmission protocol in the command word of the communication data command packet; wherein the transmission protocol includes: a transmission control protocol or a user data packet protocol; sending the communication data command packet to a peripheral device based on the transmission control protocol or the user data packet protocol; or, receiving the communication data command packet sent by the peripheral device based on the transmission control protocol or the user data packet protocol.

[0005] In a preferred embodiment of the present invention, the data transmission method further includes: if the transmission protocol is User Datagram Protocol, determining whether the packet length is greater than a preset threshold; if the packet length is greater than the preset threshold, setting the transmission protocol of the communication data command packet to Transmission Control Protocol.

[0006] In a preferred embodiment of the present invention, the control word is a 32-bit binary integer; the control word includes a 2-bit priority indicator bit, which is used to characterize the priority of the communication data command packet; the data transmission method further includes: determining the priority of the communication data command packet; and sending multiple communication data command packets to the peripheral device in order of priority.

[0007] In a preferred embodiment of the present invention, the control word further includes: a wait flag bit of length 1 and a wait time bit of length 16; the wait flag bit is used to indicate whether the subsequent communication data command packet sent is based on the return flag of the receiving end; the wait time bit is used to indicate the preset time length for waiting to receive the return flag; the data transmission method further includes: determining whether the subsequent communication data command packet sent is based on the return flag of the receiving end based on the wait flag bit; if so, determining the time length for waiting to receive the return flag based on the wait time bit.

[0008] In a preferred embodiment of the present invention, after the step of determining the time length for waiting to receive the return flag based on the waiting time bit, the data transmission method further includes: responding to receiving the return flag within the time length by sending a subsequent communication data command packet; and if no return flag is received within the time length, sending a subsequent communication data command packet after the time length has ended.

[0009] In a preferred embodiment of the present invention, the structured variable-length region includes: a plurality of instruction words; wherein, the instruction word includes: a floating-point number with a length of 32 bits.

[0010] Secondly, embodiments of the present invention provide a data transmission apparatus. The communication data command packet is in binary format and includes: a command word, a packet length, a control word, and a structured variable-length area; both the command word and the packet length are 32-bit binary integers; the command word includes control instructions; the packet length is used to characterize the length of the communication data command packet; the data transmission apparatus includes: a transmission protocol determination module, used to determine the transmission protocol in the command word of the communication data command packet; wherein the transmission protocol includes: a transmission control protocol or a user data packet protocol; and a communication module, used to send the communication data command packet to a peripheral device based on the transmission control protocol or the user data packet protocol.

[0011] In a preferred embodiment of the present invention, the data transmission device further includes: a packet length determination module, configured to determine whether the packet length is greater than a preset threshold if the transmission protocol is User Datagram Protocol; and a transmission protocol modification module, configured to set the transmission protocol of the communication data command packet to Transmission Control Protocol if the packet length is greater than the preset threshold.

[0012] Thirdly, embodiments of the present invention provide an electronic device, including a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement any of the above-described data transmission methods.

[0013] Fourthly, embodiments of the present invention provide a computer-readable storage medium storing computer-executable instructions. When the computer-executable instructions are invoked and executed by a processor, the computer-executable instructions cause the processor to implement any of the above-mentioned data transmission methods.

[0014] The embodiments of the present invention bring the following beneficial effects:

[0015] This invention provides a data transmission method, apparatus, electronic device, and computer-readable storage medium. The communication data command packet is in binary format and includes: a command word, a packet length, a control word, and a structured variable-length area. Both the command word and the packet length are 32-bit binary integers. The command word includes control instructions. The packet length characterizes the length of the communication data command packet. The data transmission method includes: determining the transmission protocol in the command word of the communication data command packet; wherein the transmission protocol includes: a Transmission Control Protocol (TCP) or a User Datagram Protocol (UDP); sending the communication data command packet to a peripheral device based on the TCP or UDP, or receiving the communication data command packet sent by the peripheral device based on the TCP or UDP. By selecting a transmission protocol, transmission efficiency is improved. The communication data packet uses a binary format for data transmission, resulting in high transmission efficiency. Dividing the communication data packet into multiple functional areas simplifies the expansion process. Identifying each communication data command packet through a command word improves scalability and enhances the user experience. Attached Figure Description

[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0017] Figure 1 A flowchart of a data transmission method provided in an embodiment of the present invention;

[0018] Figure 2 A flowchart of another data transmission method provided in an embodiment of the present invention;

[0019] Figure 3 A schematic diagram of a data transmission device provided in an embodiment of the present invention;

[0020] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention.

[0021] Icons: 100-Memory; 101-Processor; 102-Bus; 103-Communication Interface; 310-Transmission Protocol Determination Module; 320-Communication Module. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. The components of the embodiments of the present invention described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0023] Therefore, the following detailed description of the embodiments of the invention provided in the accompanying drawings is not intended to limit the scope of the claimed invention, but merely to illustrate selected embodiments of the invention. All other embodiments obtained by those skilled in the art based on the embodiments of the invention without inventive effort are within the scope of protection of the invention.

[0024] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0025] In the description of this invention, it should be noted that the terms "center," "upper," "lower," "left," "right," "vertical," "horizontal," "inner," and "outer," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings, or the orientation or positional relationship commonly used when the product of this invention is in use. They are only for the convenience of describing this invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific orientation, or be constructed and operated in a specific orientation, and therefore should not be construed as a limitation of this invention. In addition, the terms "first," "second," "third," etc., are only used to distinguish descriptions and should not be construed as indicating or implying relative importance.

[0026] Furthermore, terms such as "horizontal," "vertical," and "sag" do not imply that components must be absolutely horizontal or suspended, but rather that they can be slightly tilted. For example, "horizontal" simply means that its direction is more horizontal relative to "vertical," and does not mean that the structure must be completely horizontal, but can be slightly tilted.

[0027] In the description of this invention, it should also be noted that, unless otherwise explicitly specified and limited, the terms "set," "install," "connect," and "link" should be interpreted broadly. For example, they can refer to a fixed connection, a detachable connection, or an integral connection; they can refer to a mechanical connection or an electrical connection; they can refer to a direct connection or an indirect connection through an intermediate medium; and they can refer to the internal connection of two components. Those skilled in the art can understand the specific meaning of the above terms in this invention based on the specific circumstances.

[0028] The following detailed description of some embodiments of the present invention is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0029] Currently, in the field of industrial robot communication control, achieving reliable and efficient network communication between devices has always been a major challenge for equipment manufacturers. At the same time, when there are new communication function requirements, it is often found that it is difficult to expand. In the process of expansion, a lot of code between robots and devices is often modified, which prolongs the project cycle and makes it difficult to control the project progress.

[0030] Based on this, embodiments of the present invention provide a data transmission method, apparatus, electronic device, and computer-readable storage medium, which are described below through embodiments.

[0031] Example 1

[0032] This invention provides a data transmission method in which the communication data command packet used for communication is in binary format. The communication data command packet includes: a command word, a packet length, a control word, and a structured variable-length area; both the command word and the packet length are 32-bit binary integers; the command word includes control instructions; and the packet length is used to characterize the length of the communication data command packet.

[0033] Specifically, the data command packet header format definition is shown in Table 1.

[0034]

[0035] Table 1

[0036] All control commands and data transmission instructions are numbered, with a fixed length of 4 bytes. The command word 0 is a unique 32-bit binary integer. For example, during robot operation, the command word 00000001 0000000100000001 00000001 can represent the robot moving forward, and the command word 00000001 00000001 0000000100000010 can represent the robot turning left. It should be emphasized that in the 32-bit binary integer, 16 bits typically represent the robot control instruction, 8 bits represent the data storage format of the structured variable-length area within the communication data command packet, and 8 bits are used to represent the transmission method. Of course, the allocation of the 32-bit binary integer can be adjusted according to actual production. By defining the 32-bit command word method, each data packet is identified, improving the scalability of data transmission between the robot and the equipment.

[0037] Each control command and data transmission instruction has 4 bytes to indicate the overall length of the data packet. The packet length L represents the length of the data packet with all fields. For example, counting from the first character of the command word to the last character of the structured variable-length area, if there are 1500 characters, the packet length can be represented as 00000000 0000000000000101 11011100. The control word C is used to characterize the priority of the communication data command packet and whether it is necessary to wait for the return flag before continuing to send subsequent communication data command packets. The structured variable-length area contains additional descriptive information for the data packet, used to describe information such as the robot's posture, and can also be used for subsequent communication extensions. Compared with string transmission, binary transmission greatly reduces the number of bytes transmitted and improves transmission efficiency.

[0038] See Figure 1 The flowchart shown in this embodiment of the invention provides a data transmission method, which includes the following steps:

[0039] Step S102: Determine the transmission protocol in the command word of the communication data command packet; wherein, the transmission protocol includes: Transmission Control Protocol or User Datagram Protocol;

[0040] Specifically, before communication begins, one party agrees to save a list of command words for data packets that need to be transmitted via UDP (User Datagram Protocol). The two parties establish a connection via TCP (Transmission Control Protocol) and determine whether the communication data command packet uses TCP (Transmission Control Protocol) or UDP (User Datagram Protocol) based on the command words in the communication data command packet.

[0041] Furthermore, once a connection is established, the party storing the UDP command word list sends the entire UDP command word list to the other party using the aforementioned protocol. The receiving party stores the received UDP command word list and begins listening on the UDP port. The Transmission Control Protocol (TCP) is a connection-oriented, reliable, byte-stream-based transport layer communication protocol. The User Datagram Protocol (UDP) provides an application with a method to send encapsulated IP packets without establishing a connection.

[0042] Furthermore, a character can be defined in the command word to indicate the transmission method of the communication data command packet. For example, the first bit can be defined as the protocol bit. When the first bit of the command word is 1, it means that the communication data command packet is sent using TCP. When the first bit of the command word is 0, it means that the communication data command packet is sent using UDP. For data packets that require high-speed sending and response, transmission through the UDP channel can be configured.

[0043] Step S104: Send a communication data command packet to a peripheral device based on the Transmission Control Protocol or User Datagram Protocol; or receive a communication data command packet sent by a peripheral device based on the Transmission Control Protocol or User Datagram Protocol.

[0044] Specifically, after determining the transmission protocol, the communication data command packet is sent to the peripheral device according to the transmission protocol identified in the command word; or, the communication data command packet sent by the peripheral device is received based on the Transmission Control Protocol or User Datagram Protocol; a hybrid transmission of TCP and UDP is adopted, and data that requires fast response is transmitted through UDP to improve the response speed between the robot and the device.

[0045] Furthermore, when one party transmits a data packet to the other, it first checks whether the command word of the data packet is in the UDP command word list. If it is in the command word list, the data packet is sent to the other party through the UDP channel; otherwise, the data packet is sent to the other party through the TCP channel. Using the above method, only one party sends the UDP command word list to the other party through the TCP channel before establishing communication, without having to set a flag bit before each communication, which simplifies the programming logic of the calling end and facilitates protocol expansion.

[0046] This invention provides a data transmission method. The communication data command packet is in binary format and includes: a command word, a packet length, a control word, and a structured variable-length area. Both the command word and the packet length are 32-bit binary integers. The command word includes control instructions. The packet length characterizes the length of the communication data command packet. The data transmission method includes: determining the transmission protocol in the command word of the communication data command packet; wherein the transmission protocol includes: a Transmission Control Protocol (TCP) or a User Datagram Protocol (UDP); sending the communication data command packet to a peripheral device based on the TCP or UDP, or receiving the communication data command packet sent by the peripheral device based on the TCP or UDP; improving transmission efficiency by selecting a transmission protocol; using binary format for data transmission, resulting in high transmission efficiency; dividing the communication data packet into multiple functional areas, simplifying the expansion process; and identifying each communication data command packet through a command word, improving scalability and user experience.

[0047] Example 2

[0048] Based on the above embodiments, this invention provides another data transmission method, see [link to previous embodiment]. Figure 2 The flowchart shown in this embodiment of the invention illustrates another data transmission method, which includes:

[0049] Step S202: Determine the transmission protocol in the command word of the communication data command packet; wherein, the transmission protocol includes: Transmission Control Protocol or User Datagram Protocol;

[0050] Step S204: If the transmission protocol is the User Datagram Protocol, determine whether the packet length is greater than a preset threshold.

[0051] Step S206: If the packet length is greater than a preset threshold, set the transmission protocol of the communication data command packet to the transmission control protocol.

[0052] Specifically, when a command word in a communication data command packet indicates that the communication data command packet should be sent using UDP, it is necessary to further determine whether the packet length of the communication data command packet is greater than a preset threshold. This threshold can be set manually, and to improve transmission efficiency, it is generally set to 1500 bytes. If the packet length of the communication data command packet is greater than 1500 bytes, the transmission protocol of the communication data command packet is changed to TCP.

[0053] Step S208: Determine the priority of the communication data command packet;

[0054] Specifically, the control word is a 32-bit binary integer; the control word includes: a 2-bit priority indicator bit, which is used to represent the priority of the communication data command packet; each packet has 2 bits to set the priority of the current communication data command packet, namely: high, medium, low, exemplary, exemplary, 11 indicates that the priority of the communication data command packet is high, 10 indicates that the priority of the communication data command packet is medium, and 01 indicates that the priority of the communication data command packet is low.

[0055] Step S210: Send the plurality of the communication data command packets to the peripheral device according to the priority order;

[0056] After acquiring multiple communication data command packets, the sender sorts the transmission order of the multiple communication data command packets according to their priority, and sends the communication data command packets to the peripheral devices in priority order.

[0057] Furthermore, after determining the priority of multiple communication data command packets, i.e., after determining the sending order of multiple communication data command packets, it is necessary to further determine whether a return flag needs to be received after sending a certain communication data command packet before sending subsequent communication data command packets. This determination is made through the following steps A1-A4:

[0058] Step A1: Determine whether the subsequent communication data command packet to be sent is based on the return flag of the receiving end based on the waiting flag bit;

[0059] Specifically, the control word also includes: a 1-bit wait flag and a 16-bit wait time bit; the wait flag is used to indicate whether the subsequent communication data command packet is sent based on the return flag of the receiving end; the wait time bit is used to indicate the preset time length for waiting to receive the return flag; for example, if the wait flag is 1, it means that the sending end needs to wait for the receiving end to return information that the communication data command packet has been received before continuing to send the subsequent communication data command packet; if the wait flag is 0, it means that the sending end does not need to wait for the receiving end to return information that the communication data command packet has been received, and can directly send the subsequent communication data command packets in sequence; the control word also reserves 13 spare bits for future communication expansion.

[0060] Step A2: If yes, determine the length of time to wait for the return flag based on the waiting time bit;

[0061] Furthermore, the control word includes a 16-bit wait time bit, which indicates the time the sender waits for the receiver's return flag. For example, if the wait time bit is 00000000 00000101, it means that the communication data command packet needs to be sent and then wait for 5 milliseconds before continuing to execute subsequent actions.

[0062] Step A3: Upon receiving the return flag within the specified time period, send the subsequent communication data command packet;

[0063] Furthermore, if a return flag is received within the waiting time, the subsequent communication data command packet is sent immediately. For example, the waiting time bit is 00000000 00000100, indicating that the communication data command packet needs to be sent and then wait for 4 milliseconds before continuing to send the subsequent communication data command packet. When the sending end receives the return flag within 4 milliseconds, for example, if the return flag is received in 2 milliseconds, the subsequent communication data command packet is sent immediately.

[0064] Step A4: If the return flag is not received within the specified time period, send the subsequent communication data command packet after the specified time period ends;

[0065] Furthermore, following the example in step A3, if the sending end still does not receive the return flag after 4 milliseconds, it will immediately send subsequent communication data command packets and will not continue to wait. It should be emphasized that if the waiting time bit is 0xFFFF, i.e., 11111111 11111111, it means that it will wait indefinitely until the sending end receives the return flag before continuing to send subsequent communication data command packets.

[0066] Furthermore, the structured variable-length region includes: multiple instruction words; wherein, the instruction word includes: a 32-bit floating-point number.

[0067] Specifically, the structured variable-length region is additional descriptive information for the data packet. For example, robot TCP coordinate data needs to include the robot's position and orientation information. According to the aforementioned definition, the packet format is shown in Table 2. Of course, other data packets also contain corresponding additional descriptive information in a similar format. The structured variable-length region can not only represent the robot's position and orientation information, but also a set of actions. For example, if the robot needs to pass through ten coordinate points in sequence, the structured variable-length region can be the coordinate information of these coordinate points. Combined with the movement command in the command word, the action performed by the robot after receiving the communication data command packet is to pass through the above coordinate points in sequence. The packet length is the sum of the packet header length and the variable length.

[0068]

[0069] Table 2

[0070] This invention improves transmission efficiency by determining whether the packet length is greater than a preset threshold and then adjusting the appropriate transmission method. It also improves transmission efficiency by defining priority indicator bits, wait flag bits, and wait time bits in the control word. Furthermore, it enhances the efficiency of communication data packets by setting up structured variable-length regions, thereby improving the scalability of communication data command packets.

[0071] Example 3

[0072] Based on the commercially available embodiments, this invention provides a data transmission device, see [link to relevant documentation]. Figure 3 The diagram shown illustrates a data transmission device according to an embodiment of the present invention. This data transmission device is used to execute the data transmission method provided in the above embodiment. The communication data command packet is in binary format and includes: a command word, a packet length, a control word, and a structured variable-length area; both the command word and the packet length are 32-bit binary integers; the command word includes control instructions; the packet length characterizes the length of the communication data command packet; the data transmission device includes:

[0073] The transmission protocol determination module 310 is used to determine the transmission protocol in the command word of the communication data command packet; wherein the transmission protocol includes: Transmission Control Protocol or User Datagram Protocol.

[0074] The communication module 320 is used to send communication data command packets to peripheral devices based on the Transmission Control Protocol or User Datagram Protocol.

[0075] Furthermore, the data transmission device also includes: a packet length determination module, used to determine whether the packet length is greater than a preset threshold if the transmission protocol is User Datagram Protocol;

[0076] The transmission protocol change module is used to set the transmission protocol of the communication data command packet to the transmission control protocol if the packet length is greater than a preset threshold.

[0077] The priority determination module is used to determine the priority of communication data command packets;

[0078] The communication module 320 is also used to send multiple communication data command packets to peripheral devices in order of priority;

[0079] The waiting determination module is used to determine whether the subsequent communication data command packets sent are based on the return flag of the receiving end, based on the waiting flag bit.

[0080] The waiting time determination module is used to determine the length of time to wait for the return flag based on the waiting time bit.

[0081] The communication module 320 is also used to respond to receiving a return flag within a certain time period and to send subsequent communication data command packets;

[0082] The communication module 320 is also used to send subsequent communication data command packets after the time period ends if no return flag is received within the time period.

[0083] Example 4

[0084] This invention also provides an electronic device for running the above-described data transmission method; see [link to previous document]. Figure 4 The schematic diagram of an electronic device provided by the embodiment of the present invention shown below includes a memory 100 and a processor 101. The memory 100 is used to store one or more computer instructions, which are executed by the processor 101 to implement the above-mentioned data transmission method.

[0085] Furthermore, Figure 4 The electronic device shown also includes a bus 102 and a communication interface 103, with the processor 101, the communication interface 103 and the memory 100 connected via the bus 102.

[0086] The memory 100 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 103 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 102 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0087] Processor 101 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 101 or by instructions in software form. Processor 101 can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a readily available storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 100, and processor 101 reads information from memory 100 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0088] The computer program product for data transmission provided in this embodiment of the invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0089] In the embodiments provided by this invention, it should be understood that the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the displayed or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.

[0090] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0091] In addition, the functional units in the embodiments provided by the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0092] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A data transmission method, characterized in that, The communication data command packet is in binary format, and includes: a command word, a packet length, a control word, and a structured variable-length area; both the command word and the packet length are 32-bit binary integers; the command word includes control instructions; the packet length is used to characterize the length of the communication data command packet; the data transmission method includes: Determine the transmission protocol in the command word of the communication data command packet; wherein the transmission protocol includes: Transmission Control Protocol or User Datagram Protocol; The communication data command packet is sent to the peripheral device based on the transmission control protocol or the user datagram protocol. Alternatively, the communication data command packet sent by the peripheral device may be received based on the transmission control protocol or the user datagram protocol. The control word further includes: a wait flag bit and a wait time bit; the wait flag bit is used to indicate whether the subsequent communication data command packet sent is based on the return flag of the receiving end; the wait time bit is used to indicate the preset time length for waiting to receive the return flag; the data transmission method further includes: Based on the waiting flag bit, determine whether the subsequent communication data command packet sent is based on the return flag of the receiving end; if so, determine the length of time to wait for the return flag based on the waiting time bit.

2. The data transmission method according to claim 1, characterized in that, The data transmission method further includes: If the transmission protocol is the User Datagram Protocol, determine whether the packet length is greater than a preset threshold; If the packet length is greater than a preset threshold, the transmission protocol of the communication data command packet is set to the transmission control protocol.

3. The data transmission method according to claim 1, characterized in that, The control word is a 32-bit binary integer; the control word includes a 2-bit priority indicator bit, which is used to characterize the priority of the communication data command packet; The data transmission method further includes: determining the priority of the communication data command packet; and sending multiple communication data command packets to the peripheral device in order of priority.

4. The data transmission method according to claim 3, characterized in that, The length of the waiting flag bit is 1 bit; the length of the waiting time bit is 16 bits.

5. The data transmission method according to claim 4, characterized in that, After determining the time length for waiting to receive the return flag based on the waiting time bit, the data transmission method further includes: Upon receiving the return flag within the specified time period, the subsequent communication data command packet is sent. If the return flag is not received within the specified time period, the subsequent communication data command packet is sent after the specified time period ends.

6. The data transmission method according to claim 1, characterized in that, The structured variable-length region includes: multiple instruction words; wherein, the instruction word includes: a 32-bit floating-point number.

7. A data transmission device, characterized in that, The communication data command packet is in binary format, and includes: a command word, a packet length, a control word, and a structured variable-length area; both the command word and the packet length are 32-bit binary integers; the command word includes control instructions; the packet length is used to characterize the length of the communication data command packet; the data transmission device includes: A transmission protocol determination module is used to determine the transmission protocol in the command word of the communication data command packet; wherein the transmission protocol includes: Transmission Control Protocol or User Datagram Protocol; The communication module is used to send the communication data command packet to the peripheral device based on the transmission control protocol or the user datagram protocol; The control word further includes: a wait flag bit and a wait time bit; the wait flag bit is used to indicate whether the subsequent communication data command packet sent is based on the return flag of the receiving end; the wait time bit is used to indicate the preset time length for waiting to receive the return flag; the data transmission device further includes: The waiting determination module is used to determine whether the subsequent communication data command packet sent is based on the return flag of the receiving end based on the waiting flag bit; The waiting time determination module is used to determine, if so, the length of time to wait for receiving the return flag based on the waiting time bit.

8. The data transmission device according to claim 7, characterized in that, The data transmission device further includes: A packet length determination module is used to determine whether the packet length is greater than a preset threshold if the transmission protocol is the User Datagram Protocol. The transmission protocol change module is used to set the transmission protocol of the communication data command packet to the transmission control protocol if the packet length is greater than a preset threshold.

9. An electronic device, characterized in that, The device includes a processor and a memory, the memory storing computer-executable instructions that can be executed by the processor, the processor executing the computer-executable instructions to implement the data transmission method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when invoked and executed by a processor, cause the processor to implement the data transmission method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Satellite data transmission method and device, computer equipment and storage medium

    CN112003937A

  • Data transmission method and device

    CN114449060A

  • Dynamic protocol switching

    US20160198021A1