Task processing method and device, equipment, computer storage medium and program product

By decomposing tasks into subtasks through a task scheduling module and controlling the sending of subtasks using a message queue, the problem of rigid task processing in robot systems is solved, thereby improving flexibility and smoothness.

CN121785748AActive Publication Date: 2026-04-03CHINA MOBILEHANGZHOUINFORMATION TECH CO LTD +1
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-03-06
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing robot systems have rigid task processing methods, resulting in cumbersome task adjustments, bloated systems, low efficiency, and an inability to adapt to dynamic environments.

Method used

The task scheduling module responds to the message queue, decomposes the task into multiple subtasks, and controls the sending conditions of the subtasks according to the serial parallel identifier, thereby realizing the modularization and atomicity of tasks and using the message queue to achieve loosely coupled inter-module communication.

Benefits of technology

It improves the flexibility and smoothness of robot task execution, ensures orderly task distribution and execution, and enhances overall efficiency and system stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785748A_ABST
    Figure CN121785748A_ABST
Patent Text Reader

Abstract

The invention discloses a task processing method and device, equipment, a computer storage medium and a program product. The method comprises the steps that a task scheduling module responds to monitoring that a to-be-processed task exists in a first message queue, and the state category of a state machine is acquired; the task scheduling module acquires the task category of the to-be-processed task under the condition of determining that the state category is an idle state; the task scheduling module decomposes the to-be-processed task to obtain a plurality of sub-tasks under the condition of determining that the task category is a trigger task, and switches the task state of the main state machine into a task distribution state; the task scheduling module sends the corresponding subtasks to a second message queue monitored by the task execution module under the condition of determining that the state category is a task distribution state; and the task execution module responds to monitoring that the sub-task exists in the second message queue, and executes the task content corresponding to the sub-task. According to the embodiment of the invention, the flexibility and fluency of the robot can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of task scheduling technology, and in particular relates to a task processing method, apparatus, equipment, computer storage medium and program product. Background Technology

[0002] As user needs become increasingly complex and diverse, improving the flexibility and fluidity of robots, driven by technologies such as artificial intelligence, has become the core direction of robot technology development.

[0003] In related technologies, robot systems are capable of performing single tasks. When a robot system performs a task, an execution script can be determined based on the task. This execution script includes tasks in a fixed order. The main thread needs to call the corresponding sub-modules to execute the corresponding sub-tasks according to the execution script. This results in a fixed task order in the execution script, and the fixed calling relationship makes task adjustments extremely cumbersome, ultimately leading to a bloated and inefficient system.

[0004] Therefore, how to adjust the robot's task processing methods to improve its flexibility and smoothness is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention

[0005] This application provides a task processing method, apparatus, device, computer storage medium, and program product that can improve the flexibility and smoothness of robots.

[0006] In a first aspect, embodiments of this application provide a task processing method applied to a robot task scheduling system. The robot task scheduling system includes a main state machine, a task scheduling module, and one or more task execution modules based on the robot's structure. The method includes: the task scheduling module, in response to detecting a task to be processed in a first message queue, obtains the state category of the state machine; if the task scheduling module determines that the state category is idle, it obtains the task category of the task to be processed; if the task scheduling module determines that the task category is a triggered task, it decomposes the task to be processed to obtain a task list containing multiple subtasks, and switches the task state of the main state machine to a task distribution state. Each subtask contains the name of the task execution module used to execute the subtask and the task content; if the task scheduling module determines that the state category is a task distribution state, it sends the corresponding subtask to a second message queue monitored by the task execution module according to the name of the task execution module corresponding to each subtask in the task list; and the task execution module, in response to detecting a subtask in the second message queue, executes the task content corresponding to the subtask.

[0007] In one embodiment, the system further includes: when the task scheduling module determines that the task category is a task processing result, it adjusts the state of the main state machine according to the task processing result, wherein the task processing result is the task processing result of the task execution module for the subtask.

[0008] In one implementation, when the task scheduling module determines that the task category is a task processing result, it adjusts the state of the main state machine according to the task processing result, including: when the task scheduling module determines that the task processing result is normal and the task processing result has received the task processing results corresponding to all sent sub-tasks, it adjusts the state of the main state machine to the task distribution state; or, when the task scheduling module determines that the task processing result is normal and the task processing result has not received the task processing results corresponding to all sent sub-tasks, it keeps the state of the main state machine in the idle state; or, when the task scheduling module determines that any task processing result is abnormal, it adjusts the state of the main state machine to the alarm state.

[0009] In one embodiment, the system further includes: when the task scheduling module determines that the task category is a terminated task, it sends a task termination instruction to the task execution module and adjusts the state of the main state machine to an alarm state.

[0010] In one implementation, after the task scheduling module responds to the presence of a subtask in the second message queue and executes the task content corresponding to the subtask, the method further includes: the task execution module feeding back the task processing result of the subtask to the first message queue.

[0011] In one implementation, the subtask further includes a serial-parallel identifier; when the task scheduling module determines that the task category is a triggered task, it decomposes the task to be processed to obtain a task list containing multiple subtasks, and switches the task state of the main state machine to the task distribution state, including: the task scheduling module determines the sending conditions of the subtask based on the serial-parallel identifier; when the task scheduling module determines that the subtask meets the sending conditions, it switches the task state of the main state machine to the task distribution state, and sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0012] In one embodiment, the serial-parallel identifier includes a serial identifier or a parallel identifier; when the task scheduling module determines that a subtask meets the sending conditions, it sends the corresponding subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to each subtask in the task list, including: for each subtask, if the task scheduling module includes a serial identifier in the subtask and the task execution module receives the task processing results corresponding to one or more subtasks preceding the subtask in the task list, it sends the subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to the subtask; or, for each subtask, if the task scheduling module includes a parallel identifier in the subtask, it sends the subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to the subtask.

