A task communication method and device
By sending waiting-to-receive status information in the task communication method and canceling and replacing tasks as needed, the problems of complex task status management and server jamming in the existing technology are solved, and task communication and simple state machine switching under multi-task and multi-target are realized.
Patent Information
- Application Number
- CN201810701579.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-06-29
- Publication Date
- 2025-10-21
- Estimated Expiration
- 2038-06-29
AI Technical Summary
In the prior art, task status management is complex, status switching is tedious, and errors are prone to occur. In addition, receiving multiple tasks at a time leads to frequent communications and server freezes.
A task communication method is adopted, including sending waiting status information, receiving tasks or task lists, executing tasks and canceling the executing tasks when new tasks are received, sending completed status information, and sending waiting status information again after confirming completion.
It realizes task communication in multi-task and multi-target situations, avoids server jamming, simplifies the state machine state logic, simplifies the switching process, and is more robust.
Smart Images

Figure CN110659113B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a task communication method and device. Background Art
[0002] Currently, task status management and communication are primarily implemented using actionlib in the Robot Operating System (ROS). actionlib is a crucial feature set within ROS. Although ROS provides a service mechanism to address request-response scenarios, it can be challenging to implement a request that takes a long time to execute. During this time, if a user wants to check the progress or cancel the request, the service mechanism cannot fulfill this requirement. However, actionlib can address this need. For example, in the rapidly developing autonomous driving technology, task status communication is largely unavailable in autonomous vehicle decision-making and control. Therefore, actionlib is widely used for task status management and communication.
[0003] In the process of implementing the present invention, the inventors discovered that the prior art has at least the following problems:
[0004] 1. In the prior art, receiving multiple tasks at once results in frequent communication, loss of task information, and even a freeze of the entire server, making it impossible to proceed with the task.
[0005] 2. In task state management, the state logic of the state machine is complex, state switching is cumbersome, and errors are prone to occur during the switching process. Summary of the Invention
[0006] In view of this, an embodiment of the present invention provides a task communication method and device, which can solve the problem of frequent communication, loss of task information, and even the freezing of the entire server after receiving multiple tasks at one time, as well as the problem of complex state machine state logic, cumbersome switching, and easy errors during state switching.
[0007] To achieve the above-mentioned purpose, according to one aspect of an embodiment of the present invention, a task communication method is provided, including: sending status information waiting to be received; receiving tasks or task lists; executing the tasks or task lists, and if a new task or task list is received while executing a task or task list, canceling the execution of the task or task list being executed and executing the new task or task list; after all tasks or task lists are executed, sending completed status information; after confirming that the completed status information has been delivered, sending the waiting status information again.
[0008] Optionally, the method further includes: when executing a task or a task list, sending status information of the task being executed by broadcasting; sending status information waiting to be received and the completed status information by broadcasting.
[0009] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a method for sending tasks is provided, comprising: after receiving status information of waiting to be received or status information of executing a task, sending a task or a task list; after receiving status information of executing a task, the sent task or task list will replace the executing task or task list and be executed by the server; after receiving completed status information, feedback of delivered status information.
[0010] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a task communication method is provided, including: the server sends status information of waiting to be received; after the client receives the status information of waiting to be received, it sends a task or a task list; the server receives the task or the task list and executes the task or the task list; if the server receives a new task or task list while executing the task or the task list, the execution of the task or task list being executed is canceled and the new task or task list is executed; when all tasks or task lists are executed, the completed status information is sent; after the client receives the completed status information, it feeds back the delivered status information; after the server receives the delivered status information, it sends the waiting to be received status information again.
[0011] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a state switching method of a state machine is provided, including: when a task or a task list is received, the state machine switches from a waiting to receive state to a task executing state; when all tasks or task lists have been executed, the state machine switches from a task executing state to a completed state; when it is confirmed that the completed status information has been delivered, the state machine switches from the completed state back to the waiting to receive state.
[0012] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a task communication device is provided, including: a preparation module, a task receiving module, a task execution module, and a delivery confirmation module; the preparation module is used to send status information waiting to be received; the task receiving module is used to receive tasks or task lists; the task execution module is used to execute the tasks or task lists, and if a new task or task list is received while executing a task or task list, the execution of the task or task list being executed is canceled and the new task or task list is executed; when all tasks or task lists are executed, the completed status information is sent; the delivery confirmation module is used to send the status information waiting to be received again after confirming that the completed status information has been delivered.
[0013] Optionally, the task execution module is also used to: when executing a task or a task list, send status information of the task being executed by broadcasting; send the completed status information by broadcasting; the preparation module is also used to: send status information waiting to be received by broadcasting.
[0014] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, a device for sending tasks is provided, including: a sending module and a feedback module; the sending module is used to: send a task or a task list after receiving status information of waiting to be received or status information of a task being executed; wherein, after receiving status information of a task being executed, the sent task or task list will replace the task or task list being executed and be executed by the server; the feedback module is used to: after receiving completed status information, feedback the delivered status information.
[0015] To achieve the above purpose, according to another aspect of an embodiment of the present invention, a task communication system is provided, which includes: a state machine provided by an embodiment of the present invention, a task communication device provided by an embodiment of the present invention, and a device for sending tasks provided by an embodiment of the present invention.
[0016] To achieve the above-mentioned purpose, according to another aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the task communication method provided in an embodiment of the present invention.
[0017] To achieve the above object, according to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the task communication method provided by an embodiment of the present invention is implemented.
[0018] An embodiment of the above invention has the following advantages or beneficial effects: at any time during the execution of a task or task list, a new task or task list can be received, and the new task or task list can directly replace the task or task list being executed, thereby modifying the existing mechanism for receiving task goals. This solves the problem in the prior art of using actionlib technology for task communication of unmanned equipment, which easily causes the server to get stuck after receiving multiple tasks at one time. This realizes task communication in the case of multiple tasks and multiple targets, and can arbitrarily switch to execute new tasks or task lists in the case of multiple tasks and multiple targets, with strong robustness.
[0019] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are provided for a better understanding of the present invention and are not intended to limit the present invention.
[0021] Figure 1 This is a flowchart of implementing task communication using actionlib on ROS in the prior art.
[0022] Figure 2 This is a schematic diagram of the state machine and switching method of the actionlib server in the prior art.
[0023] Figure 3 FIG. 4 is a schematic diagram of a basic process of a task communication method according to an embodiment of the present invention.
[0024] Figure 4 FIG. 4 is a schematic diagram of a task management state machine according to an embodiment of the present invention.
[0025] Figure 5 2 is a schematic diagram of a preferred flow chart of a task communication method according to an embodiment of the present invention.
[0026] Figure 6 is a schematic diagram of basic modules of a task communication device according to an embodiment of the present invention;
[0027] Figure 7 is an exemplary system architecture diagram in which embodiments of the present invention may be applied;
[0028] Figure 8 It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following description of exemplary embodiments of the present invention is made in conjunction with the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding. These details should be considered as merely exemplary. Therefore, it should be appreciated by those skilled in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0030] State machine: A tool used to model object behavior. Its main function is to describe the sequence of states that an object goes through during its life cycle and how it responds to various events from the outside world.
[0031] Robustness: The ability of a control system to maintain a certain performance indicator unchanged under a certain type of disturbance, including disturbances of its own model, that is, strong anti-interference ability.
[0032] State information: data indicating that the system is in a certain state.
[0033] Figure 1 This is a flowchart of the existing technology using actionlib on ROS to achieve task communication. Figure 1 As shown in the figure, "new task" (goal) means sending a new task to the server; "cancel" means sending a cancel command to the server; "status" means notifying the client of the current status of all tasks in the system; "feedback" means periodically sending auxiliary information about the current task to the client; and "result" means sending a result message to the client once the task is completed. The action client sends a task to the action server, which then provides feedback on the status of all tasks in the system, along with auxiliary information about the current task, and sends a result message to the client after the task is completed. At any point during this process, the action client can also cancel the task by sending a "cancel" command to the action server.
[0034] Figure 2 This is a schematic diagram of the state machine and switching mode of the actionlib server in the prior art. Figure 2 As shown, the meaning of each state is explained as follows:
[0035] The intermediate states of a task include:
[0036] Pending means that the task has not been executed by the action server yet and is in a pending state.
[0037] Active means that the task is being executed by the action server and is in the active state.
[0038] Recalling means that the task has not been executed by the action server yet, but a request to cancel the task has been received from the action client. However, the action server has not yet confirmed that the task has been canceled and is in the recalling state.
[0039] Preempting means that the task is being executed by the action server and a request to cancel the task is received from the action client. However, the action server has not yet confirmed that the task has been canceled and is in the task canceling state.
[0040] The terminal states of the task include:
[0041] Rejected indicates that the task was rejected by the action server before execution and does not require a cancellation request from the action client.
[0042] Succeeded means that the task has been successfully executed by the action server.
[0043] Aborted means that the task was terminated by the action server during execution without a cancellation request from the action client.
[0044] Recalled means that the task was canceled by other tasks or by a cancellation request from the action client before execution.
[0045] Preempted indicates that the task was canceled by another task or by a cancellation request from the action client while it was executing.
[0046] When a task is passed to the action server, the action server creates a state machine to manage the tasks. All tasks must enter the terminated state before the next task can be processed. Both the server and client state machines are very complex. Furthermore, if a task fails to reach the terminated state on the action server due to improper operation, for example, the action server may receive a cancellation request and simultaneously receive a new task. If the new task has not yet been executed by the action server, the server's state machine will be unable to confirm whether it is pending or canceled. This will directly cause the entire action server to freeze, making it impossible to proceed with the task.
[0047] Figure 3 FIG. 1 is a schematic diagram of the basic process of the task communication method according to an embodiment of the present invention. Figure 3 As shown, an embodiment of the present invention provides a task communication method, including:
[0048] Step S301. Sending status information waiting to be received;
[0049] Step S302. Receive a task or a task list;
[0050] Step S303: Execute the task or task list. If a new task or task list is received while executing a task or task list, cancel the task or task list being executed and execute the new task or task list. After all tasks or task lists are executed, send a completed status message.
[0051] Step S304: After confirming that the completed status information has been delivered, the status information waiting to be received is sent again.
[0052] The completed status information is divided into task completed and task list completed. When executing a task, if a new task is received, the current task is canceled and the new task is executed. After all tasks are completed, the task completed status information is sent to indicate that the received task has been completed. When traversing a task list, if a new task list is received, the current task list is canceled and the new task list is traversed. After all tasks in the task list are executed, the task list completed status information is sent to indicate that all tasks in the received task list have been completed.
[0053] Send waiting-for-receiving status information to indicate that the server is in waiting-for-receiving status.
[0054] The embodiments of the present invention can be applied to mission communication of unmanned equipment, which may include but is not limited to unmanned vehicles and drones.
[0055] The embodiment of the present invention can receive a new task or task list at any time during the execution of a task or task list, and directly replace the task or task list being executed with the new task or task list, thereby solving the problem in the prior art of using actionlib technology for task communication of unmanned equipment, which easily causes the server to get stuck after receiving multiple tasks at one time. It realizes task communication in the case of multiple tasks and multiple targets, and can arbitrarily switch to execute new tasks or task lists in the case of multiple tasks and multiple targets.
[0056] In an embodiment of the present invention, the method further includes: while executing a task or task list, broadcasting status information about the task being executed; and broadcasting status information about pending receipt and completed status information. The status information about the task being executed is transmitted to indicate that the server is in the task execution state. Broadcasting status information allows the status information to be sent to multiple targets, allowing multiple tasks to be received simultaneously, thus enabling task communication in a multi-task, multi-target environment.
[0057] An embodiment of the present invention provides a method for sending tasks, comprising: sending a task or a task list upon receiving status information indicating a pending task or a currently executing task; upon receiving status information indicating a currently executing task, the sent task or task list replaces the currently executing task or task list and is executed by the server; and upon receiving status information indicating a completed task, providing feedback regarding the delivered status information. This embodiment of the present invention can send multiple tasks simultaneously, enabling multi-task, multi-target task communication. Upon receiving status information, corresponding feedback is provided, enabling better coordination between server and client communication and detecting any communication failures.
[0058] An embodiment of the present invention provides a task communication method, comprising: a server sends a waiting-to-receive status message; a client sends a task or a task list after receiving the waiting-to-receive status message; the server receives the task or task list and executes the task or task list; if the server receives a new task or task list while executing a task or task list, the server cancels the currently executing task or task list and executes the new task or task list; after all tasks or task lists are executed, the server sends a completed status message; after receiving the completed status message, the client feeds back a delivered status message; after receiving the delivered status message, the server again sends a waiting-to-receive status message. This method solves the problem in the prior art of using actionlib technology for task communication of unmanned equipment, where the server is prone to freezing after receiving multiple tasks at once, realizes task communication in a multi-task and multi-target situation, and allows the server to arbitrarily switch to execute a new task or task list in a multi-task and multi-target situation.
[0059] An embodiment of the present invention provides a task management state machine, wherein the states of the state machine include: a waiting state, a task executing state, and a completed state. The waiting state indicates that the state is currently waiting to receive a task or a task list; the task executing state indicates that the state is currently executing a task or a task list; and the completed state indicates that all received tasks or task lists have been executed. The state machine in this embodiment of the present invention not only meets the task state management function, but also has a more concise state logic.
[0060] In an embodiment of the present invention, the state machine can switch states in the following manner: when a task or task list is received, the state machine switches from the waiting-to-receive state to the executing-task state; when all tasks or task lists have been completed, the state machine switches from the executing-task state to the completed state; and when it is confirmed that the completed status information has been delivered, the state machine switches from the completed state back to the waiting-to-receive state. While satisfying the task state management function, the state machine in the embodiment of the present invention has a more concise state logic and simple switching logic, thus avoiding the problem of easy errors during the state switching process.
[0061] Figure 4 FIG is a schematic diagram of a task management state machine according to an embodiment of the present invention. Figure 4As shown, READY_TO_GO indicates that the system is currently waiting to receive a task or task list (i.e., waiting to receive); EXECUTING indicates that the system is currently executing a task or task list (i.e., executing the task). GOAL_ARRIVED indicates that the system is currently in a state where all tasks or task lists have been completed (i.e., completed). GOALS indicates the task or task list currently published by the client to the server; ARRIVED_ROGER indicates that the client has detected a completed state.
[0062] Figure 5 FIG. 1 is a schematic diagram of a preferred flow chart of a task communication method according to an embodiment of the present invention. Figure 4 and Figure 5 When the system has not received any tasks or task lists, the server will regularly notify the client that it is currently waiting to receive tasks or task lists, awaiting the client's request. Upon detecting the ready state, the client will send the task or task list to the server. Upon receiving the task or task list, the server will regularly broadcast that the system is currently executing the task or task list. At any time during the execution phase, the client can send a new task or task list to the server to replace the previous one. After the system has completed all tasks or task lists, the server will broadcast a completed status. Upon detecting completion, the client will send a delivered status to the server, confirming that the task or task list has been completed. Upon receiving the delivered status, the server will broadcast the ready state and await new tasks or task lists.
[0063] According to the task communication method of an embodiment of the present invention, in the application of the unmanned vehicle driving field, a target destination is sent to the unmanned vehicle (the server receives the task), and the vehicle's server will plan a route to the destination and drive along this route to the destination (the server executes the task). If a new target point is sent to the unmanned vehicle during driving (the server receives a new task during the execution of the task), the trajectory planned for the previous target point will be replaced by the trajectory planned for the new target point, and the vehicle will continue to drive along the trajectory planned at the new target point (the server executes the newly received task). Task communication is realized in a multi-tasking situation, and in this case, it is possible to switch to a new task or task list for execution at will.
[0064] Figure 6 FIG is a schematic diagram of the basic modules of the task communication device according to an embodiment of the present invention. Figure 6As shown, an embodiment of the present invention provides a task communication device 600, comprising: a preparation module 601, a task receiving module 602, a task execution module 603, and a delivery confirmation module 604. The preparation module 601 is configured to send a waiting status message; the task receiving module 602 is configured to receive a task or task list; the task execution module 603 is configured to execute the task or task list. If a new task or task list is received while the task or task list is being executed, the task or task list being executed is canceled and the new task or task list is executed; after all tasks or task lists are executed, a completed status message is sent; and the delivery confirmation module 604 is configured to, after confirming that the completed status message has been delivered, resend the waiting status message. This solves the problem in the prior art of server freezing after receiving multiple tasks at once, realizes task communication in a multi-task and multi-target situation, and allows for arbitrary switching to new tasks or task lists in a multi-task and multi-target situation.
[0065] In this embodiment of the present invention, the task execution module 603 is further configured to: when executing a task or task list, broadcast status information about the task being executed; and broadcast status information about the task being completed. The preparation module 601 is further configured to broadcast status information about the task waiting to be received. Broadcasting status information allows the status information to be sent to multiple targets, allowing multiple tasks to be received simultaneously, thus enabling task communication in a multi-task, multi-target environment.
[0066] An embodiment of the present invention provides a device for sending tasks, comprising a sending module and a feedback module. The sending module is configured to send a task or a task list upon receiving status information indicating a task is waiting to be received or a task is currently being executed. Upon receiving status information indicating a task is currently being executed, the sent task or task list replaces the currently being executed task or task list and is executed by the server. The feedback module is configured to provide feedback regarding the status information after receiving completed status information. This embodiment of the present invention can send multiple tasks simultaneously, enabling multi-task and multi-target task communication. Upon receiving status information, corresponding feedback is provided, enabling better coordination between the server and client, while also detecting whether a communication failure has occurred.
[0067] Another aspect of the present invention provides a task communication system, comprising: a state machine according to an embodiment of the present invention; a task communication device according to an embodiment of the present invention; and a task sending device according to an embodiment of the present invention. This system solves the prior art problem of server freezing after receiving multiple tasks simultaneously, enabling task communication in a multi-task, multi-target environment. Furthermore, the system allows for arbitrary switching to new tasks or task lists in this multi-task, multi-target environment.
[0068] Figure 7 An exemplary system architecture 700 is shown to which the task communication method or task communication apparatus according to the embodiment of the present invention may be applied.
[0069] like Figure 7 As shown, system architecture 700 may include terminal devices 701, 702, 703, a network 704, and a server 705. Network 704 is used to provide a medium for communication links between terminal devices 701, 702, 703 and server 705. Network 704 may include various connection types, such as wired or wireless communication links or fiber optic cables.
[0070] Users can use terminal devices 701, 702, and 703 to interact with server 705 via network 704 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 701, 702, and 703, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc.
[0071] The terminal devices 701 , 702 , and 703 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0072] Server 705 may be a server that provides various services, such as a backend management server that supports shopping websites browsed by users using terminal devices 701, 702, and 703. The backend management server may analyze and process received data such as product information query requests, and feed back processing results, such as targeted push information, to the terminal devices.
[0073] It should be noted that the task communication method provided in the embodiment of the present invention is generally executed by the server 705 , and accordingly, the task communication device is generally provided in the server 705 .
[0074] It should be understood that Figure 7 The number of terminal devices, networks and servers in the embodiment is merely illustrative. Any number of terminal devices, networks and servers may be provided as required.
[0075] According to an embodiment of the present invention, the present invention further provides an electronic device and a computer-readable medium.
[0076] The electronic device of an embodiment of the present invention includes: one or more processors; a storage device for storing one or more programs, when the one or more programs are executed by the one or more processors, the one or more processors implement the task communication method provided by the embodiment of the present invention.
[0077] The computer-readable medium of the embodiment of the present invention stores a computer program, and when the program is executed by a processor, the task communication method provided by the embodiment of the present invention is implemented.
[0078] Reference below Figure 8 , which shows a schematic structural diagram of a computer system 800 of a terminal device suitable for implementing an embodiment of the present invention. Figure 8 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0079] like Figure 8 As shown, the computer system 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 802 or a program loaded from a storage unit 808 into a random access memory (RAM) 803. Various programs and data required for the operation of the system 800 are also stored in the RAM 803. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.
[0080] The following components are connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, and the like; an output section 807 including devices such as a cathode ray tube (CRT), a liquid crystal display (LCD), and a speaker; a storage section 808 including a hard disk; and a communication section 809 including a network interface card such as a LAN card or a modem. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, or a semiconductor memory, is installed in the drive 810 as needed, so that computer programs read therefrom can be installed into the storage section 808 as needed.
[0081] In particular, according to the embodiments disclosed in the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, the embodiments disclosed in the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program comprising program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network via the communication section 809, and / or installed from a removable medium 811. When the computer program is executed by the central processing unit (CPU) 801, the above-mentioned functions defined in the system of the present invention are performed.
[0082] It should be noted that the computer-readable medium described in the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of computer-readable storage media can include, but are not limited to, an electrical connection having one or more conductors, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In the present invention, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. This propagated data signal can take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. Program code embodied on a computer-readable medium may be transmitted using any suitable medium, including but not limited to wireless, wireline, optical fiber cable, RF, or any suitable combination thereof.
[0083] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the above-mentioned module, program segment, or a part of code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0084] The modules described in the embodiments of the present invention may be implemented in software or hardware. The modules described may also be provided within a processor. For example, they may be described as a processor comprising a preparation module, a task receiving module, a task execution module, and a delivery confirmation module. The names of these modules do not, in some cases, limit the modules themselves. For example, the preparation module may also be described as a "module for sending status information about waiting for reception."
[0085] As another aspect, the present invention further provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently and not be assembled into the device. The above computer-readable medium carries one or more programs. When the above one or more programs are executed by a device, the device includes the following steps: Step S301. Sending status information waiting to be received; Step S302. Receive a task or a task list; Step S303. Execute the task or task list. If a new task or task list is received while executing a task or task list, cancel the execution of the task or task list being executed and execute the new task or task list; After all tasks or task lists are executed, send completed status information; Step S304. After confirming that the completed status information has been delivered, send the status information waiting to be received again.
[0086] The embodiments of the present invention can receive a new task or task list at any time during the execution of a task or task list, and directly replace the currently executing task or task list with the new task or task list. This solves the problem of server freezing caused by receiving multiple tasks at once in the prior art, realizes task communication in a multi-task and multi-target environment, and can arbitrarily switch to executing a new task or task list in this multi-task and multi-target environment.
[0087] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may occur depending on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.
Claims
1. A task communication method, characterized in that: include: The unmanned vehicle sends status information waiting to be received; Receive multiple tasks or task lists sent at once; Executing the task or task list; if a new task or task list is received while executing the task or task list, canceling the currently executing task or task list and executing the new task or task list; sending a completed status message after all tasks or task lists have been executed; the completed status message includes the task completed and the task list completed; After confirming that the completed status information has been delivered, the waiting-for-receipt status information is sent again; Among them, each status information is sent to multiple targets in a broadcasting manner, including: when executing a task or a task list, the status information of the task being executed is sent in a broadcasting manner; the status information of waiting to be received and the completed status information are sent in a broadcasting manner, and the status information of the task being executed is sent to indicate that the server is in the state of executing the task; the task status of the unmanned vehicle is managed by the waiting to receive state, the executing task state, and the completed state of the state machine; the state machine switches states in the following manner, including: when a task or a task list is received, the state machine switches from the waiting to receive state to the executing task state; when all tasks or task lists have been executed, the state machine switches from the executing task state to the completed state; when it is confirmed that the completed status information has been delivered, the state machine switches from the completed state to the waiting to receive state again.
2. A method for sending a task, characterized in that: include: After receiving the status information of waiting to be received or the status information of executing tasks, multiple tasks or task lists are sent at one time; After receiving the status information of the task being executed, the sent task or task list will replace the task being executed or task list and be executed by the server; After receiving the completed status information, feedback the delivered status information; the completed status information includes that the task is completed and the task list is completed; Among them, the state information is sent to multiple targets in a broadcasting manner, including: when executing a task or a task list, the state information of the task being executed is sent in a broadcasting manner; the state information of waiting to be received and the completed state information are sent in a broadcasting manner, and the state information of the task being executed is sent to indicate that the server is in the state of executing the task; the task status of the unmanned vehicle is managed through the waiting to receive state, the executing task state, and the completed state of the state machine; The state machine switches states in the following manner, including: when a task or task list is received, the state machine switches from the waiting to receive state to the executing task state; when all tasks or task lists have been completed, the state machine switches from the executing task state to the completed state; when it is confirmed that the completed status information has been delivered, the state machine switches from the completed state back to the waiting to receive state.
3. A task communication method, characterized in that: include: The server sends a status message waiting to be received; After the client receives the waiting status information, it sends multiple tasks or task lists at once; The server receives a task or a task list and executes the task or the task list; if the server receives a new task or task list while executing a task or a task list, the server cancels the execution of the task or task list being executed and executes the new task or task list; after all tasks or task lists are executed, the server sends a completed status message; the completed status message includes that the task is completed and the task list is completed; After receiving the completed status information, the client feeds back the delivered status information; After receiving the delivered status information, the server resends the status information waiting to be received; Among them, the state information is sent to multiple targets in a broadcasting manner, including: when executing a task or a task list, the state information of the task being executed is sent in a broadcasting manner; the state information of waiting to be received and the completed state information are sent in a broadcasting manner, and the state information of the task being executed is sent to indicate that the server is in the state of executing the task, and the task status of the unmanned vehicle is managed through the waiting to receive state, the executing task state, and the task completed state of the state machine; The state machine switches states in the following manner, including: when a task or task list is received, the state machine switches from the waiting to receive state to the executing task state; when all tasks or task lists have been completed, the state machine switches from the executing task state to the completed state; when it is confirmed that the completed status information has been delivered, the state machine switches from the completed state back to the waiting to receive state.
4. A task communication device, characterized in that: include: Preparation module, task receiving module, task execution module, delivery confirmation module; The preparation module is used to: the unmanned vehicle sends status information waiting to be received; The task receiving module is used to: receive multiple tasks or task lists sent at one time; The task execution module is configured to: execute the task or task list; if a new task or task list is received while the task or task list is being executed, cancel the task or task list being executed and execute the new task or task list; after all tasks or task lists are executed, send a completed status message; the completed status message includes the task completed and the task list completed; The delivery confirmation module is configured to: upon confirming that the completed status information has been delivered, resend the status information waiting to be received; Among them, the state information is sent to multiple targets in a broadcasting manner, including: when executing a task or a task list, the state information of the task being executed is sent in a broadcasting manner; the state information of waiting to be received and the completed state information are sent in a broadcasting manner, and the state information of the task being executed is sent to indicate that the server is in the state of executing the task; the task status of the unmanned vehicle is managed through the waiting to receive state, the executing task state, and the completed state of the state machine; The state machine switches states in the following manner, including: when a task or task list is received, the state machine switches from the waiting to receive state to the executing task state; when all tasks or task lists have been completed, the state machine switches from the executing task state to the completed state; when it is confirmed that the completed status information has been delivered, the state machine switches from the completed state back to the waiting to receive state.
5. A device for sending tasks, characterized in that: include: Sending module and feedback module; The sending module is used to: after receiving the status information of waiting to be received or the status information of the task being executed, send multiple tasks or task lists at one time; After receiving the status information of the task being executed, the sent task or task list will replace the task being executed or the task list and be executed by the server; The feedback module is used to: after receiving the completed status information, feed back the delivered status information.
6. A task communication system, characterized in that: The system includes: the task communication device according to claim 4 and the task sending device according to claim 5.
7. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the method according to claim 1 .
8. A computer-readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to claim 1 is implemented.
Citation Information
Patent Citations
Multi-thread finite state machine switching method and multi-thread finite state machine switching device based on thread pool
CN103218264A
Method and system for processing repeated rapid operations
CN106227595A
Intellective switching between tasks
US20160378544A1
UUV group task coordinating system and method
CN104049616A
Flight equipment control method and flight equipment
CN104932526A