Scheduling processing method based on behavior tree
By monitoring the execution status of asynchronous action nodes in the behavior tree engine of the robot navigation system and processing new tasks after all tasks are completed, the system instability caused by asynchronous tasks is solved, and the success rate of task execution and system stability are improved.
Patent Information
- Application Number
- CN202411998110.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In robot navigation systems, the execution of asynchronous tasks may lead to inconsistency in task execution and system instability, especially task conflicts caused by the failure of the asynchronous action node to completely stop when the cancel and start instructions are received.
By responding to the first scheduling instruction in the behavior tree engine, the corresponding asynchronous action node is instructed to perform the scheduling operation and monitor its execution status. Only after all asynchronous action nodes complete their current operations will they respond to the second scheduling instruction to ensure that all tasks are safely terminated before subsequent operations are performed.
This mechanism effectively reduces the risk of system instability caused by task conflicts, improves the success rate of robot task execution and the overall system stability.
Smart Images

Figure CN119973978A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of robot navigation technology, and in particular to a scheduling processing method based on a behavior tree. Background Art
[0002] In the robot navigation system, the Behavior Tree serves as the control core of the task execution process, and guides the robot's behavioral decisions through its hierarchical node structure. Among these tasks, especially asynchronous tasks, the robot may not be able to respond to scheduling instructions immediately in the real world because they may involve time-consuming operations. For example, due to physical inertia or task characteristics, the robot may need additional time to smoothly adjust its actions. In this case, if the action node fails to stop completely after receiving the cancel command, and the system immediately receives the start command, it may cause inconsistency in task execution. This inconsistency may cause task conflicts, thereby increasing the risk of system instability, affecting the success rate of robot task execution and the stability of the system. Summary of the invention
[0003] In view of this, the present application provides a scheduling processing method based on a behavior tree to reduce the risk of instability of the system due to task conflicts.
[0004] This application provides the following solutions:
[0005] In a first aspect, a scheduling processing method based on a behavior tree is provided, wherein the method is applied to a robot navigation system, wherein the robot navigation system has a built-in behavior tree engine and a behavior tree corresponding to at least one asynchronous task, and the method comprises:
[0006] In response to receiving a first scheduling instruction during the execution of the asynchronous task, the behavior tree engine instructs an asynchronous action node in the behavior tree that matches the first scheduling instruction to execute a first scheduling operation corresponding to the first scheduling instruction;
[0007] Monitoring the execution status of the asynchronous action node;
[0008] In response to receiving a second scheduling instruction, when the execution status of all asynchronous action nodes that execute the first scheduling operation is a success status, instructing the asynchronous action nodes in the behavior tree that match the second scheduling instruction to execute a second scheduling operation corresponding to the second scheduling instruction.
[0009] Optionally, the method further comprises:
[0010] In response to receiving the first scheduling instruction, identifying an asynchronous action node matching the first scheduling instruction by traversing the behavior tree, and recording an identifier of the matched asynchronous action node into a node list;
[0011] The monitoring the execution status of the asynchronous action node includes:
[0012] Based on the identifiers of the asynchronous action nodes recorded in the node list, the execution status of the asynchronous action node corresponding to each identifier is periodically queried.
[0013] Optionally, based on the identifiers of the asynchronous action nodes recorded in the node list, periodically querying the execution status of the asynchronous action node corresponding to each identifier includes:
[0014] Based on the identifiers of the asynchronous action nodes recorded in the node list, the first interface corresponding to each identifier is periodically called to obtain the execution status of the corresponding asynchronous action node; the first interface is pre-configured for each asynchronous action node, and the first interface is used to query the execution status of the corresponding asynchronous action node.
[0015] Optionally, the method further comprises:
[0016] The identifier of the asynchronous action node whose execution status is a success status is deleted from the node list.
[0017] Optionally, before the execution status of all asynchronous action nodes executing the first scheduling operation is a success status, the second scheduling instruction is stored in a cache;
[0018] Based on the second scheduling instruction, instructing the asynchronous action node in the behavior tree that matches the second scheduling instruction to execute a second scheduling operation corresponding to the second scheduling instruction includes:
[0019] The second scheduling instruction is obtained from the cache, and the asynchronous action node in the behavior tree that matches the second scheduling instruction is instructed to execute a second scheduling operation corresponding to the second scheduling instruction.
[0020] Optionally, the first scheduling instruction includes a pause instruction or a cancel instruction;
[0021] The second scheduling instruction includes a recovery instruction.
[0022] In a second aspect, a scheduling processing method based on a behavior tree is provided, the method being applied to a robot navigation system, the robot navigation system having a built-in behavior tree engine and a behavior tree corresponding to at least one asynchronous task, the method comprising:
[0023] The control node in the behavior tree monitors the execution status of the asynchronous action node under the control node in response to receiving an abnormal message during the process of the behavior tree engine executing the asynchronous task; wherein the abnormal message is used to indicate that the asynchronous action node under the control node has a fault;
[0024] In response to all asynchronous action nodes under the control node terminating execution, an error message is sent to the behavior tree engine, so that the behavior tree engine executes an error recovery process according to the received error message, or stops running the behavior tree.
[0025] Optionally, the method further comprises:
[0026] By traversing all nodes under the control node, identifying all asynchronous action nodes under the control node, and recording the identifiers of the identified asynchronous action nodes into a node list;
[0027] The monitoring the execution status of the asynchronous action node under the control node includes:
[0028] Based on the identifiers of the asynchronous action nodes recorded in the node list, the execution status of the asynchronous action node corresponding to each identifier is periodically queried.
[0029] Optionally, the periodically querying the execution status of the asynchronous action node corresponding to each identifier based on the identifiers of the asynchronous action nodes recorded in the node list includes:
[0030] Based on the identifiers of the asynchronous action nodes recorded in the node list, the first interface corresponding to each identifier is called to obtain the execution status of the corresponding asynchronous action node; the first interface is pre-configured for each asynchronous action node, and the first interface is used to query the execution status of the corresponding asynchronous action node.
[0031] In a third aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the first aspect are implemented.
[0032] In a fourth aspect, an electronic device is provided, including:
[0033] one or more processors; and
[0034] A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the first aspects above.
[0035] In a fifth aspect, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0036] The embodiment of the present application receives the first scheduling instruction, triggers the corresponding asynchronous action node in the behavior tree to perform the first scheduling operation, and after all relevant asynchronous action nodes complete the current operation, based on the received second scheduling instruction, instructs the asynchronous action node matching the second scheduling instruction to perform the second scheduling operation. This mechanism ensures that all asynchronous action nodes have completed their current tasks before executing new tasks, effectively reducing the risk of system instability caused by task conflicts, and significantly improving the success rate of robot task execution and the stability of the overall system.
[0037] In the embodiment of the present application, after receiving the abnormal message, the control node will not immediately send an error message to the behavior tree engine, but will feedback the error message to the behavior tree engine after confirming that all related asynchronous action nodes have terminated execution, triggering the necessary error recovery process or deciding whether to stop the further operation of the behavior tree. This mechanism not only improves the responsiveness of the behavior tree to abnormal situations, but also enhances the stability and reliability of the entire robot navigation system when facing asynchronous action node failures. This sophisticated error handling and monitoring mechanism enables the behavior tree engine to perform subsequent error recovery or stop operations after ensuring that all tasks are safely terminated, thereby protecting the integrity of the system and the safe operation of the robot. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0039] Figure 1 A flowchart of a behavior tree-based scheduling processing method provided in an embodiment of the present application;
[0040] Figure 2 A flowchart of a pause and resume processing method based on a behavior tree provided in an embodiment of the present application;
[0041] Figure 3 A flowchart of a behavior tree-based scheduling processing method provided in an embodiment of the present application;
[0042] Figure 4 A flowchart of a method for scheduling a controller node based on a behavior tree according to an embodiment of the present application;
[0043] Figure 5 A schematic block diagram of a scheduling processing device based on a behavior tree provided in an embodiment of the present application;
[0044] Figure 6 A schematic block diagram of a scheduling processing device based on a behavior tree provided in an embodiment of the present application;
[0045] Figure 7 A schematic block diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments in the present application belong to the scope of protection of this application.
[0047] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "said" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0048] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.
[0049] In the robot navigation system, the behavior tree is the core of decision-making and manages the robot's behavior. Asynchronous tasks are time-consuming and may cause delays in the robot's response, resulting in conflicts when receiving cancel and start commands, affecting the consistency of task execution and the stability of the system.
[0050] In view of this, the present application provides a new idea, and provides a scheduling processing method and device based on behavior tree. Figure 1 The flowchart of the behavior tree-based scheduling processing method provided in the embodiment of the present application can be applied in a robot navigation system. The robot navigation system has a built-in behavior tree engine and behavior tree corresponding to at least one asynchronous task. The robot navigation system can be set in any computer device with data storage and processing capabilities, can be set on the server side, and can also be set in a computer terminal with strong data processing capabilities. The execution subject of the method can be the behavior tree engine in the robot navigation system, and the method can include the following steps:
[0051] Step 101: In the process of executing an asynchronous task, the behavior tree engine, in response to receiving a first scheduling instruction, instructs the asynchronous action node in the behavior tree that matches the first scheduling instruction to execute a first scheduling operation corresponding to the first scheduling instruction;
[0052] Step 102: Monitor the execution status of the asynchronous action node;
[0053] Step 103: In response to receiving the second scheduling instruction, when the execution status of all asynchronous action nodes that execute the first scheduling operation is completed, instruct the asynchronous action nodes in the behavior tree that match the second scheduling instruction to execute the second scheduling operation corresponding to the second scheduling instruction.
[0054] The embodiment of the present application receives the first scheduling instruction, triggers the corresponding asynchronous action node in the behavior tree to perform the first scheduling operation, and after all relevant asynchronous action nodes complete the current operation, based on the received second scheduling instruction, instructs the asynchronous action node matching the second scheduling instruction to perform the second scheduling operation. This mechanism ensures that all asynchronous action nodes have completed their current tasks before executing new tasks, effectively reducing the risk of system instability caused by task conflicts, and significantly improving the success rate of robot task execution and the stability of the overall system.
[0055] The behavior tree in the robot navigation system is a tree structure used to describe the robot's navigation behavior. First, the basic concept of the behavior tree in the robot navigation system is introduced:
[0056] 1. Definition and Function
[0057] The behavior tree combines the advantages of state machines, decision trees, and scripting languages to organize the robot's navigation behavior in a hierarchical manner. It makes complex behavior logic clearer and easier to manage, and is the core behavior decision module in the robot's navigation system. The behavior tree is responsible for generating and executing corresponding navigation actions, such as obstacle avoidance, path planning, and target search, based on the robot's current state and target location.
[0058] 2. Basic Structure
[0059] The basic structure of a behavior tree consists of nodes and connections.
[0060] Node: A node is the basic unit of a behavior tree, responsible for executing specific behaviors or decisions. Nodes can be divided into the following categories based on their functions:
[0061] Control nodes: used to control the execution order and logic of child nodes, such as selectors, sequencers, etc. Selector nodes will execute child nodes in sequence until a node succeeds, while sequencer nodes will execute child nodes in sequence until a node fails.
[0062] Action node: performs specific navigation actions, such as moving to a specified location, stopping movement, etc.
[0063] Conditional node: Returns a Boolean value based on the current state or condition, which is used to control the execution of the process.
[0064] Connection: Connection is used to connect nodes to form a tree structure. Common connection types include sequence connection and selector connection. Sequence connection means that child nodes are executed in sequence until a node fails; while selector connection means that child nodes are executed in sequence until a node succeeds.
[0065] 3. Creation and Configuration
[0066] Creating and configuring a behavior tree in a robotic navigation system typically involves the following steps:
[0067] Define nodes: Use XML or YAML format to define behavior tree nodes, including control nodes, action nodes, and condition nodes.
[0068] Organize nodes: Organize nodes into a tree structure by connecting them, and define the execution order and logical relationship between nodes.
[0069] Configuration parameters: Configure necessary parameters for the node, such as target location, moving speed, etc.
[0070] Load Behavior Tree: Loads and initializes a behavior tree in the navigation system, enabling it to generate and execute navigation behaviors based on the current state and target position.
[0071] The following is a detailed description of each step in the above process and the effects that can be further produced in conjunction with the embodiments. It should be noted that the limitations such as "first" and "second" involved in the present disclosure do not have limitations in terms of size, order, and quantity, and are only used to distinguish them in name, for example, "first scheduling instruction" and "second scheduling instruction" are used to distinguish two scheduling instructions.
[0072] First, the above step 101, i.e., "in the process of executing an asynchronous task, the behavior tree engine, in response to receiving a first scheduling instruction, instructs the asynchronous action node in the behavior tree that matches the first scheduling instruction to execute a first scheduling operation corresponding to the first scheduling instruction" is described in detail in conjunction with the embodiment.
[0073] In robot navigation, asynchronous tasks refer to tasks that do not need to be completed immediately or can be executed in the background without blocking the main program flow. These tasks usually involve long-running operations or calculations or processing that need to be performed while the main program continues to execute other tasks. Asynchronous tasks allow the robot to continue other processing work while waiting for these tasks to complete, thereby improving overall efficiency and responsiveness. For example, asynchronous tasks can be path planning tasks, map building tasks, etc. Asynchronous action nodes refer to action nodes in behavior trees that execute asynchronous tasks.
[0074] In an embodiment of the present application, when a behavior tree engine receives a first scheduling instruction during the execution of an asynchronous task, based on the first scheduling instruction, it instructs an asynchronous action node in the behavior tree that matches the first scheduling instruction to execute a first scheduling operation corresponding to the first scheduling instruction.
[0075] Optionally, the first scheduling instruction may be a pause instruction, which is used to instruct the behavior tree engine to pause the execution of the current asynchronous task; or may be a cancel instruction, which is used to instruct the behavior tree engine to cancel the execution of the current asynchronous task.
[0076] When the first scheduling instruction is a pause instruction, the asynchronous action node matching the pause instruction executes a pause operation; when the first scheduling instruction is a cancel instruction, the asynchronous action node matching the cancel instruction executes a cancel operation.
[0077] Among them, in addition to the pause instruction and the cancel instruction, the first scheduling instruction may also include other types of instructions, such as switching instructions, updating instructions, re-planning instructions, emergency instructions, etc.
[0078] The above step 102, namely "monitoring the execution status of the asynchronous action node", is described in detail below in conjunction with an embodiment.
[0079] In the embodiment of the present application, after the behavior tree engine instructs the asynchronous action nodes matching the first scheduling instruction to execute the first scheduling operation, it enters the monitoring stage of the execution status of these asynchronous action nodes. In this stage, the behavior tree engine periodically queries the execution status of these asynchronous action nodes through a preset time period. This periodic checking mechanism enables the behavior tree engine to accurately grasp the progress of each asynchronous action node.
[0080] As an implementable method, the behavior tree engine can monitor the execution status of the asynchronous action node in the form of a node list. Specifically, when the behavior tree engine receives the first scheduling instruction, it traverses the behavior tree, identifies the asynchronous action node that matches the first scheduling instruction, and records the identifier of the matched asynchronous action node into the node list.
[0081] It should be noted that the above node list can be created after the behavior tree engine executes the asynchronous task, or after receiving the first scheduling instruction. This application does not limit its creation time.
[0082] Through the identifiers of the asynchronous action nodes recorded in the node list, the behavior tree engine can periodically query the execution status of each asynchronous action node. This process involves periodically calling the first interface corresponding to each identifier to obtain the execution status of the corresponding asynchronous action node, wherein the first interface is pre-configured for each asynchronous action node and is used to query the execution status of the corresponding asynchronous action node.
[0083] The execution status of an asynchronous action node usually includes: running status (running), success status (success) and failure status (failure).
[0084] The running state indicates that the asynchronous action node is executing a task; the successful state indicates that the asynchronous action node successfully completes a task; and the failed state indicates that the asynchronous action node encounters an error or exception when executing a task and fails to complete the task.
[0085] In the embodiment of the present application, when the behavior tree engine executes an asynchronous task, the asynchronous task will be decomposed into multiple subtasks, and each subtask is executed by a different asynchronous action node. When the behavior tree engine instructs these asynchronous action nodes to execute the corresponding first scheduling operation based on the first scheduling instruction, these asynchronous action nodes need a certain amount of time to complete the first scheduling operation. During the process of the asynchronous action nodes executing the first scheduling operation, the behavior tree engine monitors the execution status of these asynchronous action nodes until they return to a success state or a failure state.
[0086] It should be noted that if the behavior tree engine detects that the execution status of an asynchronous action node is in a failed state, it can respond according to the pre-configuration of the behavior tree. For example, the behavior tree engine executes a pre-defined error recovery process, or directly stops running the behavior tree, etc.
[0087] The node list in the embodiment of the present application can be set in the cache of the robot navigation system, so that the behavior tree engine can quickly access and update the execution status of the asynchronous action node, thereby accelerating the decision-making process of the behavior tree engine.
[0088] Furthermore, the behavior tree engine may also delete the identifier of the asynchronous action node whose execution status is a success status from the node list.
[0089] The embodiment of the present application can reduce the size of the node list by removing the identifiers of nodes that have been successfully executed, thereby reducing the memory resource usage of the robot navigation system; and as the number of entries in the node list decreases, the time required for the behavior tree engine to query the execution status of the asynchronous action node will also be reduced, thereby improving the overall operating efficiency.
[0090] The above step 103, i.e., "in response to receiving the second scheduling instruction, when the execution status of all asynchronous action nodes that execute the first scheduling operation is a success status, instructing the asynchronous action nodes that match the second scheduling instruction in the behavior tree to execute the second scheduling operation corresponding to the second scheduling instruction" is described in detail below in conjunction with the embodiments.
[0091] In the embodiment of the present application, the behavior tree engine needs to ensure that the previous tasks have been successfully completed before executing the subsequent operations. Specifically, when receiving the second scheduling instruction, the behavior tree engine will not immediately instruct the asynchronous action node that matches the second scheduling instruction to perform the corresponding operation, but will continue to monitor all asynchronous action nodes that execute the first scheduling operation until they all return a success status. Only when the execution status of all asynchronous action nodes that execute the first scheduling operation is a success status, will the asynchronous action node that matches the second scheduling instruction in the behavior tree be instructed to execute the second scheduling operation corresponding to the second scheduling instruction.
[0092] This strategy not only improves the reliability of task execution, but also enhances the responsiveness and flexibility of the system. By ensuring that each step starts after the previous step has been successfully completed, the behavior tree engine is able to maintain a clear and orderly task execution process, which is essential for complex and dynamic robot navigation tasks. In this way, the robot can seamlessly transition to the next task after the successful completion of one task, thereby achieving efficient and smooth operation.
[0093] Furthermore, before the execution status of all asynchronous action nodes that execute the first scheduling operation is in a successful state, if a second scheduling instruction is received, the second scheduling quality is stored in the cache, and after the execution status of all asynchronous action nodes that execute the first scheduling operation is in a successful state, the second scheduling instruction is obtained from the cache to instruct the asynchronous action nodes in the behavior tree that match the second scheduling instruction to execute the second scheduling operation corresponding to the second scheduling instruction.
[0094] The following takes the case where the first scheduling instruction is a pause instruction and the second scheduling instruction is a resume instruction as an example to illustrate the implementation process of the above-mentioned scheduling processing method based on the behavior tree.
[0095] like Figure 2 , which is a specific flow chart of the behavior tree-based scheduling processing method provided in an embodiment of the present application. Among them, only two asynchronous action nodes are shown in the figure, including asynchronous action node 1 and asynchronous action node 2. In actual applications, the number of asynchronous action nodes is set according to actual needs.
[0096] When the behavior tree engine receives an asynchronous task initiated by a caller, it starts the behavior tree to execute the asynchronous task. The asynchronous task is divided into subtask 1 and subtask 2, which are executed by asynchronous action node 1 and asynchronous action node 2 respectively. The caller here can be a user or a logical entity in the upper layer of the behavior tree in the robot navigation system.
[0097] During the process of the behavior tree engine executing an asynchronous task, if a pause instruction sent by the caller is received, the behavior tree engine first matches asynchronous action node 1 and asynchronous action node 2 according to the pause instruction, then caches the identifiers of asynchronous action node 1 and asynchronous action node 2 in the node list, then notifies asynchronous action node 1 to suspend the execution of subtask 1, notifies asynchronous action node 2 to suspend the execution of subtask 2, and then periodically calls the first interface of asynchronous action node 1 and asynchronous action node 2 from the node list based on the identifiers of asynchronous action node 1 and asynchronous action node 2 to query the execution status of asynchronous action node 1 and asynchronous action node 2. When the execution status of asynchronous action node 1 is successfully completed, the identifier of asynchronous action node 1 can be deleted from the node list, and only the execution status of asynchronous action node 2 needs to be queried periodically in the future. When the record in the node list is empty, it means that asynchronous action node 1 and asynchronous action node 2 have successfully suspended the execution of the corresponding task. At this time, according to the received resume instruction, asynchronous action node 1 and asynchronous action node 2 are instructed to resume the execution of subtask 1 and subtask 2 respectively.
[0098] Based on the same concept, the embodiment of the present application also provides a scheduling processing method based on a behavior tree, such as Figure 3 As shown, the method can be applied in a robot navigation system, which has at least one behavior tree engine and behavior tree corresponding to an asynchronous task built in the robot navigation system. The robot navigation system can be set in any computer device with data storage and processing capabilities, and can be set in a server or a computer terminal with strong data processing capabilities. The execution subject of the method can be a control node in the behavior tree engine, and includes the following steps:
[0099] Step 301: During the process of executing an asynchronous task in the behavior tree engine, the control node in the behavior tree monitors the execution status of the asynchronous action node under the control node in response to receiving an abnormal message; wherein the abnormal message is used to indicate that the asynchronous action node under the control node has a fault;
[0100] Step 302: In response to all asynchronous action nodes under the control node terminating execution, an error message is sent to the behavior tree engine, so that the behavior tree engine executes an error recovery process according to the received error message, or stops running the behavior tree.
[0101] In step 301, when a control node in a behavior tree receives an abnormal message, it means that one or more asynchronous action nodes under the control node encounter a fault or error when executing an asynchronous task.
[0102] In the prior art, when a control node receives an exception message, it will immediately feedback an error message to the behavior tree engine based on the exception message. However, for the asynchronous action nodes under the control node, since they execute asynchronous tasks, it takes a certain amount of time to terminate the execution. If the control node feedbacks an error message to the behavior tree engine, the execution status of the asynchronous action node under the control node is still in the running state. After receiving the error message, the behavior tree engine will execute the subsequent error recovery process or stop running the behavior tree. At this time, task conflict will occur, thereby increasing the risk of system instability.
[0103] Therefore, the embodiment of the present application introduces a monitoring mechanism, which monitors the execution status of the asynchronous action nodes under the control node when the control node receives an abnormal message.
[0104] The introduction of this mechanism avoids the situation where an asynchronous action node is not completely terminated and then immediately feeds back an error message to the behavior tree engine, thereby reducing the risk of task conflicts and system instability.
[0105] In step 302, when it is monitored that all asynchronous action nodes under the control node have terminated execution, an error message is sent to the behavior tree engine, so that the behavior tree engine executes an error recovery process according to the received error message, or stops running the behavior tree.
[0106] As an implementable method, when the behavior tree engine executes an asynchronous task, the control node can identify all asynchronous action nodes under the control node by traversing all nodes under the control node, and record the identifiers of the identified asynchronous action nodes into the node list.
[0107] Through the identifiers of the asynchronous action nodes recorded in the node list, the control node can periodically query the execution status of each asynchronous action node. This process involves periodically calling the first interface corresponding to each identifier to obtain the execution status of the corresponding asynchronous action node, wherein the first interface is pre-configured for each asynchronous action node and is used to query the execution status of the corresponding asynchronous action node.
[0108] The node list in the embodiment of the present application can be set in the cache of the robot navigation system, so that the behavior tree engine can quickly access and update the execution status of the asynchronous action node, thereby accelerating the decision-making process of the behavior tree engine.
[0109] In addition, the control node involved in the embodiments of the present application may be, but is not limited to, a decorator node, and the decorator node is used to modify and enhance the behavior of its child nodes.
[0110] In the embodiment of the present application, after receiving the abnormal message, the control node will not immediately send an error message to the behavior tree engine, but will feedback the error message to the behavior tree engine after confirming that all related asynchronous action nodes have terminated execution, triggering the necessary error recovery process or deciding whether to stop the further operation of the behavior tree. This mechanism not only improves the responsiveness of the behavior tree to abnormal situations, but also enhances the stability and reliability of the entire robot navigation system when facing asynchronous action node failures. This sophisticated error handling and monitoring mechanism enables the behavior tree engine to perform subsequent error recovery or stop operations after ensuring that all tasks are safely terminated, thereby protecting the integrity of the system and the safe operation of the robot.
[0111] The following takes the control node as a decorator node as an example to illustrate the implementation process of the above behavior tree-based scheduling processing method.
[0112] like Figure 4 As shown, it is a specific flow chart of the scheduling processing method based on the behavior tree provided in the embodiment of the present application. In the figure, one asynchronous action node is used to represent all asynchronous action nodes under the control node. In actual application, the number of asynchronous action nodes under the control node is set according to actual needs.
[0113] When the Behavior Tree Engine receives an asynchronous task initiated by a caller, it starts the Behavior Tree to execute the asynchronous task. The caller here can be a user or a logical entity in the robot navigation system that is located at the upper layer of the Behavior Tree.
[0114] When the Behavior Tree Engine executes asynchronous tasks, the control node will cache the identifiers of all its asynchronous action nodes in the node list. When receiving an exception message, it will query the node list to see if all its asynchronous action nodes have terminated execution. When all its asynchronous action nodes have terminated execution, it will return an error message to the Behavior Tree Engine, and the Behavior Tree Engine will then execute the error recovery process or stop running the Behavior Tree.
[0115] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0116] According to an embodiment of another aspect, a scheduling processing device based on a behavior tree is provided. Figure 5 A schematic block diagram of a scheduling processing device based on a behavior tree according to an embodiment is shown. The device can be applied to a robot navigation system. The robot navigation system has a built-in behavior tree engine and a behavior tree corresponding to at least one asynchronous task. The device can be set in the behavior tree engine, such as Figure 5 As shown, the device 500 includes:
[0117] The first scheduling unit 501 is configured to, in response to receiving a first scheduling instruction during the process of the behavior tree engine executing the asynchronous task, instruct the asynchronous action node in the behavior tree that matches the first scheduling instruction to execute a first scheduling operation corresponding to the first scheduling instruction;
[0118] A monitoring unit 502, configured to monitor the execution status of the asynchronous action node;
[0119] The second scheduling unit 503 is configured to, in response to receiving a second scheduling instruction, instruct the asynchronous action nodes in the behavior tree that match the second scheduling instruction to execute a second scheduling operation corresponding to the second scheduling instruction when the execution status of all asynchronous action nodes that execute the first scheduling operation is a success status.
[0120] Optionally, the device 500 may further include:
[0121] The recording unit 504 is configured to, in response to receiving the first scheduling instruction, identify an asynchronous action node matching the first scheduling instruction by traversing the behavior tree, and record the identifier of the matched asynchronous action node into a node list;
[0122] The monitoring unit 502 is specifically configured as follows:
[0123] Based on the identifiers of the asynchronous action nodes recorded in the node list, the execution status of the asynchronous action node corresponding to each identifier is periodically queried.
[0124] Optionally, the monitoring unit 502 is specifically configured as follows:
[0125] Based on the identifiers of the asynchronous action nodes recorded in the node list, the first interface corresponding to each identifier is periodically called to obtain the execution status of the corresponding asynchronous action node; the first interface is pre-configured for each asynchronous action node, and the first interface is used to query the execution status of the corresponding asynchronous action node.
[0126] Optionally, the device 500 may further include:
[0127] The deleting unit 505 is configured to delete the identifier of the asynchronous action node whose execution status is a success status found out from the node list.
[0128] Optionally, the device 500 may further include:
[0129] The cache unit 506 is configured to store the second scheduling instruction in a cache before the execution status of all asynchronous action nodes executing the first scheduling operation are all in a successful status;
[0130] The second scheduling unit 503 is configured to:
[0131] The second scheduling instruction is obtained from the cache, and the asynchronous action node in the behavior tree that matches the second scheduling instruction is instructed to execute a second scheduling operation corresponding to the second scheduling instruction.
[0132] According to an embodiment of another aspect, a scheduling processing device based on a behavior tree is provided. Figure 6 A schematic block diagram of a scheduling processing device based on a behavior tree according to an embodiment is shown. The device can be applied to a robot navigation system. The robot navigation system has a built-in behavior tree engine and a behavior tree corresponding to at least one asynchronous task. The device is set at a control node in the behavior tree. Figure 6 As shown, the device 600 includes:
[0133] The monitoring unit 601 is configured as a control node in the behavior tree, in response to receiving an abnormal message during the process of the behavior tree engine executing the asynchronous task, to monitor the execution status of the asynchronous action node under the control node; wherein the abnormal message is used to indicate that the asynchronous action node under the control node has a fault;
[0134] The sending unit 602 is configured to send an error message to the behavior tree engine in response to all asynchronous action nodes under the control node terminating execution, so that the behavior tree engine executes an error recovery process according to the received error message, or stops running the behavior tree.
[0135] The device 600 may further include:
[0136] The recording unit 603 is configured to identify all asynchronous action nodes under the control node by traversing all nodes under the control node, and record the identifiers of the identified asynchronous action nodes into a node list;
[0137] The monitoring unit 601 is specifically configured as follows:
[0138] Based on the identifiers of the asynchronous action nodes recorded in the node list, the execution status of the asynchronous action node corresponding to each identifier is periodically queried.
[0139] Optionally, the monitoring unit 601 is specifically configured as follows:
[0140] Based on the identifiers of the asynchronous action nodes recorded in the node list, the first interface corresponding to each identifier is called to obtain the execution status of the corresponding asynchronous action node; the first interface is pre-configured for each asynchronous action node, and the first interface is used to query the execution status of the corresponding asynchronous action node.
[0141] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can refer to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the batch task processing device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can refer to the partial description of the method embodiment. The batch task processing device embodiment described above is only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0142] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0143] In addition, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the steps of any one of the methods in the aforementioned method embodiments are implemented.
[0144] And an electronic device, comprising:
[0145] one or more processors; and
[0146] A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of the aforementioned method embodiments.
[0147] The present application also provides a computer program product, including a computer program, which implements the steps of any one of the methods in the aforementioned method embodiments when executed by a processor.
[0148] in, Figure 7 The architecture of the electronic device is shown as an example, which may include a processor 710, a video display adapter 711, a disk drive 712, an input / output interface 713, a network interface 714, and a memory 720. The processor 710, the video display adapter 711, the disk drive 712, the input / output interface 713, the network interface 714, and the memory 720 may be communicatively connected via a communication bus 730.
[0149] Among them, the processor 710 can be implemented by a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., to execute relevant programs to implement the technical solutions provided in this application.
[0150] The memory 720 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 720 can store an operating system 721 for controlling the operation of the electronic device 700, and a basic input and output system (BIOS) 722 for controlling the low-level operation of the electronic device 700. In addition, a web browser 723, a data storage management system 724, and a behavior tree-based scheduling processing device 400 / 500, etc. can also be stored. The above-mentioned behavior tree-based scheduling processing device 400 / 500 can be an application program that specifically implements the operations of the aforementioned steps in the embodiment of the present application. In short, when the technical solution provided in the present application is implemented by software or firmware, the relevant program code is stored in the memory 720 and is called and executed by the processor 710.
[0151] The input / output interface 713 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0152] The network interface 714 is used to connect to a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0153] The bus 730 comprises a pathway for transmitting information between the various components of the device (eg, the processor 710, the video display adapter 711, the disk drive 712, the input / output interface 713, the network interface 714, and the memory 720).
[0154] It should be noted that, although the above device only shows a processor 710, a video display adapter 711, a disk drive 712, an input / output interface 713, a network interface 714, a memory 720, a bus 730, etc., in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include components necessary for implementing the solution of the present application, and does not necessarily include all the components shown in the figure.
[0155] It can be known from the description of the above implementation methods that those skilled in the art can clearly understand that the present application can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the present application can be essentially or partly contributed to the prior art in the form of a computer program product, which can be stored in a storage medium such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present application or certain parts of the embodiments.
[0156] The technical solution provided by the present application is described in detail above. The principle and implementation method of the present application are described in detail using specific examples. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as limiting the present application.
Claims
1. A scheduling processing method based on behavior tree, characterized in that: The method is applied to a robot navigation system, wherein the robot navigation system has a built-in behavior tree engine and a behavior tree corresponding to at least one asynchronous task, and the method comprises: In response to receiving a first scheduling instruction during the execution of the asynchronous task, the behavior tree engine instructs an asynchronous action node in the behavior tree that matches the first scheduling instruction to execute a first scheduling operation corresponding to the first scheduling instruction; Monitoring the execution status of the asynchronous action node; In response to receiving a second scheduling instruction, when the execution status of all asynchronous action nodes that execute the first scheduling operation is a success status, instructing the asynchronous action nodes in the behavior tree that match the second scheduling instruction to execute a second scheduling operation corresponding to the second scheduling instruction.
2. The method according to claim 1, characterized in that The method further comprises: In response to receiving the first scheduling instruction, identifying an asynchronous action node matching the first scheduling instruction by traversing the behavior tree, and recording an identifier of the matched asynchronous action node into a node list; The monitoring the execution status of the asynchronous action node includes: Based on the identifiers of the asynchronous action nodes recorded in the node list, the execution status of the asynchronous action node corresponding to each identifier is periodically queried.
3. The method according to claim 2, characterized in that: Based on the identifiers of the asynchronous action nodes recorded in the node list, periodically querying the execution status of the asynchronous action node corresponding to each identifier, including: Based on the identifiers of the asynchronous action nodes recorded in the node list, the first interface corresponding to each identifier is periodically called to obtain the execution status of the corresponding asynchronous action node; the first interface is pre-configured for each asynchronous action node, and the first interface is used to query the execution status of the corresponding asynchronous action node.
4. The method according to claim 2, characterized in that: The method further comprises: The identifier of the asynchronous action node whose execution status is a success status is deleted from the node list.
5. The method according to claim 1, characterized in that Before the execution status of all asynchronous action nodes executing the first scheduling operation is a success status, storing the second scheduling instruction in a cache; Based on the second scheduling instruction, instructing the asynchronous action node in the behavior tree that matches the second scheduling instruction to execute a second scheduling operation corresponding to the second scheduling instruction includes: The second scheduling instruction is obtained from the cache, and the asynchronous action node in the behavior tree that matches the second scheduling instruction is instructed to execute a second scheduling operation corresponding to the second scheduling instruction.
6. The method according to any one of claims 1 to 5, characterized in that The first scheduling instruction includes a pause instruction or a cancel instruction; The second scheduling instruction includes a recovery instruction.
7. A scheduling processing method based on behavior tree, characterized in that: The method is applied to a robot navigation system, wherein the robot navigation system has a built-in behavior tree engine and a behavior tree corresponding to at least one asynchronous task, and the method comprises: The control node in the behavior tree monitors the execution status of the asynchronous action node under the control node in response to receiving an abnormal message during the process of the behavior tree engine executing the asynchronous task; wherein the abnormal message is used to indicate that the asynchronous action node under the control node has a fault; In response to all asynchronous action nodes under the control node terminating execution, an error message is sent to the behavior tree engine, so that the behavior tree engine executes an error recovery process according to the received error message, or stops running the behavior tree.
8. The method according to claim 7, characterized in that The method further comprises: By traversing all nodes under the control node, identifying all asynchronous action nodes under the control node, and recording the identifiers of the identified asynchronous action nodes into a node list; The monitoring the execution status of the asynchronous action node under the control node includes: Based on the identifiers of the asynchronous action nodes recorded in the node list, the execution status of the asynchronous action node corresponding to each identifier is periodically queried.
9. The method according to claim 8, characterized in that The periodically querying the execution status of the asynchronous action node corresponding to each identifier based on the identifiers of the asynchronous action nodes recorded in the node list includes: Based on the identifiers of the asynchronous action nodes recorded in the node list, the first interface corresponding to each identifier is called to obtain the execution status of the corresponding asynchronous action node; the first interface is pre-configured for each asynchronous action node, and the first interface is used to query the execution status of the corresponding asynchronous action node.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method described in any one of claims 1 to 9 are implemented.
11. An electronic device, characterized in that: include: one or more processors; as well as A memory associated with the one or more processors, the memory being used to store program instructions, wherein the program instructions, when read and executed by the one or more processors, execute the steps of the method described in any one of claims 1 to 9.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Controlling process of robots having a behavior tree architecture
CN108780303A
Unmanned system cluster control method based on behavior tree
CN113534662A
Data capture engine development method and execution method, equipment and storage medium
CN115408595A
Data processing method and device for dynamic analysis of behavior tree
CN117194186A
Autonomous task arranging and scheduling system and method for inspection robot
CN117400243A