[0013] In one implementation, when the task scheduling module determines that the state category is task distribution state, after the task scheduling module sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name of each subtask in the task list, the method further includes: when the task scheduling module determines that all subtasks in the task list have been sent, the main state machine is adjusted to an idle state.

[0014] Secondly, embodiments of this application provide a task processing apparatus applied to a robot task scheduling system. The robot task scheduling system includes a main state machine, a task scheduling module, and one or more task execution modules based on the robot's structure. The apparatus includes: The first acquisition module is used by the task scheduling module to acquire the state category of the main state machine in response to the detection of a pending task in the first message queue. The second acquisition module is used by the task scheduling module to acquire the task category of the task to be processed when the status category is determined to be idle. The decomposition module is used by the task scheduling module to decompose the task to be processed when the task category is determined to be a trigger task, to obtain a task list containing multiple sub-tasks, and to switch the task state of the main state machine to the task distribution state. Each sub-task contains the name of the task execution module used to execute the sub-task and the task content. The sending module is used by the task scheduling module to send the corresponding subtask to the second message queue that the task execution module is listening to, based on the task execution module name corresponding to each subtask in the task list when the status category is determined to be task distribution status. The execution module is used by the task execution module to execute the corresponding task content when it detects that there is a subtask in the second message queue.

[0015] Thirdly, embodiments of this application provide a task processing device, the device including: a processor and a memory storing computer program instructions; when the processor executes the computer program instructions, it implements the task processing method of the first aspect or any embodiment of the first aspect.

[0016] Fourthly, a computer-readable storage medium storing computer program instructions, which, when executed by a processor, implement the task processing method of the first aspect or any embodiment of the first aspect.

[0017] Fifthly, embodiments of this application provide a computer program product in which instructions, when executed by a processor of an electronic device, cause the electronic device to perform a task processing method as described in the first aspect or any embodiment of the first aspect.

[0018] The task processing method, apparatus, device, computer storage medium, and program product of this application embodiment can clearly separate task decomposition, main state machine state management, and execution feedback through the task scheduling module, realizing the modularization and atomicity of the task process. This enables the robot task scheduling system to control the timing of task triggering according to the precise state of the main state machine, and to achieve loosely coupled inter-module communication through message queues, ensuring the orderly distribution and execution of tasks. This allows the robot to demonstrate both the flexibility of precise control over each link and the smoothness of overall motion when performing complex tasks. Attached Figure Description

[0019] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments of this application will be briefly introduced below. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 A flowchart illustrating a task processing method provided in one embodiment of this application is shown; Figure 2 A flowchart illustrating a task processing method provided in one embodiment of this application is shown; Figure 3 A flowchart illustrating a task processing method provided in one embodiment of this application is shown; Figure 4 A flowchart illustrating a task processing method provided in one embodiment of this application is shown; Figure 5 A schematic diagram of a task scheduling module and various communication task execution modules provided in one embodiment of this application is shown; Figure 6This is a schematic diagram of the structure of a task processing device provided in another embodiment of this application; Figure 7 This is a schematic diagram of the structure of a task processing device provided in another embodiment of this application. Detailed Implementation

[0021] The features and exemplary embodiments of various aspects of this application will be described in detail below. To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain this application and not to limit it. For those skilled in the art, this application can be implemented without some of these specific details. The following description of the embodiments is merely to provide a better understanding of this application by illustrating examples.

[0022] It should be noted that, in this document, relational terms such as "first" and "second" are used merely 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..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus that includes said element.

[0023] It should be noted that the acquisition, storage, use, and processing of data in this application embodiment all comply with the relevant provisions of national laws and regulations.

[0024] Furthermore, it should be noted that in the embodiments of this application, certain software, components, models, and other existing solutions in the industry may be mentioned. These should be considered as exemplary, and their purpose is only to illustrate the feasibility of implementing the technical solution of this application. However, it does not mean that the applicant has used or necessarily used the solution.

[0025] As user needs become increasingly complex and diverse, improving the flexibility and fluidity of robots, driven by technologies such as artificial intelligence, has become the core direction of robot technology development.

[0026] In related technologies, robot systems are capable of performing single tasks. When a robot system performs a task, an execution script is determined based on the task. This script includes tasks in a fixed order, and the main thread needs to call the corresponding sub-modules to execute the sub-tasks according to the script. This results in a fixed task order in the execution script, forcing the robot to mechanically wait for the preceding sub-tasks to complete completely before starting subsequent steps, causing pauses and disrupting the overall process. Furthermore, the fixed calling order inflexibles the process, making it unable to adapt to dynamic environments. Any unexpected events require interruption handling, making task adjustments extremely cumbersome, ultimately leading to a bloated and inefficient system.

[0027] In related technologies, message queues are generally used for asynchronous message processing, message distribution, and task scheduling, but they are rarely used as the core of task scheduling in complex hardware devices such as robot systems. Furthermore, in robot systems, subtasks that can be executed in parallel are generally handled by temporarily opening separate threads, and the processing results returned by each subtask are not consistent, which often leads to bloated and cumbersome processes.

[0028] Therefore, how to adjust the robot's task processing methods to improve its flexibility and smoothness is a technical problem that urgently needs to be solved by those skilled in the art.

[0029] To address the problems of the prior art, embodiments of this application provide a task processing method, apparatus, device, computer storage medium, and program product. The task processing method provided in this application embodiment will be described first below.

