A control method and device for an execution end and an electronic device
By caching and selecting control commands in sequence at the control end, encapsulating and sending control packets, the problem of control command loss and out-of-order delivery in the network environment is solved, and the control accuracy of the execution end is improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- HANGZHOU EZVIZ SOFTWARE CO LTD
- Filing Date
- 2026-03-05
- Publication Date
- 2026-06-05
AI Technical Summary
In applications such as drone performances and lighting control, the transmission of control packets is easily affected by the network environment, which can lead to the loss or out-of-order execution of control commands received by the execution end, reducing the accuracy of control.
The control terminal continuously generates and caches control commands, including command content and sequence number. At the time of packet transmission, it selects commands from the cache according to a predetermined selection method, encapsulates them into control packets, sends them to the execution terminal, and receives acknowledgment packets to ensure that commands are responded to in order.
Even in the event of packet loss, the execution end can respond to control commands in sequence, improving control accuracy and reducing the impact of out-of-order issues.
Smart Images

Figure CN122160388A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of network control technology, and in particular to a control method, device and electronic device for the execution end. Background Technology
[0002] In applications that emphasize continuous control, such as drone shows and lighting control, the control end (e.g., drone controller, lighting control equipment) needs to continuously transmit control packets containing control instructions to the execution end (e.g., drones, lights), so that the execution end can respond to the control instructions contained in the control packet after receiving it.
[0003] However, the above transmission process is susceptible to network conditions, and there may be situations such as control packet loss or out-of-order delivery. As a result, when these situations occur, the control instructions received by the execution end may be lost or out of order, ultimately leading to lower accuracy in the control of the execution end. Summary of the Invention
[0004] The purpose of this application is to provide a control method, apparatus, and electronic device for the execution end, so as to improve the accuracy of control over the execution end. The specific technical solution is as follows:
[0005] In a first aspect, embodiments of this application provide a control method for an execution end, applied to a control end, the method comprising:
[0006] In response to enabling control over the execution end, control instructions are continuously generated and cached; wherein, the control instructions include instruction content and sequence numbers used to characterize the execution order of the instructions;
[0007] Whenever a packet transmission time is reached, the control instruction to be executed by the execution end is selected from the currently cached control instructions according to a predetermined selection method; wherein, the predetermined selection method includes: if the packet transmission time is not the first packet transmission time, and the acknowledgment packet of the previous control packet is not received, then the control instruction used to encapsulate the previous control packet is selected, and at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions;
[0008] The selected control commands are encapsulated into a control package;
[0009] The encapsulated control packet is sent to the execution terminal so that after receiving the control packet, the execution terminal sends back an acknowledgment packet of the received control packet, and responds to the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0010] Secondly, embodiments of this application provide a control device for an execution end, applied to a control end, the device comprising:
[0011] The instruction generation module is used to continuously generate and cache various control instructions in response to the activation of control over the execution end; wherein, the control instructions include instruction content and sequence numbers used to characterize the execution order of the instructions;
[0012] The instruction selection module is used to select the control instruction to be executed by the execution end from the currently cached control instructions according to a predetermined selection method whenever a packet transmission time is reached; wherein, the predetermined selection method includes: if the packet transmission time is not the first packet transmission time, and the acknowledgment packet of the previous control packet is not received, then the control instruction used to encapsulate the previous control packet is selected, and at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions;
[0013] The instruction encapsulation module is used to encapsulate the selected control instructions into control packages;
[0014] The instruction sending module is used to send the encapsulated control packet to the execution terminal, so that after receiving the control packet, the execution terminal will send back an acknowledgment packet of the received control packet, and respond to the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0015] Thirdly, embodiments of this application provide an electronic device, including:
[0016] Memory, used to store computer programs;
[0017] The processor, when executing a program stored in memory, implements the control method for the execution end provided in the first aspect.
[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the control method for the execution end provided in the first aspect.
[0019] This application also provides a computer program product containing instructions that, when run on a computer, cause the computer to execute the control method for the execution end described in the first aspect.
[0020] Beneficial effects of the embodiments in this application:
[0021] This application provides a control method for an execution end, applied to a control end. In response to initiating control over the execution end, the control end continuously generates and caches control instructions. Each control instruction includes instruction content and a sequence number representing the instruction execution order. Whenever a packet transmission time is reached, the control end selects the control instruction to be executed by the execution end from the currently cached control instructions according to a predetermined selection method. Then, it encapsulates the selected control instruction into a control packet and sends the encapsulated control packet to the execution end. Upon receiving the control packet, the execution end returns an acknowledgment packet of the received control packet and responds to the instruction content of the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0022] The aforementioned predetermined selection method includes: if the packet sending time is not the first packet sending time, and in response to the failure to receive the acknowledgment packet of the previous control packet, a control instruction to be encapsulated in the previous control packet is selected, and at least one previously unselected control instruction is selected according to the sequence number in the currently cached control instructions. In other words, when the packet sending time is not the first packet sending time, it indicates that the control end has already sent a control packet to the execution end (i.e., a previous control packet exists). Ideally, at each packet sending time, the control end will receive an acknowledgment packet of the previous control packet from the execution end. If the acknowledgment packet of the previous control packet is not received, the control end cannot determine whether the execution end has received the previous control packet. In this case, the control instruction to be encapsulated in the previous control packet, and at least one previously unselected control instruction selected according to the sequence number in the currently cached control instructions, are encapsulated into a single control packet, that is, the control instruction of the previous control packet and the control instruction that should have been sent are merged into one control packet. In this way, even in the event of packet loss, the sent control packets still encapsulate the control instructions from the previous control packet. The execution end can still respond to the control instructions encapsulated in the received control packets according to the sequence number of the control instructions generated by the control end for that execution end. Furthermore, the sequence number in the control instructions indicates the execution order of the control instructions. This sequence number setting ensures that the execution end responds to the control instructions sequentially, reducing the inaccuracy of execution end control caused by out-of-order issues. Therefore, this solution can improve the accuracy of execution end control. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in the embodiments of this application 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 this application. For those skilled in the art, other embodiments can be obtained based on these drawings.
[0024] Figure 1A flowchart illustrating a control method for the execution end provided in an embodiment of this application;
[0025] Figure 2 A flowchart illustrating another control method for the execution end provided in an embodiment of this application;
[0026] Figure 3 A flowchart illustrating another control method for the execution end provided in an embodiment of this application;
[0027] Figure 4 An illustration of an applicable scenario for a specific example provided in this application embodiment;
[0028] Figure 5 for Figure 4 The diagram shows the execution flow of a specific instance.
[0029] Figure 6 This diagram illustrates the normal sending of control command information and execution of response processes when the network environment quality is relatively good.
[0030] Figure 7 This diagram illustrates the process of dynamically adjusting the sending interval and triggering command retransmission when the network environment quality fluctuates.
[0031] Figure 8 This application provides a schematic diagram of the structure of a control device for the execution end, as shown in the embodiments of the present application.
[0032] Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0033] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art based on this application are within the scope of protection of this application.
[0034] To facilitate understanding of the proposal, the technical terms used in this application will be introduced first.
[0035] Digital control, communication control, and network control refer to control methods in which control commands are transmitted to the controlled device via Ethernet, WiFi (Wireless Fidelity), or Zigbee. The controlled device is the execution end in this application.
[0036] Analog control and hard-wired control refer to controlling the controlled equipment through current / voltage.
[0037] Channel data compression refers to a data processing method that reduces storage requirements and improves transmission efficiency.
[0038] Ethernet is a wired local area network (LAN) technology that emphasizes high speed, low latency, and stability, making it suitable for scenarios with high network requirements.
[0039] Wi-Fi is a wireless local area network technology that emphasizes flexibility and mobility, making it suitable for everyday life and portable devices.
[0040] Zigbee is a low-speed, short-range wireless network protocol. Its underlying media access layer and physical layer are based on the IEEE 802.15.4 standard. Key features include low speed, low power consumption, low cost, support for a large number of network nodes, support for various network topologies, low complexity, speed, reliability, and security.
[0041] The COO (Zigbee Coordinator) is responsible for the overall establishment and management of the Zigbee network and is the center of the network.
[0042] An SDK (Software Development Kit) is typically a collection of development tools that engineers use to create application software for specific software packages, software frameworks, hardware platforms, operating systems, etc.
[0043] RTT (Round-Trip Time) is the time it takes for a data packet to travel from the source node to the destination node and then back to the destination node with an acknowledgment. In this application, the data packet is the control packet, the source node is the control terminal, the destination node is the execution terminal, and the acknowledgment is the acknowledgment packet. The formula for calculating RTT is: RTT = Tack - Tsend, where Tack represents the timestamp of sending the data packet, and Tsend represents the timestamp of receiving the ACK (Acknowledgment signal, also known as the acknowledgment packet, in this application).
[0044] LQI (Link Quality Indicator) is typically between 0 and 255.
[0045] PLR (Packet Loss Rate) refers to the percentage of data packets that the receiving end (i.e., the execution end in this application) fails to successfully receive during network transmission, relative to the total number of data packets sent by the sending end (i.e., the control end in this application).
[0046] Routing is the network-wide process of determining the end-to-end path for packets as they travel from source to destination.
[0047] A routing table, also known as a Routing Information Base (RIB), is a spreadsheet (file) or database stored in a router or networked computer. The routing table stores paths to specific network addresses (and in some cases, routing metrics). It also contains topology information about the surrounding network.
[0048] A link is a physical or logical channel that connects two devices; it can be a cable, a wireless signal, or other form of medium.
[0049] ZCL (Zigbee Cluster Library) is a core component of the Zigbee protocol stack that defines the various standardized application-layer protocols used in Zigbee networks. ZCL is a collection of definitions used to define communication behaviors between devices, allowing devices to exchange functions and transfer data within a Zigbee network.
[0050] The candela (cd) is the SI base unit of luminous intensity, used to describe the ability of a light source to emit light in a given direction. It represents the strength of a light source's luminous intensity in a specific direction.
[0051] Go-Back-N ARQ (Go-Back-N Automatic Repeat reQuest) is a sliding window-based error control protocol widely used in the data link layer and transport layer to ensure reliable data transmission over unreliable channels. It is an enhanced version of the ARQ (Automatic Repeat Request) protocol family, introducing continuous transmission and cumulative acknowledgment mechanisms on top of the Stop-and-Wait ARQ protocol, thereby improving transmission efficiency.
[0052] To address the aforementioned technical problems, embodiments of this application provide a control method, apparatus, and electronic device for the execution end, wherein the method is applied to the control end. This method is applicable to various application scenarios involving control of the execution end, such as a drone control handle for controlling a drone, or a lighting control device for controlling lights.
[0053] Furthermore, the control terminal applied to this method can be either hardware (such as a control device for controlling the execution terminal) or software (such as a control program for controlling the execution terminal), both of which are reasonable. For example, when the control terminal is hardware, the execution entity of this application can be various electronic devices such as laptops and desktop computers; when the control terminal is software, the execution entity of this application can be various electronic devices equipped with control programs, hereinafter collectively referred to as electronic devices. Correspondingly, the execution terminal controlled by the control terminal can be either hardware or software. For example, when the execution terminal is hardware, it can be a drone, a robotic arm, a lighting device, etc.; when the execution terminal is software, it can be a software program. Both of these are reasonable.
[0054] Therefore, the embodiments of this application do not limit the application scenarios, control end, and execution end of the method.
[0055] This application provides a control method for the execution end, which may include the following steps:
[0056] In response to enabling control over the execution end, control instructions are continuously generated and cached; wherein, the control instructions include instruction content and sequence numbers used to characterize the execution order of the instructions;
[0057] Whenever a packet transmission time is reached, the control instruction to be executed by the execution end is selected from the currently cached control instructions according to a predetermined selection method; wherein, the predetermined selection method includes: if the packet transmission time is not the first packet transmission time, and the acknowledgment packet of the previous control packet is not received, then the control instruction used to encapsulate the previous control packet is selected, and at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions.
[0058] The selected control commands are encapsulated into a control package;
[0059] The encapsulated control packet is sent to the execution terminal so that after receiving the control packet, the execution terminal sends back an acknowledgment packet of the received control packet, and responds to the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0060] As can be seen from the above, the control method for the execution end provided in this application is applied to the control end. In response to initiating control over the execution end, the control end continuously generates and caches various control instructions. Each control instruction includes instruction content and a sequence number representing the instruction execution order. Whenever a packet transmission time is reached, the control end can select the control instruction to be executed by the execution end from the currently cached control instructions according to a predetermined selection method. Then, it encapsulates the selected control instruction into a control packet and sends the encapsulated control packet to the execution end. Upon receiving the control packet, the execution end returns an acknowledgment packet of the received control packet and responds to the instruction content of the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0061] The aforementioned predetermined selection method includes: if the packet sending time is not the first packet sending time, and in response to the failure to receive the acknowledgment packet of the previous control packet, a control instruction to be encapsulated in the previous control packet is selected, and at least one previously unselected control instruction is selected according to the sequence number in the currently cached control instructions. In other words, when the packet sending time is not the first packet sending time, it indicates that the control end has already sent a control packet to the execution end (i.e., a previous control packet exists). Ideally, at each packet sending time, the control end will receive an acknowledgment packet of the previous control packet from the execution end. If the acknowledgment packet of the previous control packet is not received, the control end cannot determine whether the execution end has received the previous control packet. In this case, the control instruction to be encapsulated in the previous control packet, and at least one previously unselected control instruction selected according to the sequence number in the currently cached control instructions, are encapsulated into a single control packet, that is, the control instruction of the previous control packet and the control instruction that should have been sent are merged into one control packet. In this way, even in the event of packet loss, the sent control packets still encapsulate the control instructions from the previous control packet. The execution end can still respond to the control instructions encapsulated in the received control packets according to the sequence number of the control instructions generated by the control end for that execution end. Furthermore, the sequence number in the control instructions indicates the execution order of the control instructions. This sequence number setting ensures that the execution end responds to the control instructions sequentially, reducing the inaccuracy of execution end control caused by out-of-order issues. Therefore, this solution can improve the accuracy of execution end control.
[0062] The following section, with reference to the accompanying drawings, provides a detailed description of a control method for the execution end provided in this application.
[0063] Figure 1 This application provides a control method for an execution end, which is applied to a control end. The method includes the following steps S101-S104:
[0064] S101: In response to enabling control over the execution end, continuously generate and cache each control instruction.
[0065] The control instructions include the instruction content and a sequence number used to characterize the order in which the instructions are executed.
[0066] In this application, when the control terminal detects the user's operation on the operation key (which may also be an operation knob, joystick, etc.), it starts to control the execution terminal. The control terminal continuously monitors the user's operation flow of the corresponding operation key and continuously generates and caches each control instruction based on the monitored operation flow.
[0067] For example, when the control terminal is an operation knob on a lighting control device (used to remotely control the brightness of the corresponding light), and the execution terminal is the light corresponding to the operation knob, the control terminal initiates control of the light corresponding to the operation knob when it detects that the user has touched the operation knob. As the user continues to control the operation knob, the control terminal continuously generates control commands for the light. For example, the control process includes: first rotating the operation knob to a brightness of 20 cd, then rotating it to a brightness of 100 cd after 0.2 seconds, and then rotating it to a brightness of 150 cd after 0.2 seconds. Correspondingly, the generated control commands include: sequence number 1, target brightness of 20 cd; sequence number 2, target brightness of 100 cd; and sequence number 3, target brightness of 150 cd.
[0068] In other words, the generated control command includes a sequence number representing the execution order of the command, as well as the command content. Taking the control command "Sequence Number 1, Target Brightness 20cd" as an example, the sequence number 1 is the sequence number corresponding to this control command. This sequence number represents the operation order in the user's control flow of the operation knob, and it is also the execution order that the execution end needs to follow when executing the control command. The target brightness 20cd is the command content corresponding to this control command. This command content represents that when executing this control command, the brightness of the corresponding light should be adjusted to the target brightness of 20cd.
[0069] It should be noted that the order of the contents contained in the above control instructions can be customized.
[0070] S102: Whenever a packet is sent, select the control instruction to be executed from the currently cached control instructions according to the predetermined selection method.
[0071] The predetermined selection method includes: if the packet sending time is not the first packet sending time, and the acknowledgment packet of the previous control packet is not received, then the control instruction to be encapsulated in the previous control packet is selected, and at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions.
[0072] S103: Encapsulate the selected control instructions into a control package.
[0073] S104: Send the encapsulated control packet to the execution end, so that after receiving the control packet, the execution end will send back an acknowledgment packet of the received control packet, and respond to the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0074] In this application, a packet sending time is preset. That is, whenever a packet sending time is reached, the control terminal selects the control command to be executed from the currently cached control instructions according to a predetermined selection method and the sequence number in the currently cached control instructions.
[0075] It should be noted that if the reached packet transmission time is not the first packet transmission time, it indicates that the control end has already sent a control packet to the execution end (i.e., a previous control packet exists). Ideally, after receiving the previous control packet, the execution end will return an acknowledgment packet within a certain time period. This acknowledgment packet is used to notify the control end that the execution end has received the previously sent control packet. In this way, after receiving the acknowledgment packet, the control end can continue to send the next control packet to the execution end. That is to say, within a specified time period starting from the time when the control end sends the control packet to the execution end, the control end will receive the acknowledgment packet of the control packet fed back by the execution end. The above-mentioned specified time period can be understood as the round-trip time of any air packet between the control end and the execution end.
[0076] Optionally, in one implementation, the packet sending times other than the first packet sending time are determined based on the target packet sending interval; wherein the target packet sending interval is not less than the round-trip time of any air packet between the control end and the execution end.
[0077] In this implementation, the packet transmission times, excluding the first packet transmission time, are determined based on a target packet transmission interval. This target packet transmission interval is not less than the round-trip time of any air packet between the control end and the execution end; that is, the target packet transmission interval is not less than the specified duration mentioned above. Thus, at each packet transmission time, the control end and the execution end have already completed the transmission of control packets and acknowledgment packets for the previous packet transmission time. There are no other air packets between the control end and the execution end, which significantly reduces the possibility of air packet collisions and reduces the impact on network environment quality. The specific implementation process for determining the target packet transmission interval is detailed in step B below and will not be elaborated upon here.
[0078] If, due to network quality issues, the executor fails to return an acknowledgment packet for the previous control packet in a timely manner, or if the executor does not receive the previous control packet (i.e., packet loss occurs), the control terminal, in response to the lack of an acknowledgment packet for the previous control packet, selects the control instruction used to encapsulate the previous control packet, and selects at least one previously unselected control instruction according to the sequence number in the currently cached control instructions, and encapsulates the selected control instruction into a control packet. In other words, if the packet transmission time is not the first transmission time and an acknowledgment packet for the previous control packet has not been received, the control terminal cannot determine whether the executor has received the previous control packet. In this case, to ensure that the executor can respond to the control instructions generated by the control terminal for controlling the executor, the control terminal encapsulates the control instruction from the previous control packet, and selects at least one previously unselected control instruction according to the sequence number in the currently cached control instructions, encapsulating them into a single control packet. That is, the control instruction from the previous control packet and the control instruction that should have been sent are combined into one control packet, and then the encapsulated control packet is sent to the executor.
[0079] Upon receiving a control packet, the execution end sends back an acknowledgment packet, parses the received control packet to obtain the control instructions encapsulated within it, and caches these instructions. Then, according to the sequence number of the control instructions, it responds to the cached control instructions sequentially. In other words, even in the event of packet loss, since the sent control packet still encapsulates the control instructions from the previous control packet, the execution end can still respond to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions generated by the control end for that execution end.
[0080] Alternatively, in one implementation, such as Figure 2 As shown, the steps described above for encapsulating the selected control instructions into a control package may include the following steps:
[0081] S1031: If the selected control instructions do not include the last control instruction in the current cache, add extended information to the control instruction with the largest sequence number among the selected control instructions;
[0082] The extended information is: the estimated instruction content that the execution end needs to respond to after executing the control instruction with the largest sequence number;
[0083] S1032: After adding extended information, the currently selected control command is encapsulated to obtain a control package;
[0084] Correspondingly, the execution end is also used to respond to the extended information in the last control instruction after responding to the instruction content of the last control instruction.
[0085] In this implementation, to reduce the possibility of the execution end experiencing lag due to the control packet not being sent to the execution end in a timely manner, extended information is added to the control instruction with the largest sequence number among the selected control instructions, provided that the selected control instructions do not include the last control instruction currently cached. This extended information is a predicted instruction content that the execution end needs to respond to after executing the control instruction with the largest sequence number. In other words, after selecting the control instructions to be encapsulated into a control packet, the control end predicts, based on the instruction content of each selected control instruction, the instruction content that the execution end needs to continue executing after executing the last control instruction of the control packet (i.e., the control instruction with the largest sequence number among the selected control instructions), and this prediction serves as the extended information for the control instruction with the largest sequence number. For example, if the sequence number of the last control instruction encapsulated in a control packet is 10, then the extended information for the control packet could be command sequence number 11 and target brightness of 130 cd. In this way, even if the execution end does not receive the next control packet after responding to the instruction content of the last control instruction in the received control packet, the execution end can continue to execute the instruction content of the extended information based on the extended information of the last control instruction.
[0086] In this implementation, by setting extended information for the last control instruction of each control packet, if the execution end has not received the next control instruction after responding to the instruction content of the last control instruction, the execution end can continue to respond to the extended information carried in the last control instruction, so as to ensure that the actions on the execution end side remain continuous and there is no lag.
[0087] As can be seen from the above, the control method for the execution end provided in this application is applied to the control end. In response to initiating control over the execution end, the control end continuously generates and caches various control instructions. Each control instruction includes instruction content and a sequence number representing the instruction execution order. Whenever a packet transmission time is reached, the control end can select the control instruction to be executed by the execution end from the currently cached control instructions according to a predetermined selection method. Then, it encapsulates the selected control instruction into a control packet and sends the encapsulated control packet to the execution end. Upon receiving the control packet, the execution end returns an acknowledgment packet of the received control packet and responds to the instruction content of the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0088] The aforementioned predetermined selection method includes: if the packet sending time is not the first packet sending time, and in response to the failure to receive the acknowledgment packet of the previous control packet, a control instruction to be encapsulated in the previous control packet is selected, and at least one previously unselected control instruction is selected according to the sequence number in the currently cached control instructions. In other words, when the packet sending time is not the first packet sending time, it indicates that the control end has already sent a control packet to the execution end (i.e., a previous control packet exists). Ideally, at each packet sending time, the control end will receive an acknowledgment packet of the previous control packet from the execution end. If the acknowledgment packet of the previous control packet is not received, the control end cannot determine whether the execution end has received the previous control packet. In this case, the control instruction to be encapsulated in the previous control packet, and at least one previously unselected control instruction selected according to the sequence number in the currently cached control instructions, are encapsulated into a single control packet, that is, the control instruction of the previous control packet and the control instruction that should have been sent are merged into one control packet. In this way, even in the event of packet loss, the sent control packets still encapsulate the control instructions from the previous control packet. The execution end can still respond to the control instructions encapsulated in the received control packets according to the sequence number of the control instructions generated by the control end for that execution end. Furthermore, the sequence number in the control instructions indicates the execution order of the control instructions. This sequence number setting ensures that the execution end responds to the control instructions sequentially, reducing the inaccuracy of execution end control caused by out-of-order issues. Therefore, this solution can improve the accuracy of execution end control.
[0089] In another embodiment of this application, the predetermined selection method further includes: if the packet sending time is the first packet sending time, selecting at least one control instruction that has not been selected before according to the sequence number in the currently cached control instructions.
[0090] In this embodiment, when the packet sending time is the first packet sending time, that is, when the control end has not sent a control packet to the execution end, the control end can directly select at least one control instruction that has not been selected according to the sequence number in the currently cached control instructions. Then, the selected at least one control instruction is encapsulated into a control packet and sent to the execution end.
[0091] In another embodiment of this application, the predetermined selection method further includes: if the packet sending time is not the first packet sending time, in response to the receipt of the confirmation packet of the previous control packet, selecting at least one control instruction that has not been selected according to the sequence number in the currently cached control instructions.
[0092] In this embodiment, if the reached packet sending time is not the first packet sending time, and the control terminal receives an acknowledgment packet of the previous control packet sent by the sender, then the control terminal selects at least one control instruction that has not been selected according to the sequence number in the currently cached control instructions, and then encapsulates the selected at least one control instruction into a control packet and sends it to the execution terminal.
[0093] In another embodiment of this application, the determination of the first packet transmission time includes the following step A:
[0094] Step A: The moment after the first moment and the predetermined time has elapsed is determined as the first packet sending moment; where the first moment is the moment when control over the execution end is initiated, and the predetermined time is a specified multiple of the target packet sending interval;
[0095] Accordingly, if the packet transmission time is the first packet transmission time, the step of selecting an unselected control instruction according to the sequence number in the currently cached control instructions includes the following step A1:
[0096] Step A1: If the packet sending time is the first packet sending time, select each control instruction generated during the time period between the first time and the first packet sending time from the currently cached control instructions.
[0097] In this embodiment, the control packet sent at the first packet sending time includes: each control instruction generated during the time period between the first time and the first packet sending time selected from the currently cached control instructions; wherein, the predetermined duration is a specified multiple of the target packet sending interval, that is, the number of control instructions contained in the first control packet sent to the execution end is significantly more than the number of control instructions contained in each control packet after the first control packet.
[0098] After receiving each control packet from the control terminal, the execution terminal parses and caches the control instructions contained in each control packet, and executes the instruction content of each control instruction sequentially according to the sequence number. Therefore, after receiving the first control packet, even if no next control packet is received after the next packet transmission time, the execution terminal can continue to respond to the instruction content of each control instruction based on the cached control instructions, and the execution terminal will not experience any lag.
[0099] In this embodiment, by setting the predetermined duration to a specified multiple of the target packet sending interval, the number of control instructions in the first control packet sent to the execution end is significantly greater than the number of control instructions contained in each subsequent control packet, thereby reducing the possibility of the execution end laging if the next control packet is not received in time.
[0100] In another embodiment of this application, the method for determining the target packet sending interval may include the following step B:
[0101] Step B: In response to the satisfaction of any sub-condition in the predetermined determination conditions, determine the round-trip time and target packet loss rate of each air packet between the control end and the execution end; calculate the target packet transmission interval based on the obtained round-trip time and target packet loss rate; wherein, the predetermined determination conditions include one or more of the following sub-conditions: the network state of the wireless network between the execution end and the control end changes; or control over the execution end is detected to be enabled.
[0102] In this embodiment, considering that network environment quality is one of the factors affecting air packet transmission between the control end and the execution end, the worse the network environment quality, the higher the packet loss rate; the better the network environment quality, the lower the packet loss rate, the network state change of the wireless network between the execution end and the control end is used as a sub-condition of the predetermined determination condition for determining the target packet transmission interval. Thus, by determining whether the packet loss rate has changed, it is determined whether the network state of the wireless network between the execution end and the control end has changed.
[0103] Furthermore, considering that the first packet transmission time needs to be predetermined when the control over the execution end is detected, and the first packet transmission time is also determined based on the target packet transmission interval, the detection of the start of control over the execution end is used as another sub-condition of the predetermined determination condition for determining the target packet transmission interval.
[0104] In this way, when any of the sub-conditions in the predetermined conditions are met, the control end can determine the round-trip time and target packet loss rate of each air packet between the control end and the execution end, and then calculate the target packet transmission interval based on the obtained round-trip time and target packet loss rate.
[0105] It should be noted that when the predetermined determination conditions include detecting the activation of control over the execution end, the aforementioned air packet is a detection packet (also known as a test packet) sent by the control end to the execution end; when the predetermined determination conditions include a change in the network state of the wireless network between the execution end and the control end, the aforementioned air packet is a control packet sent by the control end to the execution end.
[0106] For example, the target packet sending interval can be calculated using the following formula, based on the obtained round-trip time and the target packet loss rate;
[0107] T = rT / (1-P);
[0108] Where T represents the target packet sending interval, rT represents the average round-trip time (also known as the average round-trip time, because the increase in the number of packets will lead to a gradual deterioration of the round-trip time, so the average round-trip time is used when calculating the target packet sending interval), P represents the target packet loss rate, and the above 1-P represents the minimum packet sending success rate within the obtained round-trip time.
[0109] By setting the aforementioned predetermined conditions, the target packet transmission interval can be dynamically adjusted during the control process at the execution end, so that the sending behavior of the control packet is adapted to the current network status of the wireless network, thereby improving network transmission efficiency and achieving efficient transmission of the control packet.
[0110] Optionally, in one implementation, the determination of the target packet loss rate may include the following step C:
[0111] Step C: Divide the time range for transmitting each air packet into multiple detection periods; for each detection period, calculate the packet loss rate within that detection period, and select the maximum value among the packet loss rates corresponding to multiple detection periods as the target packet loss rate.
[0112] In this implementation, the target packet loss rate can be the maximum packet loss rate within the time range of each air packet transmission. That is, the time transmission range is divided into multiple detection periods, and for each detection period, the packet loss rate existing in that detection period is calculated. Then, the maximum value of the packet loss rates corresponding to multiple detection periods is selected as the target packet loss rate.
[0113] Optionally, when the time range for each air packet transmission is taken as the target time period, the packet loss rate corresponding to the target time period is calculated. Then, the maximum value is selected from the packet loss rates corresponding to the multiple detection time periods calculated in step C above, and the packet loss rate corresponding to the target time period, as the target packet loss rate. In this implementation, considering that the more packet loss rate tests conducted and the longer the test time, the more accurate the determined target packet loss rate will be, after calculating the packet loss rates corresponding to the multiple detection time periods in step C above, the packet loss rate corresponding to the target time period is statistically analyzed, and the maximum value is selected from the packet loss rates corresponding to the multiple detection time periods and the packet loss rate corresponding to the target time period as the target packet loss rate, in order to improve the accuracy of the determined target packet loss rate.
[0114] For example, taking the scenario link of control end (C) <—>… (intermediate node)… <—> execution end (A) as an example, the control end sends a test packet to obtain the round-trip time t of the current environment (the current network status of the wireless network), and sends 3 sets of 5 test packets in each set in sequence. Starting from the first packet of each set, the timing is calculated to calculate the packet loss rate (a, b, and c) of the 3 sets of data within 15t. At the same time, the packet loss rate d of the 15 test packets within 15t is calculated. Then, the maximum value among a, b, c, and d is taken as the target packet loss rate.
[0115] In another embodiment of this application, such as Figure 3 As shown, the above control method further includes the following steps S301-S302:
[0116] S301: In response to sending the encapsulated control packet to the execution end, monitor whether an acknowledgment packet of the currently sent control packet is received within the target packet sending interval;
[0117] S302: Upon receiving the control instruction, delete the control instruction encapsulated in the currently sent control packet from the currently cached control instructions;
[0118] Accordingly, the step of selecting the control instruction to be encapsulated in the preceding control package includes the following steps:
[0119] From the currently cached control instructions, determine the control instructions that have been selected, and obtain the control instructions to be encapsulated in the previous control packet.
[0120] In this embodiment, after the control terminal sends the encapsulated control packet to the execution terminal, it monitors whether an acknowledgment packet for the currently sent control packet is received within the target packet sending interval. If no acknowledgment packet is received, the control terminal performs the steps of selecting the control instruction encapsulated in the previous control packet and selecting at least one previously unselected control instruction according to the sequence number in the currently cached control instructions. If an acknowledgment packet is received, it indicates that the control instruction encapsulated in the currently sent control packet has been successfully received by the execution terminal. At this time, the control terminal can delete the control instruction encapsulated in the currently sent control packet from the currently cached control instructions to reduce its own data cache pressure.
[0121] In other words, after receiving an acknowledgment packet for each control packet, the control terminal can delete the control instruction encapsulated in that control packet from its cached control instructions. Correspondingly, the control instructions cached by the control terminal can be divided into two categories: one is control instructions that have not been selected (not encapsulated in a control packet), and the other is control instructions that have been selected (encapsulated in a control packet, but no acknowledgment packet was received for that control packet within the target packet transmission interval). Therefore, when selecting control instructions from the currently cached control instructions to encapsulate in the previous control packet, the already selected control instructions can be directly determined from the currently cached control instructions to obtain the control instructions to be encapsulated in the migration control packet.
[0122] In this embodiment, by monitoring whether an acknowledgment packet of the currently sent control packet is received within the target packet sending interval, it is determined whether to delete the control instructions cached by the control terminal itself. By deleting the control instructions, the data caching pressure of the control terminal is reduced, while providing data convenience for subsequent selection of control instructions to be encapsulated in the previous control packet.
[0123] Optionally, in one implementation, deleting the control instructions encapsulated in the currently sent control packet from the currently cached control instructions upon receipt may include the following steps:
[0124] Upon receipt, delete control instructions in the currently cached control instructions that have a sequence number not greater than the target sequence number; where the target sequence number is the sequence number carried in the acknowledgment packet of the currently sent control packet.
[0125] In this implementation, the confirmation packet of any control packet carries the maximum sequence number of the sequence number of the control instruction encapsulated in that control packet. Thus, when the control terminal receives the currently sent confirmation packet, it directly deletes the control instruction with a sequence number not greater than the target sequence number from the currently cached control instructions based on the sequence number carried in the confirmation packet of the currently sent control packet.
[0126] In this implementation, the maximum sequence number carried in the confirmation packet can help the control terminal quickly locate the control instruction to be deleted in the currently cached control instructions, thereby improving the deletion efficiency of control instructions.
[0127] In another embodiment of this application, each control command further carries first duration information, which is used to characterize the duration of the response to the instruction content carried by the control command.
[0128] Accordingly, the execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions, including:
[0129] The execution end responds to the control instructions encapsulated in the received control packet according to the sequence number and first duration information of the control instructions encapsulated in the received control packet.
[0130] In this embodiment, each control instruction may also carry first duration information. When the execution terminal executes the instruction content of each control instruction sequentially according to the sequence number of the control instruction encapsulated in the received control packet, it responds to the control instruction according to the duration of the response represented by the first duration information carried by the control instruction. That is to say, the aforementioned first duration information refers to the duration that the execution terminal needs to maintain when executing the corresponding instruction content.
[0131] For example, the format of the above control instruction can be: sequence number + instruction content + first duration information. In this way, when the execution end executes the control instruction, it determines the control instruction to be executed based on the sequence number, then executes the instruction content of the control instruction, and controls the duration of executing the instruction content to be the duration represented by the first duration information.
[0132] For example, taking dimming and other functions controlled via a remote knob control terminal as an example, the generated control commands are as follows, where the time unit t is 0.1s and the brightness unit is 10cd:
[0133] Control commands [7|2|2], [8|10|2], [9|15|5], [10|15|10], and [11|13|2]. Specifically, control command [7|2|2] represents command number 7, with a target brightness of 20 cd and a change time of 0.2 s; control command [8|10|2] represents command number 8, with a target brightness of 100 cd and a change time of 0.2 s; control command [9|15|5] represents command number 9, with a target brightness of 150 cd and a change time of 0.5 s; control command [10|15|10] represents command number 10, with a target brightness of 150 cd, no change, and a hold time of 1 s; and control command [11|13|2] represents command number 11, with a target brightness of 130 cd and a change time of 0.2 s.
[0134] The example above demonstrates the process of a light brightening and then dimming. This can be understood as the control command generated when a user brightens the light using a remote knob, the light becomes too bright, and then the brightness is slightly reduced. The specific execution process on the executing end is as follows:
[0135] When the execution end executes control command [7|2|2] (control command with command number 7), the brightness of the control lamp is adjusted to the target brightness of 20 cd, and the brightness is maintained at 20 cd for 0.2 seconds; when the execution end executes control command [8|10|2] (control command with command number 8), the brightness of the control lamp is adjusted to the target brightness of 100 cd, and the brightness is maintained at 100 cd for 0.2 seconds; when the execution end executes control command [9|15|5] (control command with command number 9), the brightness of the control lamp is adjusted to the target brightness of 100 cd. The target brightness is 150 cd, and the brightness is maintained at 150 cd for 0.5 seconds. When the execution end executes the control command [10|15|10] (the control command with command number 10), the brightness of the control lamp is maintained at the target brightness of 150 cd, that is, the brightness of the light does not need to be changed, and the brightness is maintained at 150 cd for 1 second. When the execution end executes the control command [11|13|2] (the control command with command number 11), the brightness of the control lamp is adjusted to the target brightness of 130 cd, and the brightness is maintained at 130 cd for 0.2 seconds.
[0136] In another embodiment of this application, each control instruction other than the first control instruction generated also carries second duration information. The second duration information is used to characterize the time of responding to the instruction content carried by the control instruction, compared to the interval duration of the reference time, which is the time of responding to the instruction content in the previous control instruction.
[0137] Accordingly, the execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions, including:
[0138] The execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions encapsulated in the received control packet and the second duration information carried by each control instruction except for the first control instruction.
[0139] In this embodiment, for each control instruction other than the first control instruction generated, a second duration information may also be carried. When the execution end executes the instruction content of each control instruction in sequence according to the signal of the control instruction encapsulated in the received control packet, it determines whether the time interval between the response to the instruction content of the previous control instruction is the time interval represented by the second duration information carried by the control instruction. If so, the execution end begins to respond to the instruction content of the control instruction.
[0140] For example, the current control instruction is control instruction Y, and the previous control instruction of control instruction Y is control instruction X. Control instruction Y includes: sequence number, instruction content, and second duration information. The second duration information is used to characterize the time of response to the instruction content of control instruction Y. The interval between the time of response to the instruction content of control instruction X is t. That is, the time when the execution end responds to the instruction content of control instruction X is the start time. After the above interval t, the execution end responds to the execution content of control instruction Y.
[0141] The aforementioned control commands may also include the rate of change of the command content, such as the rate of change of the lights or the ascent rate of the drone.
[0142] It should be noted that the units of the first and second duration information mentioned above can be different depending on the product characteristics, such as 0.1s, 1ms, 0.1ms, etc.; the greater the precision of the duration information, the more accurately the execution end will follow.
[0143] Of course, when the control packet contains too many control commands, the control packet can be compressed before being sent to improve the transmission efficiency of the control packet and increase the proportion of effective data during the transmission of the control packet.
[0144] In this embodiment, by adding duration information to the control package, precise control of the execution end is achieved, further improving the accuracy of the control over the execution end.
[0145] To facilitate understanding, a specific example is provided below to illustrate the control method for the execution end provided in this application.
[0146] In network control processes, packet loss and out-of-order issues can easily occur when the controller (i.e., the control terminal of this application) continuously controls the actuator (execution terminal), leading to problems such as the actuator failing to execute or executing repeatedly. Existing technologies typically address this by: retransmitting control packets, adding packet sequence numbers, extending the transmission interval, and ensuring that the actuator does not execute previous control commands upon receiving new ones (determined by packet sequence numbers).
[0147] However, the above method has the following exemplary disadvantages: (1) Retransmission may make the network environment quality worse, thereby aggravating packet loss and out-of-order problems; (2) Extending the transmission interval will likely cause significant lag in the execution of the executor; (3) Increasing the packet sequence number will cause the executor to discard the previous command after receiving the later command, which can solve the problem of repeated execution, but will increase the probability of intermediate command loss.
[0148] The problem described above is mainly caused by the loss and out-of-order delivery of control packets when the network environment fluctuates. Currently available measures cannot simultaneously solve the problems of packet loss, out-of-order delivery, and deterioration of network quality (increased number of packets during continuous control).
[0149] Considering that the number of data packets (also known as over-the-air packets) in the network environment at any given time is negatively correlated with network quality, the arrival of control packets at the actuator can be guaranteed by reducing the number of control packets in the network environment at any given time. The method provided in this specific example, while adapting the packet sending interval, will include information from the previous control packet (the information being the control instructions encapsulated within the control packet) if it cannot be guaranteed that the previous control packet has arrived at the actuator. This reduces the number of control packets (to avoid network quality deterioration) while simultaneously ensuring the order of control instructions and compensating for lost instructions.
[0150] It should be emphasized that this specific example is mainly applicable to scenarios where control commands are continuously sent over a network and are sensitive to changes in timing and state, such as controlling drone performances or controlling lighting schedules. For example, the applicable scenarios for this specific example can be summarized as: controller > Ethernet / WiFi / Zigbee, etc. > actuator. The design principles of this specific example include the following three points:
[0151] First, control the packet sending interval to reduce the number of data packets in the network environment at the same time;
[0152] Secondly, by using a control command caching method, control packets are merged to reduce the number of data packets that need to be sent.
[0153] Thirdly, the current control packet can contain information from the previous control packet, so there is no need to resend the control packet.
[0154] For example, in Figure 4 The controller in the scenario shown executes... Figure 5 The process shown implements control over the actuator:
[0155] S501: The controller detects that the user has started control, triggers the sending of a detection packet and continuously records control command information.
[0156] The controller adds a command sequence number (the actuator executes the control command information sequentially according to the sequence number) and a time interval (execution is based on the command interval, i.e. the target packet sending interval in this application) to the control command information (also known as control command record, i.e. control instructions in this application), so that multiple control command information can be continuously recorded and merged, and used by the controller for continuous recording and sending.
[0157] S502: The controller obtains the minimum link quality from itself to the actuator and sends multiple detection packets simultaneously; obtains the average round-trip time of the multiple detection packets and calculates the packet loss rate of the detection packets; and calculates the minimum transmission interval T.
[0158] After the controller sends a control packet, the actuator will return an ACK corresponding to that control packet to the controller. Based on the ACK of the previous control packet, the controller can obtain the round-trip time and packet loss rate of the control packet in the current network environment.
[0159] The controller calculates the initial packet transmission interval, and then calculates a new packet transmission interval based on the round-trip time and packet loss rate of subsequent control packets, dynamically adjusting the packet transmission interval accordingly. The calculated packet transmission interval is the minimum transmission interval T mentioned above.
[0160] The initial control packet is sent by calculating the packet transmission interval, which is the time period nT (where n is a non-zero natural number) from the start of triggering to the first packet transmission interval. In other words, the first control packet (i.e., the initial control packet) will only be sent after the interval from the start of triggering is n times the calculated packet transmission interval. This accumulation of control command information within these n packet transmission intervals reserves a window for subsequent dynamic packet transmission intervals. Even if subsequent control packets are not sent to the actuator in a timely manner, the actuator still has control command information to continue executing, preventing any lag.
[0161] S503: The controller waits for the length of time NT to record control command information; for example, command number 1 + control information + ... command number n + control information.
[0162] S504: The controller sends control command information to the actuator.
[0163] It should be added that when the controller detects packet loss (i.e., when the ACK corresponding to the previous control packet has not been received by the time the control packet is sent), the current control packet sent will contain the control command information of the previous packet. Where the control command information contained in the current control packet does not include the last control command information currently stored by the controller, the last control command information contained in the current control packet is provided with an extended [custom] information section (i.e., the extended information in this application). The predicted value in the extended [custom] information section is based on the control command information contained in the current control packet, and is the instruction content that the actuator needs to continue executing after executing the last control command information. Therefore, if no next control packet is received before the actuator executes the last control command information contained in the current control packet, the actuator automatically triggers the execution of the instruction content contained in the extended [custom] information section.
[0164] S505: After receiving the control command information, the actuator returns the last command sequence number m and begins to parse the command and execute the control command information in sequence.
[0165] After receiving a control packet, the actuator replies with an ACK and stores the packets according to their sequence numbers. In this specific example, the transmission principle of the Go-Back-N ARQ protocol (continuous transmission + cumulative acknowledgment + backoff retransmission) is referenced for control packet transmission and acknowledgment. That is, after receiving a control packet, the actuator can return the last command sequence number m of the packet as an ACK to the controller. After receiving the ACK from the actuator, the controller knows that the actuator has received command sequence number m and the preceding control commands, and does not need to send command sequence number m and the preceding control command information again in subsequent control packet transmissions.
[0166] S506: The controller receives command sequence number m and clears the data before command sequence number m in the recorded control command information.
[0167] S507: The controller returns to step S504 after an interval T since the last transmission.
[0168] S508: The actuator has not received any more control command information and the process has ended.
[0169] To better understand this specific example, the following is in conjunction with the appendix. Figure 6 and Figure 7This paper describes the control command information sending and response process in two scenarios: normal sending of control command information and self-adjustment of packet interval due to network anomalies during the sending process.
[0170] Figure 6 This diagram illustrates the normal sending of control command information and execution of response processes when the network environment quality is relatively good.
[0171] Among them, C (controller) starts to act, continuously records control command information, and sends control command information (such as...) after 7T time. Figure 6 (1-14 in the text)
[0172] At approximately 7.5T, A (actuator) receives the control command information (1-14) and returns the last command number in the control command information, and begins to execute the control information command;
[0173] When C (controller) receives the return from A (actuator) at 8T, it clears the command sequence number and the previous control command information (1-14), retains 15-16 and sends it to A (actuator) in sequence until A (actuator) no longer receives control command information.
[0174] Figure 7 This diagram illustrates the process of dynamically adjusting the sending interval and triggering command retransmission when the network environment quality fluctuates.
[0175] Among them, C (controller) starts to act, continuously records control command information, and sends control command information (such as...) after 7T time. Figure 7 (1-14 in the text)
[0176] At approximately 7.5T, A (actuator) receives the control command information (1-14) and returns the last command number in the control command information, and begins to execute the control command information;
[0177] When C (controller) receives the return from A (actuator) at 8T, it clears the command sequence number and the previous control command information (1-14), retains 15-16 and sends it (normal transmission and reception).
[0178] A (actuator) receives the control command information (15-16) at approximately 8.5T and returns the last command sequence number in the control command information;
[0179] When C (controller) receives the return from A (actuator) at 9T, it clears the command sequence number and the previous control command information (15-16), retains 17-18 and sends it;
[0180] A (actuator) receives the control command information (17-18) at approximately 9.5T and returns the last command sequence number in the control command information;
[0181] When C (controller) does not receive a return from A (actuator) at 10T, it sends control command information (17-20) (but does not receive the returned command sequence number).
[0182] A (actuator) receives the control command information (17-20) at approximately 10.5T and returns the last command sequence number in the control command information;
[0183] At time 11T, C (controller) receives the return from A (actuator) at time 9T, clears the command sequence number and the previous control command information (17-18), retains 19-22 and sends it;
[0184] A (actuator) did not receive control command information at 11.5T, and continued to execute the control command information previously received;
[0185] If C (controller) does not receive a return from A (actuator) for a long time, it determines that the network environment quality has deteriorated, that is, the network status of the wireless network has changed. It adjusts the transmission interval to 2T and sends the control command information (19-26) at 13T (increasing the transmission interval to 2T).
[0186] When the network environment improves,
[0187] A (actuator) receives control command information (19-26) at 14T and returns the last command sequence number in the control command information;
[0188] When C (controller) receives the return from A (actuator) at 10.5T at 15T, it clears the command sequence number and the previous control command information (19-20), retains 21-30 and sends it;
[0189] A (actuator) receives control command information (21-30) at 16T and returns the last command sequence number in the control command information;
[0190] C (controller) receives the return from A (actuator) at 16T before 17T, clears the command sequence number and the previous control command information (21-30), retains 31-34 and sends it;
[0191] A (actuator) receives control command information (31-34) at 17.5T and returns the last command sequence number in the control command information;
[0192] C (controller) receives a return from A (actuator) at 17.5T before 19T, clears the command sequence number and previous control command information (31-34), retains 35-38 and sends it;
[0193] A (actuator) receives control command information (35-38) at 19.5T and returns the last command sequence number in the control command information.
[0194] When the network environment improves again, C (controller) detects that the RTT from C to A has decreased, determines that the network environment quality has improved, restores the transmission interval, and sends control command information (39-40) at 20T (restores the transmission interval to T).
[0195] Corresponding to the above method embodiments, this application also provides a control device for the execution end, applied to the control end, such as... Figure 8 As shown, the device includes:
[0196] The instruction generation module 810 is used to continuously generate and cache various control instructions in response to enabling control of the execution end; wherein the control instructions include instruction content and sequence numbers used to characterize the execution order of the instructions;
[0197] The instruction selection module 820 is used to select the control instruction to be executed by the execution end from the currently cached control instructions according to a predetermined selection method whenever a packet transmission time is reached; wherein, the predetermined selection method includes: if the packet transmission time is not the first packet transmission time, and the acknowledgment packet of the previous control packet is not received, then the control instruction used to encapsulate the previous control packet is selected, and at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions;
[0198] The instruction encapsulation module 830 is used to encapsulate the selected control instructions into control packages;
[0199] The instruction sending module 840 is used to send the encapsulated control packet to the execution end, so that after receiving the control packet, the execution end can send back an acknowledgment packet of the received control packet, and respond to the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
[0200] Optionally, in one implementation, the predetermined selection method further includes:
[0201] If the packet sending time is the first packet sending time, select at least one control instruction that has not been selected before according to the sequence number in the currently cached control instructions; and if the packet sending time is not the first packet sending time, in response to the receipt of the acknowledgment packet of the previous control packet, select at least one control instruction that has not been selected before according to the sequence number in the currently cached control instructions.
[0202] Optionally, in one implementation, the packet sending times other than the first packet sending time are determined based on the target packet sending interval; wherein the target packet sending interval is not less than the round-trip time of any air packet between the control end and the execution end.
[0203] Optionally, in one implementation, the method for determining the first packet sending time includes: determining the time after a predetermined duration from the first moment as the first packet sending time; wherein, the first moment is the moment when control over the execution terminal is started, and the predetermined duration is a specified multiple of the target packet sending interval;
[0204] Accordingly, if the packet sending time is the first packet sending time, the control instructions that have not been selected are selected according to the sequence number in the currently cached control instructions, including: if the packet sending time is the first packet sending time, the control instructions generated in the time period between the first time and the first packet sending time are selected from the currently cached control instructions.
[0205] Optionally, in one implementation, the apparatus further includes:
[0206] The monitoring module is used to respond to sending the encapsulated control packet to the execution terminal, monitor whether an acknowledgment packet of the currently sent control packet is received within the target packet sending interval; if an acknowledgment packet is received, the control instruction encapsulated in the currently sent control packet is deleted from the currently cached control instructions;
[0207] Accordingly, selecting the control instruction to be encapsulated in the previous control package includes: determining the previously selected control instruction from the currently cached control instructions, and obtaining the control instruction to be encapsulated in the previous control package.
[0208] Optionally, in one implementation, the acknowledgment packet of any control packet carries the maximum sequence number of the sequence number in the control instruction encapsulated in the control packet; the step of deleting the control instruction encapsulated in the currently sent control packet from the currently cached control instructions upon receipt includes: deleting the control instruction with a sequence number not greater than the target sequence number from the currently cached control instructions upon receipt; wherein, the target sequence number is the sequence number carried in the acknowledgment packet of the currently sent control packet.
[0209] Optionally, in one implementation, the instruction encapsulation module 830 is specifically used for:
[0210] If the selected control instructions do not include the last control instruction in the current cache, add extended information to the control instruction with the largest sequence number among the selected control instructions; wherein, the extended information is: the estimated instruction content that the execution end needs to respond to after executing the control instruction with the largest sequence number;
[0211] After adding extended information, the currently selected control commands are encapsulated to obtain a control package;
[0212] Accordingly, the execution end is also configured to respond to the extended information in the last control instruction after responding to the instruction content of the last control instruction, since the last control instruction carries extended information.
[0213] Optionally, in one implementation, each control instruction further carries first duration information, which characterizes the duration of the response to the instruction content carried by the control instruction; correspondingly, the execution end responds to the instruction content of the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet, including:
[0214] The execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions and the first duration information; or, each control instruction other than the first control instruction generated also carries second duration information, which is used to characterize the time of responding to the instruction content carried by the control instruction, compared to the interval of the reference time, which is the time of responding to the instruction content in the previous control instruction.
[0215] Accordingly, the execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions, including:
[0216] The execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions encapsulated in the received control packet and the second duration information carried by each control instruction except for the first control instruction.
[0217] Optionally, in one implementation, the method for determining the target packet sending interval includes:
[0218] In response to the satisfaction of any of the predetermined conditions, the round-trip time of each air packet between the control end and the execution end and the target packet loss rate are determined.
[0219] Based on the obtained round-trip time and target packet loss rate, calculate the target packet sending interval;
[0220] The predetermined determination conditions include one or more of the following sub-conditions:
[0221] The network state of the wireless network between the execution end and the control end has changed.
[0222] Control over the execution end has been detected.
[0223] Optionally, in one implementation, the target packet loss rate is determined by:
[0224] The time range for transmitting each air packet is divided into multiple detection periods. For each detection period, the packet loss rate within that period is calculated, and the maximum value among the packet loss rates corresponding to multiple detection periods is selected as the target packet loss rate.
[0225] This application also provides an electronic device, such as... Figure 9 As shown, it includes:
[0226] Memory 901 is used to store computer programs;
[0227] When the processor 902 executes the program stored in the memory 901, it implements the control method for the execution end described in any of the above embodiments.
[0228] Furthermore, the aforementioned electronic device may also include a communication bus and / or a communication interface, with the processor 902, communication interface, and memory 901 communicating with each other via the communication bus.
[0229] The communication bus mentioned in the above electronic devices can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into address bus, data bus, control bus, etc. For ease of illustration, only one thick line is used to represent it in the diagram, but this does not mean that there is only one bus or one type of bus.
[0230] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0231] The memory may include random access memory (RAM) or non-volatile memory (NVM), such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0232] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0233] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores a computer program that, when executed by a processor, implements the steps of any of the control methods for the execution end described above.
[0234] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the control methods for the execution end described in the above embodiments.
[0235] In the above embodiments, implementation can be achieved entirely or partially through software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented entirely or partially in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a solid-state drive (SSD), etc.
[0236] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
[0237] The various embodiments in this specification are described in a related manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the device embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0238] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application are included within the scope of protection of this application.
Claims
1. A control method for the execution end, characterized in that, Applied to the control terminal, the method includes: In response to enabling control over the execution end, control instructions are continuously generated and cached; wherein, the control instructions include instruction content and sequence numbers used to characterize the execution order of the instructions; Whenever a packet transmission time is reached, the control instruction to be executed by the execution end is selected from the currently cached control instructions according to a predetermined selection method; wherein, the predetermined selection method includes: if the packet transmission time is not the first packet transmission time, and the acknowledgment packet of the previous control packet is not received, then the control instruction used to encapsulate the previous control packet is selected, and at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions; The selected control commands are encapsulated into a control package; The encapsulated control packet is sent to the execution terminal so that after receiving the control packet, the execution terminal sends back an acknowledgment packet of the received control packet, and responds to the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
2. The method according to claim 1, characterized in that, The predetermined selection method also includes: If the packet sending time is the first packet sending time, select at least one control instruction that has not been selected before, according to the sequence number in the currently cached control instructions; Additionally, if the packet transmission time is not the first packet transmission time, in response to the receipt of the acknowledgment packet of the previous control packet, at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions.
3. The method according to claim 1, characterized in that, The packet transmission times, excluding the first packet transmission time, are determined based on the target packet transmission interval; wherein the target packet transmission interval is not less than the round-trip time of any air packet between the control end and the execution end.
4. The method according to claim 2, characterized in that, The methods for determining the timing of the first packet transmission include: The first packet transmission moment is determined from the moment of the first moment after a predetermined time; wherein, the first moment is the moment when control over the execution terminal is initiated, and the predetermined time is a specified multiple of the target packet transmission interval; Accordingly, if the packet transmission time is the first packet transmission time, the control instruction that has not been selected before is selected according to the sequence number in the currently cached control instructions, including: If the packet sending time is the first packet sending time, select the control instructions generated during the time period between the first time and the first packet sending time from the currently cached control instructions.
5. The method according to any one of claims 1-4, characterized in that, The method further includes: In response to sending the encapsulated control packet to the execution terminal, monitor whether an acknowledgment packet for the currently sent control packet is received within the target packet sending interval. Upon receiving the control instruction, delete the control instruction encapsulated in the currently sent control packet from the currently cached control instructions; Accordingly, the control instructions used to encapsulate in the preceding control package are selected, including: From the currently cached control instructions, determine the control instructions that have been selected, and obtain the control instructions to be encapsulated in the previous control packet.
6. The method according to claim 5, characterized in that, The confirmation packet of any control packet carries the maximum sequence number of the sequence number in the control instruction encapsulated in that control packet; Upon receiving the received command, the step of deleting the control command encapsulated in the currently sent control packet from the currently cached control commands includes: Upon receipt, delete control instructions in the currently cached control instructions that have a sequence number not greater than the target sequence number; wherein, the target sequence number is the sequence number carried in the acknowledgment packet of the currently sent control packet.
7. The method according to any one of claims 1-4, characterized in that, The process of encapsulating the selected control commands into a control package includes: If the selected control instructions do not include the last control instruction in the current cache, add extended information to the control instruction with the largest sequence number among the selected control instructions; wherein, the extended information is: the estimated instruction content that the execution end needs to respond to after executing the control instruction with the largest sequence number; After adding extended information, the currently selected control commands are encapsulated to obtain a control package; Accordingly, the execution end is also configured to respond to the extended information in the last control instruction after responding to the instruction content of the last control instruction, since the last control instruction carries extended information.
8. The method according to any one of claims 1-4, characterized in that, Each control command also carries first duration information, which characterizes the duration of the response to the command content carried by the control command. Correspondingly, the execution terminal responds to the command content of the control command encapsulated in the received control packet according to the sequence number of the control command encapsulated in the received control packet, including: The execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions and the first duration information. or, Each control instruction other than the first control instruction generated also carries second duration information, which is used to characterize the time of response to the instruction content carried by the control instruction, compared to the interval duration of the reference time, which is the time of response to the instruction content in the previous control instruction. Accordingly, the execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions, including: The execution end responds to the control instructions encapsulated in the received control packet according to the sequence number of the control instructions encapsulated in the received control packet and the second duration information carried by each control instruction except for the first control instruction.
9. The method according to claim 3, characterized in that, The method for determining the target packet sending interval includes: In response to the satisfaction of any of the predetermined conditions, the round-trip time of each air packet between the control end and the execution end and the target packet loss rate are determined. Based on the obtained round-trip time and target packet loss rate, calculate the target packet sending interval; The predetermined determination conditions include one or more of the following sub-conditions: The network state of the wireless network between the execution end and the control end has changed. Control over the execution end has been detected.
10. The method according to claim 9, characterized in that, Methods for determining the target packet loss rate include: The time range for transmitting each air packet is divided into multiple detection periods; For each detection period, calculate the packet loss rate within that period, and select the maximum value among the packet loss rates corresponding to multiple detection periods as the target packet loss rate.
11. A control device for an actuator, characterized in that, The device, applied to the control terminal, includes: The instruction generation module is used to continuously generate and cache various control instructions in response to the activation of control over the execution end; wherein, the control instructions include instruction content and sequence numbers used to characterize the execution order of the instructions; The instruction selection module is used to select the control instruction to be executed by the execution end from the currently cached control instructions according to a predetermined selection method whenever a packet transmission time is reached; wherein, the predetermined selection method includes: if the packet transmission time is not the first packet transmission time, and the acknowledgment packet of the previous control packet is not received, then the control instruction used to encapsulate the previous control packet is selected, and at least one control instruction that has not been selected is selected according to the sequence number in the currently cached control instructions; The instruction encapsulation module is used to encapsulate the selected control instructions into control packages; The instruction sending module is used to send the encapsulated control packet to the execution terminal, so that after receiving the control packet, the execution terminal will send back an acknowledgment packet of the received control packet, and respond to the control instruction encapsulated in the received control packet according to the sequence number of the control instruction encapsulated in the received control packet.
12. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor, when executing a program stored in memory, implements the method described in any one of claims 1-10.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method described in any one of claims 1-10.