A behavior tree-based scheduling processing method
By introducing a behavior tree-based scheduling method into the robot navigation system, the execution status of asynchronous tasks is monitored and the safe termination of tasks is ensured, thus solving the system instability problem caused by asynchronous tasks and improving the success rate of task execution and system stability.
Patent Information
- Application Number
- CN202411998110.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In robot navigation systems, the execution of asynchronous tasks can lead to task conflicts and system instability, especially when the robot cannot respond in time to cancel and start commands, affecting the consistency of task execution and system stability.
By introducing a behavior tree-based scheduling method into the robot navigation system, the execution status of asynchronous action nodes is monitored, and new instructions are executed only after all nodes have completed their current operations. This ensures that error recovery or stop operations are performed after the task is safely terminated, thus avoiding task conflicts.
It effectively reduces the risk of system instability, improves the success rate of robot task execution and the overall system stability, and enhances responsiveness and flexibility.
Smart Images

Figure CN119973978B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of robot navigation, and in particular to a scheduling processing method based on a behavior tree. BACKGROUND
[0002] In a robot navigation system, a behavior tree (BT) is the control core of the task execution flow, and guides the behavior decision of the robot through its hierarchical node structure. Among these tasks, especially asynchronous tasks, because they may involve time-consuming operations, the robot may not be able to respond to scheduling instructions in real time in the real world. For example, due to physical inertia or task characteristics, the robot may need additional time to adjust its actions smoothly. In this case, if the action node fails to completely stop after receiving a cancellation instruction, and the system immediately receives a start instruction, it may lead to inconsistency in task execution. This inconsistency may cause task conflicts, thereby increasing the risk of system instability, affecting the success rate of the robot executing tasks and the stability of the system. SUMMARY
[0003] Therefore, the present application provides a scheduling processing method based on a behavior tree to reduce the risk of system instability caused by task conflicts.
[0004] The present application provides the following solutions:
[0005] In a first aspect, a scheduling processing method based on a behavior tree is provided. The method is applied to a robot navigation system, and the robot navigation system has at least one behavior tree engine and a behavior tree corresponding to an asynchronous task. The method comprises:
[0006] In response to receiving a first scheduling instruction, the behavior tree engine instructs an asynchronous action node in the behavior tree that matches the first scheduling instruction to perform a first scheduling operation corresponding to the first scheduling instruction during execution of the asynchronous task.
[0007] The execution state of the asynchronous action node is monitored.
[0008] In response to receiving a second scheduling instruction, when the execution states of all asynchronous action nodes performing the first scheduling operation are successful, the behavior tree instructs an asynchronous action node in the behavior tree that matches the second scheduling instruction to perform 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, an asynchronous action node matching the first scheduling instruction is identified by traversing the behavior tree, and an identifier of the matched asynchronous action node is recorded in a node list;
[0011] The monitoring of the execution status of the asynchronous action node includes:
[0012] Based on the identifier of the asynchronous action node 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 identifier of the asynchronous action node recorded in the node list, the execution status of the asynchronous action node corresponding to each identifier is periodically queried, including:
[0014] Based on the identifier of the asynchronous action node recorded in the node list, a 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 includes:
[0016] The identifier of the asynchronous action node with a successful execution status queried is deleted from the node list.
[0017] Optionally, before the execution status of all asynchronous action nodes performing the first scheduling operation is successful, the second scheduling instruction is stored in a cache;
[0018] Based on the second scheduling instruction, the asynchronous action node in the behavior tree matching the second scheduling instruction is instructed to perform a second scheduling operation corresponding to the second scheduling instruction, including:
[0019] The second scheduling instruction is obtained from the cache, and the asynchronous action node in the behavior tree matching the second scheduling instruction is instructed to perform 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 resume instruction.
[0022] In a second aspect, a behavior tree-based scheduling processing method is provided, which is applied to a robot navigation system, the robot navigation system internally builds a behavior tree engine and a behavior tree corresponding to at least one asynchronous task, and the method includes:
[0023] The control node in the behavior tree monitors execution statuses of the asynchronous action nodes under the control node in response to receiving an exception message during execution of the asynchronous task by the behavior tree engine, where the exception message is used to represent that an asynchronous action node under the control node has failed;
[0024] In response to all asynchronous action nodes under the control node terminating execution, an error message is sent to the behavior tree engine to make the behavior tree engine execute an error recovery process according to the received error message or stop running the behavior tree.
[0025] Optionally, the method further includes:
[0026] By traversing all nodes under the control node, all asynchronous action nodes under the control node are identified, and the identification of the identified asynchronous action nodes is recorded in a node list.
[0027] The monitoring of the execution statuses of the asynchronous action nodes under the control node includes:
[0028] Based on the identification of the asynchronous action nodes recorded in the node list, the execution statuses of the asynchronous action nodes corresponding to each identification are periodically queried.
[0029] Optionally, the periodically querying of the execution statuses of the asynchronous action nodes corresponding to each identification based on the identification of the asynchronous action nodes recorded in the node list includes:
[0030] Based on the identification of the asynchronous action nodes recorded in the node list, a first interface corresponding to each identification is called to obtain the execution status of the corresponding asynchronous action node, where the first interface is preconfigured for each asynchronous action node in advance, 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, which stores a computer program. The program is executed by a processor to implement the steps of the method of any one of the first aspect.
[0032] In a fourth aspect, an electronic device is provided, which includes:
[0033] one or more processors; and
[0034] a memory associated with the one or more processors, the memory being configured to store program instructions, which, when executed by the one or more processors, implement the steps of the method of any one of the first aspect.
[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 the method of any one of the above first aspect.
[0036] The embodiments of the present application trigger the corresponding asynchronous action nodes in the behavior tree to perform the first scheduling operation by receiving the first scheduling instruction, and after all related asynchronous action nodes complete the current operation, instruct the asynchronous action nodes matched with the second scheduling instruction to perform the second scheduling operation based on the received second scheduling instruction. 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 embodiments of the present application, after receiving the exception message, the control node does not immediately send an error message to the behavior tree engine, but confirms that all related asynchronous action nodes have terminated execution, and then feeds back the error message to the behavior tree engine, triggering the necessary error recovery process or deciding whether to stop the further running of the behavior tree. This mechanism not only improves the response ability 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 fine error handling and monitoring mechanism enables the behavior tree engine to ensure the safe termination of all tasks before performing subsequent error recovery or stopping operations, thereby protecting the integrity of the system and the safe operation of the robot. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0039] Figure 1 The flowchart of the scheduling processing method based on the behavior tree provided by the embodiments of the present application;
[0040] Figure 2 The flowchart of the suspension and recovery processing method based on the behavior tree provided by the embodiments of the present application;
[0041] Figure 3 The flowchart of the scheduling processing method based on the behavior tree provided by the embodiments of the present application;
[0042] Figure 4 The flowchart of the scheduling processing method of the controller node based on the behavior tree provided by the embodiments of the present application;
[0043] Figure 5 a schematic block diagram of a scheduling processing apparatus based on a behavior tree provided by an embodiment of the present application;
[0044] Figure 6 a schematic block diagram of a scheduling processing apparatus based on a behavior tree provided by an embodiment of the present application;
[0045] Figure 7 a schematic block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0046] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.
[0047] The terms used in the embodiments of the present application are merely for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include the plural forms, unless the context clearly indicates otherwise.
[0048] It should be understood that the term "and / or" used herein is merely to describe the association relationship of the associated objects, which means that there can be three relationships, for example, A and / or B can represent the three cases of A alone, A and B together, and B alone. In addition, the character " / " herein generally represents an "or" relationship between the front and rear associated objects.
[0049] In a robot navigation system, a behavior tree is used as a decision core to manage robot behaviors. Asynchronous tasks may cause a delay in the response of the robot due to long time consumption, thereby causing conflicts when receiving cancel and start instructions, 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 a behavior tree. Figure 1 A flowchart of a scheduling processing method based on a behavior tree provided by an embodiment of the present application, which can be applied in a robot navigation system. The robot navigation system is built-in with a behavior tree engine and a 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 capability, which can be set in a server end or a computer terminal with strong data processing capability. 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 an asynchronous action node in the behavior tree that matches the first scheduling instruction to perform a first scheduled 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 a second scheduling instruction, when the execution status of all asynchronous action nodes executing the first scheduled operation is completed, instruct an asynchronous action node in the behavior tree that matches the second scheduling instruction to perform a second scheduled operation corresponding to the second scheduling instruction.
[0054] The embodiments of the present application trigger the corresponding asynchronous action node in the behavior tree to execute the first scheduled operation by receiving the first scheduling instruction, and then instruct the asynchronous action node that matches the second scheduling instruction to execute the second scheduled operation based on the received second scheduling instruction after all related asynchronous action nodes complete the current 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, while significantly improving the success rate of robot task execution and the stability of the overall system.
[0055] The behavior tree in a robot navigation system is a tree structure used to describe the navigation behavior of a robot. First, the basic concepts of the behavior tree in the robot navigation system are introduced:
[0056] I. Definition and Function
[0057] The behavior tree combines the advantages of state machines, decision trees, and scripting languages to organize the navigation behavior of the robot in a hierarchical manner. It makes complex behavior logic more clear and easy to manage, and is the core behavior decision module in the robot navigation system. The behavior tree is responsible for generating and executing corresponding navigation actions such as obstacle avoidance, path planning, target search, etc. according to the current state and target position of the robot.
[0058] II. Basic Structure
[0059] The basic structure of the behavior tree includes nodes (Nodes) and connections (Connections).
[0060] Nodes: Nodes are the basic units of the behavior tree, responsible for executing specific behaviors or decisions. According to the function, nodes can be divided into the following categories:
[0061] Control nodes: Nodes used to control the execution order and logic of sub-nodes, such as Selector and Sequence. Selector nodes execute sub-nodes in order until a node succeeds, while Sequence nodes execute sub-nodes in order until a node fails.
[0062] Action nodes: Nodes that perform specific navigation actions, such as moving to a specified location or stopping movement.
[0063] Condition nodes: Nodes that return a Boolean value based on the current state or condition, used to control the execution of the flow.
[0064] Connections: Connections used to connect nodes together to form a tree-like structure. Common connection types include Sequence Connection and Selector Connection. Sequence Connection indicates that sub-nodes are executed in order until a node fails, while Selector Connection indicates that sub-nodes are executed in order until a node succeeds.
[0065] Three, creation and configuration
[0066] Creating and configuring a behavior tree in a robot navigation system typically involves the following steps:
[0067] Defining nodes: Defining the nodes of the behavior tree using formats such as XML or YAML, including control nodes, action nodes, and condition nodes.
[0068] Organizing nodes: Organizing nodes into a tree-like structure through connections, defining the execution order and logical relationship between nodes.
[0069] Configuring parameters: Configuring necessary parameters for nodes, such as target location and movement speed.
[0070] Loading the behavior tree: Loading and initializing the behavior tree in the navigation system, enabling it to generate and execute navigation behaviors based on the current state and target location.
[0071] The following embodiments will be described in detail. It should be noted that the "first", "second", etc. in this disclosure do not have the limitations of size, order and quantity, but are only used to distinguish the names, for example, "first scheduling instruction" and "second scheduling instruction" are used to distinguish two scheduling instructions.
[0072] First, the above step 101, i.e., "the behavior tree engine, in the process of executing an asynchronous task, in response to receiving a first scheduling instruction, 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", will be described in detail.
[0073] In robot navigation, asynchronous tasks refer to those 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 done while the main program continues to execute other tasks. Asynchronous tasks allow the robot to continue with 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. An asynchronous action node refers to an action node in the behavior tree that executes asynchronous tasks.
[0074] In the embodiments of the present application, when the behavior tree engine receives a first scheduling instruction during the execution of an asynchronous task, it instructs the asynchronous action nodes in the behavior tree that match the first scheduling instruction to execute the first scheduling operation corresponding to the first scheduling instruction based on the first scheduling instruction.
[0075] Optionally, the first scheduling instruction can be a pause instruction, which is used to instruct the behavior tree engine to pause the execution of the current asynchronous task, or 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 nodes that match the pause instruction then execute a pause operation. When the first scheduling instruction is a cancel instruction, the asynchronous action nodes that match the cancel instruction then execute a cancel operation.
[0077] In addition to the pause instruction and the cancel instruction, the first scheduling instruction can also include other types of instructions, such as a switch instruction, an update instruction, a re-planning instruction, an emergency instruction, etc.
[0078] The above step 102, i.e., "monitoring the execution state of the asynchronous action nodes", will be described in detail below in conjunction with an embodiment.
[0079] In the embodiments of the present application, after the behavior tree engine instructs the asynchronous action nodes that match the first scheduling instruction to execute the first scheduling operation, it enters a monitoring phase for the execution state of these asynchronous action nodes. In this phase, the behavior tree engine regularly queries the execution state of these asynchronous action nodes through a pre-set time period. This periodic checking mechanism allows the behavior tree engine to accurately grasp the progress of each asynchronous action node.
[0080] As an implementable manner, the behavior tree engine can adopt a manner of a node list to monitor the execution status of the asynchronous action nodes. Specifically, after the behavior tree engine receives the first scheduling instruction, the behavior tree engine identifies the asynchronous action node matched with the first scheduling instruction by traversing the behavior tree, and records the identifier of the matched asynchronous action node into the node list.
[0081] It should be noted that the node list can be created after the behavior tree engine executes the asynchronous task, or can be created after the behavior tree engine receives the first scheduling instruction. The application does not limit the creation time.
[0082] Through the identifier of the asynchronous action node 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 in advance, and is used to query the execution status of the corresponding asynchronous action node.
[0083] The execution status of the asynchronous action node usually includes a running status, a success status and a failure status.
[0084] The running status indicates that the asynchronous action node is executing a task; the success status indicates that the asynchronous action node successfully completes a task; and the failure status indicates that the asynchronous action node encounters an error or exception when executing a task, and fails to complete a task.
[0085] In the embodiment of the application, when the behavior tree engine executes an asynchronous task, the asynchronous task is decomposed into a plurality of sub-tasks, and each sub-task is executed by a different asynchronous action node. When the behavior tree engine instructs the asynchronous action nodes to execute the corresponding first scheduling operation based on the first scheduling instruction, the asynchronous action nodes need a certain time to complete the first scheduling operation. During the execution of the first scheduling operation by the asynchronous action nodes, the behavior tree engine monitors the execution status of the asynchronous action nodes until they return the success status or the failure status.
[0086] It should be noted that if the behavior tree engine monitors that the execution status of a certain asynchronous action node is the failure status, the behavior tree engine can respond according to the pre-configuration of the behavior tree. For example, the behavior tree engine executes a predefined error recovery process, or directly stops running the behavior tree, and the like.
[0087] The node list in the embodiment of the 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 nodes, thereby accelerating the decision-making process of the behavior tree engine.
[0088] Further, the behavior tree engine can also delete the identification of the asynchronous action node with the execution state of success from the node list.
[0089] By removing the node identification that has been successfully executed, the embodiments of the present application can reduce the size of the node list, thereby reducing the occupation of memory resources in the robot navigation system. Moreover, as the entries in the node list decrease, the time required by the behavior tree engine to query the execution state of the asynchronous action node will also decrease, thereby improving the overall running efficiency.
[0090] The above step 103, i.e., "in response to receiving the second scheduling instruction, instructing the asynchronous action node matching the second scheduling instruction in the behavior tree to perform the second scheduling operation corresponding to the second scheduling instruction when the execution states of all asynchronous action nodes performing the first scheduling operation are success states", will be described in detail below in combination with embodiments.
[0091] In the embodiments of the present application, the behavior tree engine needs to ensure that all previous tasks have been successfully completed before performing subsequent operations. Specifically, when the second scheduling instruction is received, the behavior tree engine does not immediately instruct the asynchronous action node matching the second scheduling instruction to perform the corresponding operation, but continuously monitors all asynchronous action nodes performing the first scheduling operation until they all return success states. Only when the execution states of all asynchronous action nodes performing the first scheduling operation are success states, the asynchronous action node matching the second scheduling instruction in the behavior tree is instructed to perform 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 only after the previous step is successfully completed, the behavior tree engine can maintain a clear and orderly task execution process, which is crucial for complex and dynamic robot navigation tasks. In this way, the robot can seamlessly transition to the next task after a task is successfully completed, thereby achieving efficient and smooth operation.
[0093] Further, before the execution states of all asynchronous action nodes performing the first scheduling operation are success states, if the second scheduling instruction is received, the second scheduling quality is stored in the cache, and after the execution states of all asynchronous action nodes performing the first scheduling operation are success states, the second scheduling instruction is obtained from the cache to instruct the asynchronous action node matching the second scheduling instruction in the behavior tree to perform the second scheduling operation corresponding to the second scheduling instruction.
[0094] The implementation process of the above scheduling processing method based on the behavior tree will be described below by taking the first scheduling instruction as a pause instruction and the second scheduling instruction as a resume instruction as an example.
[0095] As Figure 2 shown, a specific flowchart of the scheduling processing method based on the behavior tree provided by the embodiment of the application is shown. In the figure, only two asynchronous action nodes are shown, including asynchronous action node 1 and asynchronous action node 2. In actual application, 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, the behavior tree engine starts the behavior tree to execute the asynchronous task, which is divided into subtask 1 and subtask 2, and is executed by asynchronous action node 1 and asynchronous action node 2 respectively. The caller here can be a user or a logical entity in a robot navigation system located above the behavior tree.
[0097] In the process of executing the asynchronous task by the behavior tree engine, 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 into a node list, then notifies asynchronous action node 1 to pause the execution of subtask 1 and notifies asynchronous action node 2 to pause the execution of subtask 2, and then periodically calls the first interface of asynchronous action node 1 and asynchronous action node 2 based on the identifiers of asynchronous action node 1 and asynchronous action node 2 from the node list to query the execution states of asynchronous action node 1 and asynchronous action node 2. When it is monitored that the execution state of asynchronous action node 1 is successfully completed, the identifier of asynchronous action node 1 can be deleted from the node list, and subsequently only the execution state of asynchronous action node 2 needs to be queried periodically. When the record in the node list is empty, it means that asynchronous action node 1 and asynchronous action node 2 have both successfully paused the execution of the corresponding tasks. At this time, in response 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 application also provides a scheduling processing method based on a behavior tree. As Figure 3 shown, the method can be applied in a robot navigation system, the robot navigation system is built-in at least one behavior tree engine and behavior tree corresponding to an asynchronous task, and the robot navigation system can be set in any computer device with data storage and processing capability, and can be set in a server end or a computer terminal with strong data processing capability. The execution subject of the method can be a control node in the behavior tree engine, including the following steps:
[0099] Step 301: In the process of executing an asynchronous task by a control node in a behavior tree, the execution state of an asynchronous action node under the control node is monitored in response to receiving an exception message; wherein the exception message is used to represent that the asynchronous action node under the control node has failed.
[0100] Step 302: In response to the termination of execution of all asynchronous action nodes under the control node, an error message is sent to the behavior tree engine to make the behavior tree engine execute an error recovery process according to the received error message or stop running the behavior tree.
[0101] In step 301, when the control node in the behavior tree receives an exception message, it means that one or more asynchronous action nodes under the control node encounter a failure or error when executing an asynchronous task.
[0102] In the prior art, when the control node receives an exception message, an error message is immediately fed back 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 time to terminate execution. If the control node feeds back an error message to the behavior tree engine when the execution state of the asynchronous action nodes under the control node is still in a running state, and the behavior tree engine executes a subsequent error recovery process or stops running the behavior tree after receiving the error message, a task conflict occurs, thereby increasing the risk of instability of the system.
[0103] Therefore, the embodiment of the present application introduces a monitoring mechanism. When the control node receives an exception message, the execution state of the asynchronous action nodes under the control node is monitored.
[0104] The introduction of this mechanism avoids the urgent feedback of an error message to the behavior tree engine when the asynchronous action nodes have not completely terminated, thereby reducing the risk of task conflict and system instability.
[0105] In step 302, when it is monitored that all asynchronous action nodes under the control node terminate execution, an error message is sent to the behavior tree engine to make the behavior tree engine execute an error recovery process according to the received error message or stop running the behavior tree.
[0106] As a realizable manner, 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 in a node list.
[0107] Through the identifiers of the asynchronous action nodes recorded in the node list, the control node can periodically query the execution state of each asynchronous action node. This process involves periodically calling a first interface corresponding to each identifier to obtain the execution state 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 state of the corresponding asynchronous action node.
[0108] The node list in the embodiments 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 state of the asynchronous action nodes, 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 can be but is not limited to a decorator node, which is used to modify and enhance the behavior of the child nodes thereunder.
[0110] In the embodiments of the present application, after receiving the exception message, the control node does not immediately send an error message to the behavior tree engine, but confirms that all related asynchronous action nodes have terminated execution, and then feeds back an error message to the behavior tree engine to trigger the necessary error recovery process or decide whether to stop the further running of the behavior tree. This mechanism not only improves the response capability of the behavior tree to abnormal situations, but also enhances the stability and reliability of the entire robot navigation system when facing the failure of asynchronous action nodes. This fine error handling and monitoring mechanism enables the behavior tree engine to ensure the safe termination of all tasks before performing subsequent error recovery or stopping operation, 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-mentioned behavior tree-based scheduling processing method.
[0112] As shown in Figure 4 , it is a specific flowchart of the behavior tree-based scheduling processing method provided by the embodiments 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, the behavior tree engine starts the behavior tree to execute the asynchronous task. The caller here can be a user or a logical entity located above the behavior tree in the robot navigation system.
[0114] In the process of executing the asynchronous task by the behavior tree engine, the control node caches the identifiers of all asynchronous action nodes thereunder into the node list, and when receiving an exception message, queries from the node list whether all asynchronous action nodes thereunder have terminated execution, and when all asynchronous action nodes thereunder have terminated execution, returns an error message to the behavior tree engine, and the behavior tree engine executes the error recovery process or stops running the behavior tree.
[0115] The above describes particular embodiments of the present specification. Other embodiments are within the scope of the appended claims. In some cases, the acts or steps recited in the claims can be performed in a different order than the order in which they are recited and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve the desired results. In certain implementations, multitasking and parallel processing can be advantageous or necessary.
[0116] According to another aspect, embodiments of a behavior tree based scheduling processing apparatus are provided. Figure 5 A schematic block diagram of a behavior tree based scheduling processing apparatus according to an embodiment is shown, which can be applied in a robot navigation system, the robot navigation system being built-in a behavior tree engine corresponding to at least one asynchronous task and a behavior tree, the apparatus can be disposed in the behavior tree engine, as shown in Figure 5 The apparatus 500 comprises:
[0117] A first scheduling unit 501 configured to, in a process that the behavior tree engine executes the asynchronous task, in response to receiving a first scheduling instruction, instruct an asynchronous action node in the behavior tree that matches the first scheduling instruction to perform a first scheduling operation corresponding to the first scheduling instruction.
[0118] A monitoring unit 502 configured to monitor an execution state of the asynchronous action node.
[0119] A second scheduling unit 503 configured to, in response to receiving a second scheduling instruction, instruct an asynchronous action node in the behavior tree that matches the second scheduling instruction to perform a second scheduling operation corresponding to the second scheduling instruction, when execution states of all asynchronous action nodes performing the first scheduling operation are successful states.
[0120] Optionally, the apparatus 500 can further comprise:
[0121] A recording unit 504 configured to, in response to receiving the first scheduling instruction, identify the asynchronous action node that matches the first scheduling instruction by traversing the behavior tree, and record an identification of the matched asynchronous action node into a node list.
[0122] The monitoring unit 502 is specifically configured to:
[0123] Periodically query the execution state of the asynchronous action node corresponding to each identification based on the identification of the asynchronous action node recorded in the node list.
[0124] Optionally, the monitoring unit 502 is specifically configured to:
[0125] Based on the identification of the asynchronous action nodes recorded in the node list, periodically call the first interface corresponding to each identification to obtain the execution status of the corresponding asynchronous action node; the first interface is pre-configured for each asynchronous action node in advance, and the first interface is used to query the execution status of the corresponding asynchronous action node.
[0126] Optionally, the apparatus 500 can further include:
[0127] The deletion unit 505 is configured to delete the identification of the asynchronous action node with the successful execution status from the node list.
[0128] Optionally, the apparatus 500 can further include:
[0129] The cache unit 506 is configured to store the second scheduling instruction in the cache before all the asynchronous action nodes performing the first scheduling operation have the successful execution status.
[0130] The second scheduling unit 503 is configured to:
[0131] Obtain the second scheduling instruction from the cache, and instruct the asynchronous action node matching the second scheduling instruction in the behavior tree to perform the second scheduling operation corresponding to the second scheduling instruction.
[0132] According to another aspect, embodiments of a behavior tree-based scheduling processing apparatus are provided. Figure 6 A schematic block diagram of a behavior tree-based scheduling processing apparatus according to an embodiment is shown, which can be applied to a robot navigation system, the robot navigation system being built-in at least a behavior tree engine and a behavior tree corresponding to an asynchronous task, and the apparatus is arranged at a control node in the behavior tree. As shown, the apparatus 600 includes: Figure 6
[0133] The monitoring unit 601 is configured to monitor the execution status of the asynchronous action nodes under the control node in response to receiving an exception message during the execution of the asynchronous task by the behavior tree engine; wherein the exception message is used to represent that the asynchronous action nodes under the control node have failed.
[0134] The sending unit 602 is configured to send an error message to the behavior tree engine in response to all the asynchronous action nodes under the control node terminating the execution, so that the behavior tree engine performs an error recovery process according to the received error message, or stops running the behavior tree.
[0135] The apparatus 600 can 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 in a node list.
[0137] The monitoring unit 601 is specifically configured to:
[0138] Periodically query the execution status of each asynchronous action node corresponding to the identifier based on the identifier of the asynchronous action node recorded in the node list.
[0139] Optionally, the monitoring unit 601 is specifically configured to:
[0140] Call a first interface corresponding to each identifier based on the identifier of the asynchronous action node recorded in the node list 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 the specification is described in a progressive manner, and the same or similar parts between each embodiment can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for the batch task processing device embodiment, it is basically similar to the method embodiment, so it is described more simply. The relevant parts can be referred to the part of the method embodiment. The above-described batch task processing device embodiment is only illustrative, and the units described as separate components can or can not be physically separated, and the components displayed as units can or can not be physical units, i.e. they can be located in one place or distributed on multiple network units. According to the actual needs, some or all of the modules can be selected to achieve the purpose of the embodiment. Those skilled in the art can understand and implement without creative labor.
[0142] It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or authorized by all parties, and the collection, use and processing of related data need to comply with relevant laws, regulations and standards of relevant countries and regions, and provide corresponding operation portal for user to choose authorization or refusal.
[0143] In addition, the embodiment of the present application also provides a computer readable storage medium having a computer program stored thereon, the program being executed by a processor to implement the steps of the method of any one of the preceding method embodiments.
[0144] and an electronic device comprising:
[0145] one or more processors; and
[0146] a memory associated with the one or more processors, the memory for storing program instructions that, when read and executed by the one or more processors, perform the steps of the method of any of the preceding method embodiments.
[0147] The present application also provides a computer program product comprising a computer program which, when executed by a processor, implements the steps of the method of any of the preceding method embodiments.
[0148] wherein, Figure 7 An exemplary architecture of the electronic device is shown, which can specifically 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 can be communicatively connected through a communication bus 730.
[0149] The processor 710 can be implemented in the form of a general-purpose CPU, a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, etc., for executing related programs to implement the technical solutions provided by the present application.
[0150] The memory 720 can be implemented in the form of a ROM (Read Only Memory), a RAM (Random Access Memory), a static storage device, a dynamic storage device, etc. The memory 720 can store an operating system 721 for controlling the operation of the electronic device 700, a basic input / 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 apparatus 400 / 500, etc. can also be stored. The behavior tree-based scheduling processing apparatus 400 / 500 can be an application program that specifically implements the above-mentioned step operations in the embodiments of the present application. In summary, when the technical solutions provided by the present application are implemented by software or firmware, the relevant program codes are stored in the memory 720 and executed by the processor 710.
[0151] The input / output interface 713 is configured to connect an input / output module to realize information input and output. The input / output module can be configured as a component in the device (not shown in the figure) or externally connected to the device to provide corresponding functions. The input device can include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device can include a display, a speaker, a vibrator, an indicator light, etc.
[0152] The network interface 714 is configured to connect a communication module (not shown in the figure) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired manner (such as a USB, a network cable, etc.) or a wireless manner (such as a mobile network, WIFI, Bluetooth, etc.).
[0153] The bus 730 includes a path for transmitting information between various components (such as 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) of the device.
[0154] It should be noted that although the above device only shows the processor 710, the video display adapter 711, the disk drive 712, the input / output interface 713, the network interface 714, the memory 720, and the bus 730, in the specific implementation process, the device can also include other components necessary for normal operation. In addition, those skilled in the art can understand that the above device can also only contain the components necessary to implement the scheme of the present application, and does not have to contain all the components shown in the figure.
[0155] From the above description of the embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and a general hardware platform. Based on such understanding, the technical solutions of the present application can be embodied in the form of a computer program product, which can be stored in a storage medium such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a plurality of instructions for causing 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 or some parts of the embodiments.
[0156] The technical solutions provided by the present application are described in detail above, and the principle and implementation manner of the present application are described by applying specific examples. The above description of the embodiments is only to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, the specific implementation manner and application range can be changed. In conclusion, the content of the specification should not be understood as a limitation of 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 having a built-in behavior tree engine and behavior tree corresponding to at least one asynchronous task. The method includes: In response to receiving a first scheduling instruction during execution of the asynchronous task, the behavior tree engine traverses the behavior tree, identifies an asynchronous action node that matches the first scheduling instruction, records the identifier of the matched asynchronous action node in a node list, and 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. 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; 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 state, 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: 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: 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.
3. The method according to claim 1, characterized in that The method further comprises: The identifier of the asynchronous action node whose execution status is a success state is deleted from the node list.
4. The method according to claim 1, wherein 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.
5. The method according to any one of claims 1 to 4, characterized in that The first scheduling instruction includes a pause instruction or a cancel instruction; The second scheduling instruction includes a recovery instruction.
6. A scheduling processing method based on behavior tree, characterized in that: The method is applied to a robot navigation system having a built-in behavior tree engine and behavior tree corresponding to at least one asynchronous task. The method includes: In response to receiving an exception message during the process of the behavior tree engine executing the asynchronous task, the control node in the behavior tree traverses all nodes under the control node, identifies all asynchronous action nodes under the control node, and records the identifiers of the identified asynchronous action nodes in a node list; based on the identifiers of the asynchronous action nodes recorded in the node list, periodically queries the execution status of the asynchronous action node corresponding to each identifier; wherein the exception message indicates that a failure has occurred in the asynchronous action node under the control node; 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.
7. The method according to claim 6, 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.
8. 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 according to any one of claims 1 to 7 are implemented.
9. 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, perform the steps of the method according to any one of claims 1 to 7.
10. 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 7 are implemented.
Citation Information
Patent Citations
Navigation task control method, mobile device, electronic device and medium
CN119862052A