[0030] Figure 1 A flowchart illustrating a task processing method according to an embodiment of this application is shown. Figure 1 As shown, the task processing method includes the following steps: S110, The task scheduling module responds to the presence of pending tasks in the first message queue by obtaining the state category of the main state machine.

[0031] S120. When the task scheduling module determines that the status category is idle, it obtains the task category of the task to be processed.

[0032] S130. When the task scheduling module determines that the task category is a triggering task, it decomposes the task to be processed to obtain a task list containing multiple sub-tasks, and switches the task state of the main state machine to the task distribution state.

[0033] S140. When the task scheduling module determines that the status category is task distribution status, it sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0034] S150, The task execution module responds to the presence of a subtask in the second message queue by executing the task content corresponding to the subtask.

[0035] For example, the task processing method is applied to a robot task scheduling system. The robot task scheduling system includes a master state machine, a task scheduling module, and one or more task execution modules based on the robot's structure.

[0036] For example, the master state machine can be used to reflect the working state of the robot task scheduling system. Different state categories of the master state machine can be used to reflect different working modes of the robot task scheduling system. Furthermore, the task scheduling module can adopt different task execution strategies in different working modes.

[0037] For example, the task scheduling module can determine the task execution strategy for the task to be processed based on the state category corresponding to the main state machine. The task execution strategy can be determined according to the task category corresponding to the task.

[0038] For example, a robot task scheduling system can set up one or more task execution modules according to its own structure to execute the tasks corresponding to that structure.

[0039] In one example, the robot may include a left robotic arm, a right robotic arm, a left robotic hand, and a right robotic hand. Corresponding task execution modules can be set in the robot task scheduling system according to the left robotic arm, the right robotic arm, the left robotic hand, and the right robotic hand. For example, it may include a left robotic arm task execution module corresponding to the left robotic arm, a right robotic arm execution module corresponding to the right robotic arm, a left robotic hand execution module corresponding to the left robotic hand, and a right robotic hand execution module corresponding to the right robotic hand.

[0040] It is understood that the robot may also include other structures, such as mechanical legs and mechanical feet, and corresponding task execution modules may be set according to the structure. In this embodiment, the robot structure and the corresponding task execution module are only described by example, and no limitation is imposed on the robot structure and the corresponding task execution module.

[0041] For example, independent message queues can be established for the task scheduling module and each task execution module in the robot task scheduling system, and their respective message queues can be maintained. Each message queue can be used to receive tasks and transmit task execution results.

[0042] In some embodiments, in S110, the task scheduling module obtains the status category of the task scheduling module in response to detecting that there is a task to be processed in the first message queue.

[0043] For example, the first message queue may be a separate message queue established for the task scheduling module.

[0044] For example, the state category corresponding to the task scheduling module can be used to reflect the working mode of the task scheduling module. When the task scheduling module is in different states, it can adopt different task execution strategies to process the tasks waiting to be processed in the first message queue.

[0045] The status categories of the task scheduling module can include idle status (IDLE), alarm status (ABNORMAL), and task dispatch status (ACTPOST).

[0046] For example, a robot task scheduling system may include a master state machine, which can be used to obtain the state category of the task scheduling module. In one example, in response to the task scheduling module detecting that there is a task to be processed in the first message queue, the task scheduling module can obtain the corresponding state category of the task scheduling module from the master state machine.

[0047] In some embodiments, in S120, the task scheduling module obtains the task category of the task to be processed when it determines that the state category is idle.

[0048] For example, if the task scheduling module is determined to be idle, the task category corresponding to the task to be processed can be determined from the first message queue.

[0049] In one example, when the task scheduling module is idle, the main thread loops, and the task scheduling module can read the tasks to be processed from the first message queue, deconstruct the tasks to be processed, and obtain the task category corresponding to the tasks to be processed.

[0050] For example, the task categories of the task to be processed may include categories such as triggering task, task processing result, and terminating task.

[0051] In some embodiments, in S130, when the task scheduling module determines that the task category is a triggering task, it decomposes the task to be processed to obtain a task list containing multiple sub-tasks, and switches the task status of the task scheduling module to the task distribution status.

[0052] Each subtask includes a task execution module name and task content. The task execution module within a subtask represents the execution module used to process that subtask; the task content represents the specific task that the task execution model needs to perform.

[0053] When the task scheduling module determines that the task to be processed is a triggering task, it can parse the triggering task to obtain a task list. The parsed task list contains one or more subtasks.

[0054] In one example, the task scheduling module can parse task categories, retrieve tasks, and determine whether a task has already been registered. If it is determined that the task has not been registered, the corresponding task is added to the task scheduling core.

[0055] For example, when the task scheduling module determines that the task to be processed is a triggering task, it adjusts the state of the main state machine to the task distribution state.

[0056] In some optional embodiments, the subtask also includes a serial-to-parallel identifier. The task scheduling module can determine the sending conditions of the subtask based on the serial-to-parallel identifier; when the task scheduling module determines that the subtask meets the sending conditions, it switches the task status of the task scheduling module to the task distribution status, and sends the corresponding subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0057] For example, the task scheduling module parses the tasks to be processed according to a preset data structure to obtain an array corresponding to the tasks to be processed.

[0058] In one example, the array corresponding to the tasks to be processed can be shown in Table 1 below: Table 1 The core elements of the preset data structure can include the action execution object (i.e., the task execution module name) corresponding to the task to be processed, the action type (i.e., the task content), and the serial-parallel identifier. Therefore, when the task scheduling module parses the task to be processed, it can determine the action execution object, action type, and serial-parallel identifier corresponding to each task. For example, as shown in Table 1 above, in the parsed array, the action execution object can be the left robotic arm, the action type can be action 1, and the serial-parallel identifier can be the parallel identifier.

[0059] For example, the serial-parallel identifier can be used to characterize whether the subtask can be executed in parallel with other subtasks or whether it needs to be executed serially with other subtasks.

[0060] For example, the sending conditions for a subtask can be determined based on the serial-parallel identifier corresponding to the subtask and the previous task processing results of the subtask in the task list. If it is determined that the subtask meets the sending conditions, the subtask can be sent to the corresponding second message queue; or, if it is determined that the subtask does not meet the sending conditions, the sending of the subtask is stopped.

[0061] For example, the second message queue can be the message queue corresponding to the task execution module that performs the subtask. For instance, the subtask can be the left robotic arm performing action 1, then the task execution module corresponding to the subtask can be the left robotic arm execution module, and the second message queue can be the message queue corresponding to the left robotic arm execution module.

[0062] Furthermore, in some alternative embodiments, the serial-to-parallel identifier includes either a serial identifier or a parallel identifier. For each subtask, if the task scheduling module includes a serial identifier in the subtask and the task execution module receives the task processing results of one or more subtasks preceding the subtask in the task list, then the task scheduling module sends the subtask to the second message queue monitored by the task execution module according to the name of the corresponding task execution module. Alternatively, if the task scheduling module includes a parallel identifier in each subtask, then the task execution module sends the subtask to the second message queue monitored by the corresponding task execution module according to the name of the corresponding task execution module.

[0063] For example, the task scheduling module determines whether the current subtask can be executed in parallel with the previous subtask based on the serial-parallel identifier. If the current subtask contains a parallel identifier, it is determined that the current subtask can be executed in parallel with the previous subtask. The task scheduling module can then send the current subtask to the corresponding second message queue and continue to determine the serial-parallel identifier for the next subtask. This continues until the task scheduling module determines that the serial-parallel identifier is a serial identifier. The task scheduling module then waits for the execution results of the previously issued subtasks in a polling manner. Once it is determined that all parallel subtasks have been executed normally, the subtask with the serial identifier is sent to the corresponding task execution module.

[0064] It is understood that in this embodiment of the application, the serial parallel identifier in the subtask is used as the subtask distribution condition. This enables the task scheduling module to call multiple task execution modules asynchronously, thereby achieving parallel processing of subtasks and improving task execution efficiency.

[0065] Furthermore, in the embodiments of this application, when a subtask contains a serial identifier, it is necessary to wait for the task processing result of the previous task. Only after receiving the task processing result will the subtask be distributed. However, when a subtask contains a parallel identifier, task distribution can be performed directly. In this way, the task distribution process based on serial and parallel identifiers can balance the two key dimensions of efficiency and order in task execution, thereby maximizing throughput and resource utilization while ensuring system correctness.

[0066] In some embodiments, in S140, when the task scheduling module determines that the status category is task distribution status, it sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0067] For example, when the task scheduling module is in the task distribution state, the task scheduling module can retrieve the task list stored in the task scheduling core, and send the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0068] In some embodiments, in S150, the task execution module executes the task content corresponding to the subtask in response to detecting the existence of a subtask in the second message queue.

[0069] For example, the task execution module executes a subtask if it determines that a subtask exists in the second message queue it is monitoring.

[0070] In some optional embodiments, the task execution module feeds back the task processing results of the subtasks to the first message queue. This allows the task scheduling module to determine the execution results of each task execution module for each subtask from the first message queue.

[0071] Figure 1 In the illustrated embodiment, the task scheduling module, upon detecting a pending task in the first message queue, obtains the state category of the state machine; and if the state category is determined to be idle, it obtains the task category of the pending task. Further, if the task category is determined to be a triggered task, the task scheduling module decomposes the pending task into a task list containing multiple subtasks, and switches the task state of the main state machine to the task distribution state. If the state category is determined to be task distribution, the task scheduling module, based on the task execution module name corresponding to each subtask in the task list, sends the corresponding subtask to the second message queue monitored by that task execution module. This allows the task execution module to execute the corresponding task content of the subtask upon detecting the presence of a subtask in the second message queue. It is understood that in this embodiment of the application, the task decomposition, state management of the main state machine and execution feedback are clearly separated by the task scheduling module, realizing the modularization and atomicity of the task process. This enables the robot task scheduling system to control the timing of task triggering according to the precise state of the main state machine, and to achieve loosely coupled inter-module communication through message queues, ensuring the orderly distribution and execution of tasks. This allows the robot to demonstrate both the flexibility of precise control over each link and the smoothness of overall action when performing complex tasks.

[0072] To improve system stability, as another implementation of this application, this application also provides another implementation of the task processing method, as detailed in the following embodiments.

[0073] Figure 2 A flowchart illustrating a task processing method according to an embodiment of this application is shown. Figure 2 As shown, the task processing method includes the following steps: S210, The task scheduling module responds to the presence of pending tasks in the first message queue by obtaining the state category of the main state machine.

[0074] S220. When the task scheduling module determines that the status category is idle, it obtains the task category of the task to be processed.

[0075] S230. When the task scheduling module determines that the task category is a triggering task, it decomposes the task to be processed to obtain a task list containing multiple sub-tasks, and switches the task state of the main state machine to the task distribution state.

[0076] S240. When the task scheduling module determines that the status category is task distribution status, it sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0077] S250, the task execution module responds to the presence of a subtask in the second message queue by executing the task content corresponding to the subtask.

[0078] S260. When the task scheduling module determines that the task category is a task processing result, it adjusts the state of the main state machine according to the task processing result.

[0079] For example, steps S210-S250 are the same as steps S110-S150, and will not be repeated here.

[0080] For example, the task processing result is the task processing result of the task execution module for the sub-task. The processing result of the task execution module for the sub-task can include normal and abnormal results.

[0081] For example, the task scheduling module can adjust the state of the main state machine based on the processing results of the subtasks by the task execution module.

[0082] In some optional embodiments, the task scheduling module adjusts the state of the main state machine to the task distribution state when it determines that the task processing result is normal and the task processing result has received the task processing results corresponding to all sent sub-tasks; or, the task scheduling module keeps the state of the main state machine in the idle state when it determines that the task processing result is normal and the task processing result has not received the task processing results corresponding to all sent sub-tasks; or, the task scheduling module adjusts the state of the main state machine to the alarm state when it determines that any task processing result is abnormal.

[0083] For example, the task scheduling module can first determine the execution status of the subtask processing results. If any subtask execution result is abnormal, the main state machine can be switched to an alarm state, awaiting technical personnel intervention. If the task execution result is confirmed to be normal, it can then determine whether all issued subtasks have returned execution results. If so, the main state machine can be switched to a task distribution state to continue distributing tasks in the task list; otherwise, it can remain in an idle state, waiting for task execution results.

[0084] In this embodiment, a verification mechanism is set based on the execution results of subtasks and the return status of the execution results. This ensures that the robot task scheduling system will only enter the next task distribution cycle after all subtasks have been successfully completed in the current task cycle, thereby guaranteeing the data integrity and execution reliability of the robot task scheduling system when dealing with complex task processes.

[0085] To improve system stability, as another implementation of this application, this application also provides another implementation of the task processing method, as detailed in the following embodiments.

[0086] Figure 3 A flowchart illustrating a task processing method according to an embodiment of this application is shown. Figure 3 As shown, the task processing method includes the following steps: S310, the task scheduling module responds to the presence of pending tasks in the first message queue by obtaining the state category of the main state machine.

[0087] S320. When the task scheduling module determines that the status category is idle, it obtains the task category of the task to be processed.

[0088] S330: When the task scheduling module determines that the task category is a triggering task, it decomposes the task to be processed to obtain a task list containing multiple sub-tasks, and switches the task state of the main state machine to the task distribution state.

[0089] S340. When the task scheduling module determines that the status category is task distribution status, it sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0090] S350, the task execution module responds to the presence of a subtask in the second message queue by executing the task content corresponding to the subtask.

[0091] S360: When the task category is determined to be a task processing result, the task scheduling module adjusts the state of the main state machine according to the task processing result.

[0092] S370. When the task scheduling module determines that the task category is a terminated task, it sends a task termination instruction to the task execution module and adjusts the state of the main state machine to the alarm state.

[0093] For example, steps S310-S260 are the same as steps S210-S260, and will not be repeated here.

[0094] For example, when the task scheduling module determines that the task category is a terminated task, it sends a task termination instruction to the task execution module corresponding to the subtask, so that the task execution module can stop executing the current task.

[0095] In one example, when the task scheduling module determines that the task category is an instruction to cancel the current task, it can send a cancellation instruction to the corresponding task execution module based on the name of the task execution module corresponding to the instruction. Upon receiving this instruction, the task execution module terminates the currently executing task.

[0096] For example, if the task scheduling module determines that the task category is a terminated task, it can adjust the state of the main state machine to an alarm state. Furthermore, when the main state machine is in an alarm state, technical personnel can intervene and, after the problem is resolved, restore the device to its initial state, that is, restore the main state machine to an idle state.

[0097] In this embodiment, when the task scheduling module determines that the task category is a terminated task, it can send a task termination instruction to the task execution module and adjust the state of the main state machine to an alarm state. This enables the robot task scheduling system to stop running quickly when it malfunctions, thereby enhancing the robustness and stability of the robot task scheduling system.

[0098] The following is combined with Figure 4 , Figure 5 The following are examples illustrating the task processing method.

[0099] Figure 4This illustration shows a flowchart of a task processing method provided in one embodiment of this application. Figure 5 A schematic diagram of a task scheduling module and various communication task execution modules provided in one embodiment of this application is shown.

[0100] For example, the task scheduling module can be the main thread scheduling module, and the task scheduling module can include the left robotic arm execution module and the right robotic arm execution module. Furthermore, the message queue monitored by the main thread scheduling module is message queue (MQ) 1 (i.e., MQ1), the message queue monitored by the left robotic arm execution module is message queue 2 (i.e., MQ2), and the message queue monitored by the right robotic arm execution module is message queue 3 (i.e., MQ3).

[0101] like Figure 4 As shown, in S401, the main thread scheduling module determines the task category of the task to be processed when it determines that the main state machine is in an idle state and there are tasks to be processed in the first message queue. In S402, if the task category of the task to be processed is determined to be a trigger task, the task to be processed is broken down and the subtasks are added to the task scheduling core in the main thread scheduling module. In S403, the main state machine is adjusted to the task distribution state. In S404, the main thread scheduling module distributes the subtasks in the task scheduling core. In S405, if it is determined that the subtask can be executed in parallel, the main thread scheduling module can send the subtask to the corresponding task execution module, so that multiple subtasks can be executed in parallel. Furthermore, after the task distribution is determined, S406 can be executed to adjust the state of the main state machine to an idle state.

[0102] Among them, such as Figure 5 As shown, the main thread scheduling module can obtain tasks to be processed from MQ1, and the main thread scheduling module can send the split subtasks to MQ2 and MQ3.

[0103] Furthermore, such as Figure 4 As shown, in S407, if the task category of the task to be processed is determined to be a task processing result, it is determined whether there is an anomaly in the task processing result. If there is no anomaly, S408 is executed to determine whether all task execution modules have returned task processing results. If yes, it returns to step S403; otherwise, it returns to S406. If there is an anomaly in the task processing result, S409 is executed to adjust the main state machine to the alarm state. In S410, anomaly handling is performed, and it returns to step S406.

[0104] Among them, such as Figure 5As shown, the left robotic arm task execution module and the right robotic arm execution module can return the corresponding task processing results to MQ1, so that the main thread scheduling module can obtain the task processing results of the left robotic arm task execution module and the right robotic arm execution module for the subtask from MQ1.

[0105] In one example, the task can be triggered using an interface function encapsulated in MQ1. The main thread scheduling module polls MQ1 periodically, retrieves data from MQ1, parses the message type, and if it's a triggered task, finds the corresponding task list, decomposes the task, and publishes the subtasks of the left robotic arm task execution module through the interface encapsulated in MQ2, and the subtasks of the right robotic arm task execution module through the interface encapsulated in the MQ3 message queue. Each of the left and right robotic arm task execution modules maintains a thread to listen for message transmissions from MQ2 and MQ3, receives subtasks, finds the corresponding subtask, triggers its execution, and feeds the results back to the main thread scheduling module through the interface encapsulated in MQ1. The main thread scheduling module analyzes the different results received and makes corresponding decisions.

[0106] Furthermore, such as Figure 4 As shown, in S411, if the task category of the task to be processed is determined to be a terminated task, S409 is executed.

[0107] In this embodiment, the robot task scheduling system includes a main thread scheduling module and left and right robotic arm task processing modules. The main thread scheduling module is the core, receiving tasks and decomposing them into subtasks corresponding to the left and right robotic arm task processing modules. Each of the left and right robotic arm task processing modules maintains a thread to listen for message transmissions via MQ2 and MQ3, obtain instruction data, find the corresponding subtask, trigger the execution of the corresponding subtask, and feed the results back to the main thread through the MQ1 encapsulated interface. The main thread analyzes the different received results and makes corresponding decisions. This interconnected information interaction between the scheduling module and the task execution module, and atomizes the robot's execution structure, allows tasks to be quickly written in a configuration file-like manner, facilitating the addition, deletion, and modification of tasks, and adjusting the execution order of submodules, greatly accelerating task orchestration and debugging. Simultaneously, during task orchestration, the system configures a parallel execution mode based on the execution status of the upper and lower submodules, which rapidly increases task execution efficiency. This system architecture design simplifies the complexity of task design and scheduling, and the flexible execution mode accelerates task execution efficiency.

[0108] Furthermore, the interaction between the main thread scheduling module and the left and right robotic arm task processing modules allows the main thread scheduling module to analyze different received results and make corresponding decisions. This enables the main thread scheduling module to asynchronously call the task execution module's functions without waiting for the task execution module to complete its task. In this way, it can trigger the next task execution module to execute subtasks, thereby achieving parallel processing of subtasks and improving the efficiency of task execution.

[0109] Based on the task processing method provided in the above embodiments, this application also provides specific implementations of the task processing apparatus. Please refer to the following embodiments.

[0110] First see Figure 6 The task processing apparatus provided in this application embodiment is applied to a robot task scheduling system. The robot task scheduling system includes a main state machine, a task scheduling module, and one or more task execution modules based on the robot structure. The apparatus includes the following modules: The first acquisition module 601 is used by the task scheduling module to acquire the state category of the main state machine in response to the detection that there is a task to be processed in the first message queue. The second acquisition module 602 is used by the task scheduling module to acquire the task category of the task to be processed when the status category is determined to be idle. The decomposition module 603 is used by the task scheduling module to decompose the task to be processed when the task category is determined to be a trigger task, to obtain a task list containing multiple sub-tasks, and to switch the task state of the main state machine to the task distribution state. Each sub-task contains the name of the task execution module used to execute the sub-task and the task content. The sending module 604 is used by the task scheduling module to send the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list when the status category is determined to be task distribution status. The execution module 605 is used by the task execution module to execute the task content corresponding to the subtask when it detects that a subtask exists in the second message queue.

[0111] In one embodiment, the apparatus further includes an adjustment module, which is used by the task scheduling module to adjust the state of the main state machine according to the task processing result when the task category is determined to be the task processing result of the task execution module for the sub-task.

[0112] In one implementation, the adjustment module adjusts the state of the main state machine according to the task processing result when the task category is determined to be a task processing result: If the task processing result is normal and the task processing result has received the processing results corresponding to all sent sub-tasks, the task scheduling module adjusts the state of the main state machine to the task distribution state; or, if the task processing result is normal but the task processing result has not received the processing results corresponding to all sent sub-tasks, the task scheduling module keeps the state of the main state machine in the idle state; or, if the task scheduling module determines that any task processing result is abnormal, the task scheduling module adjusts the state of the main state machine to the alarm state.

[0113] In one embodiment, the adjustment module is further configured to: when the task scheduling module determines that the task category is a terminated task, send a task termination instruction to the task execution module and adjust the state of the main state machine to an alarm state.

[0114] In one implementation, after the task scheduling module detects the existence of a subtask in the second message queue and executes the corresponding task content of the subtask, the second acquisition module is further used to have the task execution module feed back the task processing result of the subtask to the first message queue.

[0115] In one implementation, the subtask further includes a serial-parallel identifier; the decomposition module 603 decomposes the task to be processed by the task scheduling module when the task category is determined to be a trigger task, obtaining a task list containing multiple subtasks, and switches the task state of the main state machine to the task distribution state: the task scheduling module determines the sending conditions of the subtask based on the serial-parallel identifier; when the task scheduling module determines that the subtask meets the sending conditions, it switches the task state of the main state machine to the task distribution state, and sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list.

[0116] In one embodiment, the serial-to-parallel identifier includes a serial identifier or a parallel identifier; the decomposition module 603 uses the following method: when the task scheduling module determines that a subtask meets the sending conditions, it sends the corresponding subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to each subtask in the task list: for each subtask, if the task scheduling module contains a serial identifier in the subtask and the task execution module receives the task processing results corresponding to one or more subtasks preceding the subtask in the task list, it sends the subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to the subtask; or, for each subtask, if the task scheduling module contains a parallel identifier in the subtask, it sends the subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to the subtask.

[0117] In one implementation, when the task scheduling module determines that the state category is task distribution state, after the task scheduling module sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name of each subtask in the task list, the adjustment module is further used to: when the task scheduling module determines that all subtasks in the task list have been sent, adjust the main state machine to the idle state.

[0118] Figure 7 A schematic diagram of the hardware structure of the task processing device provided in an embodiment of this application is shown.

[0119] The task processing device may include a processor 701 and a memory 702 storing computer program instructions.

[0120] Specifically, the processor 701 may include a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits that can be configured to implement the embodiments of this application.

[0121] Memory 702 may include mass storage for data or instructions. For example, and not limitingly, memory 702 may include a hard disk drive (HDD), floppy disk drive, flash memory, optical disk, magneto-optical disk, magnetic tape, or Universal Serial Bus (USB) drive, or a combination of two or more of these. Where appropriate, memory 702 may include removable or non-removable (or fixed) media. Where appropriate, memory 702 may be internal or external to the integrated gateway disaster recovery device. In a particular embodiment, memory 702 is non-volatile solid-state memory.

[0122] Memory may include read-only memory (ROM), random access memory (RAM), disk storage media devices, optical storage media devices, flash memory devices, and electrical, optical, or other physical / tangible memory storage devices. Therefore, typically, memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the methods according to one aspect of this disclosure.

[0123] The processor 701 implements any of the task processing methods described in the above embodiments by reading and executing computer program instructions stored in the memory 702.

[0124] In one example, the task processing device may further include a communication interface 703 and a bus 710. Wherein, as... Figure 7 As shown, the processor 701, memory 702, and communication interface 703 are connected through bus 710 and complete communication with each other.

[0125] The communication interface 703 is mainly used to realize communication between various modules, devices, units and / or equipment in the embodiments of this application.

[0126] Bus 710 includes hardware, software, or both, that couples components of an online data traffic metering device together. For example, and not limitingly, the bus may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an Infinite Bandwidth Interconnect, a Low Pin Count (LPC) bus, a memory bus, a Microchannel Architecture (MCA) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a Video Electronics Standards Association Local (VLB) bus, or other suitable buses, or combinations of two or more of these. Where appropriate, bus 710 may include one or more buses. Although specific buses are described and illustrated in embodiments of this application, any suitable bus or interconnect is contemplated herein.

[0127] This task processing device can execute the task processing method in the embodiments of this application based on the state of the main state machine and the task to be processed, thereby achieving a combination Figure 1 and Figure 2 Describe the task processing method.

[0128] Furthermore, in conjunction with the task processing methods in the above embodiments, this application embodiment can provide a computer storage medium for implementation. The computer storage medium stores computer program instructions; when these computer program instructions are executed by a processor, they implement any of the task processing methods in the above embodiments.

[0129] This application also provides a computer program product, including a computer program, which, when executed, implements any of the task processing methods described in the above embodiments.

[0130] It should be clarified that this application is not limited to the specific configurations and processes described above and shown in the figures. For the sake of brevity, detailed descriptions of known methods are omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of this application is not limited to the specific steps described and shown. Those skilled in the art can make various changes, modifications, and additions, or change the order of steps, after understanding the spirit of this application.

[0131] The functional blocks shown in the above-described structural diagram can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, they can be, for example, electronic circuits, application-specific integrated circuits (ASICs), appropriate firmware, plug-ins, function cards, etc. When implemented in software, the elements of this application are programs or code segments used to perform the required tasks. Programs or code segments can be stored on a machine-readable medium or transmitted over a transmission medium or communication link via data signals carried on a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio frequency (RF) links, etc. Code segments can be downloaded via computer networks such as the Internet, intranets, etc.

[0132] It should also be noted that the exemplary embodiments mentioned in this application describe methods or systems based on a series of steps or apparatus. However, this application is not limited to the order of the above steps; that is, the steps can be performed in the order mentioned in the embodiments, or in a different order, or several steps can be performed simultaneously.

[0133] The aspects of this disclosure have been described above with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this disclosure. It should be understood that each block in the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus to produce a machine such that these instructions, executable via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions / actions specified in one or more blocks of the flowchart illustrations and / or block diagrams. Such a processor can be, but is not limited to, a general-purpose processor, a special-purpose processor, a special application processor, or a field-programmable logic circuit. It is also understood that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can also be implemented by special-purpose hardware performing the specified functions or actions, or can be implemented by a combination of special-purpose hardware and computer instructions.

[0134] The above description is merely a specific implementation of this application. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, modules, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. It should be understood that the protection scope of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the protection scope of this application.

Claims

1. A task processing method, characterized in that, An application in a robot task scheduling system, the robot task scheduling system including a main state machine, a task scheduling module, and one or more task execution modules based on the robot's structure, the method includes: The task scheduling module responds to the presence of a pending task in the first message queue by obtaining the state category of the state machine. When the task scheduling module determines that the state category is idle, it obtains the task category of the task to be processed. When the task scheduling module determines that the task category is a trigger task, it decomposes the task to be processed to obtain a task list containing multiple sub-tasks, and switches the task state of the main state machine to the task distribution state. Each sub-task contains the name of the task execution module used to execute the sub-task and the task content. When the task scheduling module determines that the status category is a task distribution status, it sends the corresponding subtask to the second message queue that the task execution module is listening to, according to the name of the task execution module corresponding to each subtask in the task list. The task execution module responds to the presence of the subtask in the second message queue by executing the task content corresponding to the subtask.

2. The method according to claim 1, characterized in that, Also includes: When the task scheduling module determines that the task category is a task processing result, it adjusts the state of the main state machine according to the task processing result, wherein the task processing result is the task processing result of the task execution module for the sub-task.

3. The method according to claim 2, characterized in that, When the task scheduling module determines that the task category is a task processing result, it adjusts the state of the main state machine according to the task processing result, including: If the task scheduling module determines that the task processing result is normal and that the task processing result has received the processing results of all sent sub-tasks, it adjusts the state of the main state machine to the task distribution state; or... If the task scheduling module determines that the task processing result is normal and that the task processing result has not received the processing results corresponding to all sent subtasks, it keeps the main state machine in an idle state; or... If the task scheduling module determines that any of the task processing results is abnormal, it adjusts the state of the main state machine to an alarm state.

4. The method according to claim 1 or 2, characterized in that, Also includes: When the task scheduling module determines that the task category is a terminated task, it sends a task termination instruction to the task execution module and adjusts the state of the main state machine to an alarm state.

5. The method according to claim 1, characterized in that, After the task scheduling module detects the existence of the subtask in the second message queue and executes the task content corresponding to the subtask, the method further includes: The task execution module feeds back the task processing results of the subtask to the first message queue.

6. The method according to claim 1, characterized in that, The subtask also includes a serial-parallel identifier; When the task scheduling module determines that the task category is a triggered task, it decomposes the task to be processed to obtain a task list containing multiple sub-tasks, and switches the task state of the main state machine to the task distribution state, including: The task scheduling module determines the sending conditions of the subtask based on the serial-parallel identifier; When the task scheduling module determines that the subtask meets the sending conditions, it switches the task state of the main state machine to the task distribution state, and sends the corresponding subtask to the second message queue monitored by the task execution module according to the name of the task execution module corresponding to each subtask in the task list.

7. The method according to claim 6, characterized in that, The serial-parallel identifier includes a serial identifier or a parallel identifier; When the task scheduling module determines that the subtask meets the sending condition, it sends the corresponding subtask to the second message queue monitored by the task execution module according to the name of the task execution module corresponding to each subtask in the task list, including: For each subtask, the task scheduling module includes the serial identifier in the subtask, and when the task execution module receives the task processing results of one or more subtasks preceding the subtask in the task list, it sends the subtask to the second message queue monitored by the task execution module according to the name of the task execution module corresponding to the subtask; or... For each subtask, if the task scheduling module contains the parallel identifier in the subtask, it sends the subtask to the second message queue that the task execution module is listening to, according to the name of the task execution module corresponding to the subtask.

8. The method according to claim 1, characterized in that, When the task scheduling module determines that the status category is a task distribution status, after the task scheduling module sends the corresponding subtask to the second message queue listened to by the task execution module according to the task execution module name corresponding to each subtask in the task list, the method further includes: When the task scheduling module determines that all subtasks in the task list have been sent, it adjusts the main state machine to the idle state.

9. A task processing device, characterized in that, An apparatus for use in a robot task scheduling system, the robot task scheduling system comprising a main state machine, a task scheduling module, and one or more task execution modules based on the robot's structure, the apparatus comprising: The first acquisition module is used by the task scheduling module to acquire the state category of the main state machine in response to the detection that there is a task to be processed in the first message queue. The second acquisition module is used by the task scheduling module to acquire the task category of the task to be processed when the state category is determined to be an idle state. The decomposition module is used by the task scheduling module to decompose the task to be processed when the task category is determined to be a trigger task, to obtain a task list containing multiple sub-tasks, and to switch the task state of the main state machine to the task distribution state. Each sub-task contains the name of the task execution module used to execute the sub-task and the task content. The sending module is used by the task scheduling module to send the corresponding subtask to the second message queue monitored by the task execution module according to the task execution module name corresponding to each subtask in the task list when the task scheduling module determines that the status category is task distribution status. An execution module is used by the task execution module to execute the task content corresponding to the subtask in response to the detection that the subtask exists in the second message queue.

10. A task processing device, characterized in that, The device includes: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, it implements the task processing method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer program instructions, which, when executed by a processor, implement the task processing method as described in any one of claims 1-8.

12. A computer program product, characterized in that, When the instructions in the computer program product are executed by the processor of the electronic device, the electronic device performs the task processing method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Abnormal error processing method in RPA application

    CN115344460A

  • Task processing method and robot

    CN121187741A

  • Robot task scheduling method and system, robot and storage medium

    CN121572302A

  • Robot scheduling method and apparatus, and electronic device and storage medium

    WO2023071769A1

  • KR20250079627A