CGF mission planning simulation method, device and equipment based on customized behavior tree
By introducing customized planning subtrees into the behavior tree and combining it with the planner for task planning, the problem of low reusability and efficiency of existing behavior tree modeling in complex scenarios is solved, and efficient and intelligent customization of the behavior tree model is achieved. Mission planning.
Patent Information
- Application Number
- CN202410909166.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-08
- Publication Date
- 2024-09-13
- Estimated Expiration
- 2044-07-08
AI Technical Summary
In the existing behavior tree modeling, in complex scenarios that combine task planning and reactive decision-making, the model is difficult to reuse, manual modeling is inefficient, and there is a lack of domain-oriented analysis and customization, resulting in a heavy workload and non-standardization of behavior tree modeling.
Design a CGF task planning method based on customized behavior trees. By obtaining task scenarios for behavioral modeling, a reactive basic behavior tree is constructed, and the static obstacle avoidance sub-unit blocks and walking sub-unit blocks are replaced with customized planning sub-trees to form a customized The hybrid reactive behavior tree combines the planner for task planning and outputs sub-goals or action sequences to achieve concise and reasonable switching of behaviors.
It improves the reusability and manual modeling efficiency of the behavior tree model, enhances intelligence in typical scenarios, supports domain-oriented analysis customization, and simplifies the behavior switching process.
Smart Images

Figure CN118446034B
Abstract
Description
Technical Field
[0001] The present application relates to the field of simulation technology, and in particular to a CGF task planning simulation method, device and equipment based on a customized behavior tree. Background Art
[0002] Computer-generated forces (CGF) are autonomous or semi-autonomous virtual agents that can simulate human behavior and respond to events and conditions in a virtual field environment. By introducing CGF to reduce the need for physical objects, venues, and personnel in training, the cost of training can be greatly reduced, and the diversity and flexibility of training can be increased.
[0003] As a CGF modeling characterized by anthropomorphism, the core lies in making CGF behavior modeling closer to human behavior. Usually, the behavior modeling of participating units in target transaction simulation can be divided into physical behavior modeling and cognitive behavior modeling. Among them, physical behavior modeling mainly reflects the direct interaction between participating entities and the environment during the execution of target transactions, mainly involving relevant physical principles. Cognitive behavior is to model the command process and capabilities of participating entities. The core is to simulate a series of human thinking processes from information input to judgment and decision-making, which is the main research direction of behavior modeling. From the perspective of the generation of behavior, behavior modeling can be divided into two categories. One emphasizes direct description of behavior output, such as behavior modeling based on knowledge engineering. The main methods include finite state machines, rule systems, Petri nets, behavior trees, etc.; the other emphasizes thinking like humans and making judgments through reasoning, such as behavior modeling based on cognitive structures. However, different types of behavior modeling have their own advantages and disadvantages: the former has a simple structure, clear description, and easy-to-understand internal logic, but it is difficult to obtain the decision logic knowledge and behavior rules required for modeling; the latter is more human-like, has strong adaptive capabilities, and is suitable for cross-domain models, but the specific implementation method of the model is abstract. How to build a robust and adaptable behavior model is still a major challenge facing CGF behavior modeling.
[0004] In general, behavior trees are still the mainstream method for the research and practice of intelligent agent behavior modeling in the simulation field. Similar to traditional knowledge engineering methods such as finite state machines and script rules, in addition to retaining the characteristics of output that meets design expectations, easy development, and readable models, the characteristics of hierarchy, modularity, visualization, and both reaction and planning capabilities also make it have the advantages of strong generalization, scalability, and easy reuse. Nowadays, many game engines or companies provide behavior tree visualization design and development tools to customize and improve behavior tree nodes according to business characteristics. However, because the grammatical structure of the behavior tree is very flexible, it only constrains the selection, sequence, condition, action and other types of nodes with certain rules, and lacks field-oriented analysis and customization. Especially for complex scenarios that combine task planning with reactive decision-making, the basic behavior tree modeling workload is large, non-standard and unfriendly, resulting in difficult model reuse and low efficiency of manual modeling. Summary of the invention
[0005] Based on this, it is necessary to provide a CGF task planning simulation method, device and equipment based on a customized behavior tree to address the above technical problems.
[0006] A CGF task planning simulation method based on a customized behavior tree, the method comprising:
[0007] Obtain task scenarios for behavioral modeling.
[0008] According to the predefined action priority in the task scenario, a reactive basic behavior tree is constructed; the reactive basic behavior tree includes: a root node, and multiple basic action sub-unit blocks connected to the root node; the multiple basic action sub-unit blocks include: an escape action sub-unit block, a static obstacle avoidance sub-unit block, and a walking sub-unit block.
[0009] According to the task to be planned of the intelligent agent, the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree are replaced with a customized planning sub-tree to obtain a customized hybrid reactive behavior tree; the customized planning sub-tree is used to execute the planning action node to perceive the environment and accept the task to be planned. The planner completes the calculation and solution of the planning task, outputs a series of sub-goals or action sequences, and the control node calls the basic actions in sequence according to the planning output loop to realize the output sequence.
[0010] In one embodiment, the root node of the reactive basic behavior tree is a selection node, which is used to control the execution flow of the entire reactive basic behavior tree.
[0011] Multiple basic action sub-unit blocks are used to realize the agent's response to dynamic and static environments and walking actions. The agent's task is completed by calling the sub-unit blocks according to the priority from left to right and walking to the target point.
[0012] In one embodiment, the subunit block includes a sequence node, a judgment or perception node, and an action node; the sequence node connects the judgment or perception node and the action node.
[0013] The sub-unit block is used to be controlled by the sequence node, and the judgment or perception node directly determines whether to execute the basic action of the action node; the basic actions include: escape action, obstacle avoidance action and walking action.
[0014] In one embodiment, according to the task to be planned by the agent, the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree are replaced with a customized planning sub-tree, and the customized hybrid reactive behavior tree is obtained as follows:
[0015] T = Selector ( Sequence ( C1 , A1 ), … , Sequence ( Cn , An ), PST )
[0016] Where T is the overall structure of the behavior tree model; PST represents a general planning subtree; Selector is a node type in the behavior tree, used to manage the execution order of multiple Sequence nodes; Sequence is the node type of the sequential execution mechanism in the behavior tree, and Sequence (Cn, An) is a sequential execution sequence consisting of two child nodes, Cn and An, where Cn and An represent different basic behaviors or tasks.
[0017] In one of the embodiments, the priority of the customized planning subtree is from left to right; the root node of the customized planning subtree is a sequential node, the planning target detection subtree is set on the left, and the planning execution subtree is set on the right, and the basic actions are iteratively executed according to the output plan.
[0018] The custom planning subtree replaces the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree.
[0019] In one embodiment, the root node of the planning target detection subtree is connected to a selection node and a sequence node; the root node is a sequence node with two child nodes, and the selection node is connected to two conditional nodes for measuring the planning distance. When the agent has not yet planned, there is no sub-target state or it is far away from the current sub-target state, the selection node is executed successfully and enters the execution of the next sequence node.
[0020] The sequence node connects two action nodes; it is used to use the current state of the agent as the sub-goal planning state, and execute the planning execution node to call the preset planning algorithm and output the planning result; if the agent updates the planning state, the planning target detection subtree is executed successfully, and the execution of this round of customized planning subtree ends; if the agent is not updated, the left side returns success as a whole, and the root node of the planning target detection subtree controls the agent to enter the execution of the planning execution subtree. The root node is a sequence node.
[0021] In one embodiment, the plan execution subtree is used to loop into the plan execution subtree when the agent does not update the plan, and loop-call specific action execution nodes or achieve a series of sub-goals according to the plan until the plan goal is reached or a high-priority reactive behavior execution interrupts the plan execution.
[0022] In one of the embodiments, the planning execution subtree follows the walking subunit block, which is composed of a selector with three child nodes and three behavior blocks; the first behavior block is used to determine whether the intelligent agent has reached the final target point, and if it has reached it, the entire path planning and the behavior of following the path walking are terminated; the second behavior block is used to determine whether the target node in the current path needs to be updated according to the position of the intelligent agent. Since each walk needs to take a point on the optimal path as the target in turn, when it is determined that the intelligent agent has reached the currently set target node in the path, the target node is updated to the next point in the optimal path; when the first two behavior blocks are not executed, the third behavior block executes the basic action of approaching the current target point.
[0023] A CGF task planning simulation device based on a customized behavior tree, the device comprising:
[0024] The task-relative acquisition module is used to obtain task assumptions for behavior modeling.
[0025] The reactive basic behavior tree construction module is used to construct a reactive basic behavior tree according to the predefined action priority in the task assumption; the reactive basic behavior tree includes: a root node, and multiple basic action sub-unit blocks connected to the root node; the multiple basic action sub-unit blocks include: an escape action sub-unit block, a static obstacle avoidance sub-unit block, and a walking sub-unit block.
[0026] The customized hybrid reactive behavior tree construction module is used to replace the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree with a customized planning sub-tree according to the task to be planned of the intelligent agent, so as to obtain a customized hybrid reactive behavior tree; the customized planning sub-tree is used to execute the planning action node to perceive the environment and accept the task to be planned, and the planner completes the calculation and solution of the task to be planned, and outputs a series of sub-goals or action sequences, and the control node calls the basic action in sequence according to the planning output loop to realize the output sequence.
[0027] A computer device comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above method when executing the computer program.
[0028] The CGF task planning simulation method, device and equipment of the above-mentioned customized behavior tree, the method realizes the switching of different behaviors to complete the corresponding task by designing a reactive basic behavior tree; then, in view of the shortcomings of behavior switching in the reactive basic behavior tree, a customized behavior tree with a planning part is customized on the basis of the basic behavior tree, and the sub-goal execution priority is adjusted through the target detection subtree, and a behavior mechanism combining planning and reactivity is constructed to realize concise and reasonable behavior switching. Compared with the basic behavior tree designed and developed completely from the bottom layer using general basic nodes, the customized behavior tree that supports the customized assembly of basic nodes and structures and the supplementary development of necessary decision logic can realize the specific behavior tree model faster, and can be analyzed and customized for the field, so that the model has strong reusability, high efficiency of manual modeling, and high intelligence of modeling in typical scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 A flowchart of a CGF task planning simulation method based on a customized behavior tree in one embodiment;
[0030] Figure 2 is a structural diagram of a basic behavior tree in an embodiment;
[0031] Figure 3 It is a functional structure diagram of the planning part in an embodiment;
[0032] Figure 4 A general structure diagram for planning subtrees for custom behavior trees;
[0033] Figure 5 This is the overall structure diagram of a general custom behavior tree;
[0034] Figure 6 A first subtree structure for path planning in an embodiment;
[0035] Figure 7 A second subtree structure for path planning in one embodiment;
[0036] Figure 8 A structural diagram of a customized behavior tree combined with A* path planning in one embodiment;
[0037] Fig. 9 A structural block diagram of a CGF task planning simulation device based on a customized behavior tree in one embodiment;
[0038] Fig.10 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0039] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0040] In one embodiment, Figure 1 As shown, a CGF task planning simulation method based on a customized behavior tree is provided, and the method comprises the following steps:
[0041] Step 100: Obtain task scenarios for behavioral modeling.
[0042] Specifically, the mission scenario mainly introduces the typical mission background of CGF, determines the attacker and defender of this adversarial exercise, the specific tasks to be performed, and the construction of the behavior tree.
[0043] Step 102: Construct a reactive basic behavior tree according to the predefined action priority in the task scenario; the reactive basic behavior tree includes: a root node, and multiple basic action sub-unit blocks connected to the root node; the multiple basic action sub-unit blocks include: an escape action sub-unit block, a static obstacle avoidance sub-unit block, and a walking sub-unit block.
[0044] Specifically, the attack and defense scenarios of the attacker and defender are selected as the simulation platform, and the training task of the defender's security defense is selected as the modeling task. By building the defender's defense strategy behavior tree, the defender's behavior decision-making system in a certain scenario environment is simulated, and the behavior tree is customized by planning the defender's actual tasks.
[0045] The defensive strategy behavior tree is a basic reactive behavior tree. The reactive architecture is as follows Figure 2 As shown in the figure, reactive behavior decisions are directly based on predefined priority rules, which realizes a direct mapping from perception information to decision actions. Specifically, each sub-unit block in the behavior tree is controlled by a sequence node, which connects a judgment or perception node and an action node. Whether to execute an action is directly determined by perception, without the need for complex planning calculations.
[0046] The reactive basic behavior tree is directly based on predefined priority rules, and realizes a direct mapping from perception information to decision-making actions. Specifically, each sub-unit block in the behavior tree is controlled by a sequence node, which connects a judgment or perception node and an action node. The perception directly determines whether to execute the action without complex planning calculations. In the tree structure, the sub-unit blocks that control different actions are executed in order of priority from left to right. When a unit block runs successfully, other blocks on its right will no longer be executed.
[0047] like Figure 3 As shown in the figure, the defense strategy behavior tree of the uncustomized node realizes the behavior switching of the intelligent agent for typical tasks in the field by constructing a sub-unit block that combines "conditions + execution", and completes the tasks of safely avoiding obstacles and reaching the target point.
[0048] Step 104: According to the task to be planned of the agent, the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree are replaced with a customized planning sub-tree to obtain a customized hybrid reactive behavior tree; the customized planning sub-tree is used to execute the planning action node to perceive the environment and accept the task to be planned, and the planner completes the calculation and solution of the task to be planned, outputs a series of sub-goals or action sequences, and the control node calls the basic actions in sequence according to the planning output loop to realize the output sequence.
[0049] Specifically, compared with the reactive basic behavior tree, the customized hybrid reactive behavior tree can achieve long-term planning of tasks by building a general planning subtree.
[0050] The design of the customized hybrid reactive behavior tree is based on the design of the reactive basic behavior tree, which can realize the reuse of nodes and structures for more convenient and standardized domain model combination development. The design of the customized hybrid reactive behavior tree is to add the planning part to the basic behavior tree, and to build a hybrid reactive behavior tree by specially customizing the behavior tree planning action node; by adjusting the priority of the planning execution subtree, a behavior mechanism combining long-term planning and reactiveness is constructed.
[0051] The planning part of the customized hybrid reactive behavior tree includes a planning action node, a planning execution basic action node, a planning target detection subtree, and a control node that cyclically calls basic actions according to the planning output. It is equivalent to introducing a planner for the reactive action node combination based on the behavior tree to solve the planning of the agent task, eliminating the problems and increased time that may arise from repeated calls to reactive decisions. The planning action node calculates and solves the input overall task, and outputs a series of sub-goals or action sequences. The planning target detection subtree detects the distance between the agent state and the sub-goal in real time to update and determine the execution order of the sub-goals, and calls the planning execution basic actions cyclically according to the planning output through the control node to achieve the sub-goals in sequence.
[0052] The planning subtree includes the planning target detection subtree and the planning execution subtree, which is equivalent to introducing a planner for the action node of the basic behavior tree of the behavior reaction type, planning the task in advance, and outputting the plan as a series of sub-goals or action sequences, and selecting the link to the next sub-goal according to the state update. This subtree replaces the static obstacle avoidance and walking sub-unit blocks in the basic behavior tree, avoiding local difficulties and failure to reach the target to complete the task due to only using reactive behavior switching.
[0053] When calling the custom planning subtree, the execution planning action node senses the environment and accepts the task, and the task calculation is solved by the planner, and a series of sub-goals or action sequences are output. The control node calls the basic actions in sequence according to the planning output cycle to achieve the output sequence. Among them, the basic action can be set according to some common task solutions, which is a general action node or node combination executed in conjunction with the custom planning subtree.
[0054] The planning action node is the sum of the planner and the action node. The planner part is equivalent to the combination of judgment and decision. For example, the planner in the embodiment is a path planning planner, which mainly calculates the path and then gives the determined path to the action node to perform the maneuver.
[0055] In this application, an agent refers to an entity with autonomous behavior capabilities that can perceive the environment, make decisions, and perform corresponding actions. In fields such as robotics, artificial intelligence, and game development, an agent is a common concept used to describe an autonomous system that can interact with the environment.
[0056] An intelligent agent can be, but is not limited to, a robot, a self-driving car, a character in a game, etc.
[0057] About the agent example:
[0058] Robots: Autonomous robots working in homes, factories, or warehouses can be considered intelligent agents. Robots sense their surroundings through equipped sensors (such as cameras, radars, etc.) and obtain information about obstacles, targets, and other entities; make decisions based on preset tasks or rules. Decision making specifically refers to: based on the perceived environmental information, the robot determines the next action through behavior trees or other decision algorithms. For example, if an obstacle is detected ahead, the robot may choose obstacle avoidance behavior; and perform corresponding actions (such as moving, grabbing objects, etc.). Executing actions specifically means: once decision making is completed, the robot will perform the corresponding action. This may include moving (such as moving forward, backward, turning, etc.), operating tools (such as grabbing, placing objects, etc.), or sending signals (such as communicating with other robots).
[0059] Self-driving cars: Self-driving cars are also intelligent entities. They use sensors to perceive the surrounding environment, including roads, other vehicles, and pedestrians, and then make decisions based on this information, such as accelerating, decelerating, and turning, to achieve safe driving and reach the destination.
[0060] In-game characters: In video games, characters controlled by players or NPCs (non-player characters) in games can also be considered as intelligent entities. These characters can move, attack, defend, etc. according to the player's operations or preset AI rules.
[0061] In the CGF task planning simulation method of the above-mentioned customized behavior tree, the method realizes the switching of different behaviors to complete the corresponding tasks by designing a reactive basic behavior tree; then, in view of the shortcomings of behavior switching in the reactive basic behavior tree, a customized behavior tree with a planning part is customized on the basis of the basic behavior tree, and the sub-goal execution priority is adjusted through the target detection subtree, and a behavior mechanism combining planning and reactivity is constructed to realize concise and reasonable behavior switching. Compared with the basic behavior tree designed and developed completely from the bottom layer using general basic nodes, the customized behavior tree that supports the customized assembly of basic nodes and structures and the supplementary development of necessary decision logic can realize the specific behavior tree model faster, and can be analyzed and customized for the field, so that the model has strong reusability, high efficiency of manual modeling, and high intelligence of modeling in typical scenarios.
[0062] In one embodiment, the root node of the reactive basic behavior tree in step 102 is a selection node, which is used to control the execution process of the entire reactive basic behavior tree; multiple basic action sub-unit blocks are respectively used to realize the agent's reaction to dynamic and static environments and walking actions, and the agent's task is completed by walking to the target point by calling the sub-unit blocks according to the priority from left to right.
[0063] Specifically, the root node of the reactive basic behavior tree is the selection node, which is the entry point of the entire behavior tree and can control the execution process of the entire behavior. It usually includes multiple sub-unit blocks, which represent the basic behavior actions of the agent to complete the task. The multiple sub-unit blocks that can be called represent escape actions, obstacle avoidance actions, and walking actions. The sub-unit blocks respectively realize the agent's response to the dynamic and static environment and the walking action. By calling the sub-unit blocks according to the priority from left to right, the agent walks to the target point to complete the task.
[0064] In one embodiment, the sub-unit block includes a sequence node, a judgment or perception node and an action node; the sequence node connects the judgment or perception node and the action node; the sub-unit block is used to be controlled by the sequence node, and the judgment or perception node directly perceives and determines whether to execute the basic action of the action node; the basic actions include: escape action, obstacle avoidance action and walking action.
[0065] Specifically, in the structure of the reactive basic behavior tree, the sub-unit blocks representing behaviors are all perception and action sequences. The root node of the reactive basic behavior tree is the selection node, and the three sub-unit blocks below represent escape actions, obstacle avoidance actions, and walking actions, which are executed in order from left to right. When a unit block runs successfully, the other blocks on its right will no longer be executed. The priority of the left unit block is higher than that of the right one.
[0066] Figure 2In the leftmost sub-unit block, the defender determines whether there is an attacker in the field of view by executing the conditional node perception. If there is an attacker, the defender executes the escape action. The process is to obtain the position of the nearest red attacker through the sensor and set it as the escape target, and use the target steering vector to calculate the steering force required to move in the opposite direction of the target. Similarly, in the middle sub-unit block, the defender first determines whether there is an obstacle in the field of view by the conditional node perception. If there is an obstacle, the defender executes the obstacle avoidance action. If the above unit blocks fail to execute successfully, it proves that there is no attacker or obstacle in the field of view, then the agent runs the rightmost sub-unit block and executes the straight-line walking action to the target point to complete the training task of the defender's safe defense.
[0067] Specifically speaking of the operation process of the defender's basic behavior tree, first the selector selects the behavior through the conditional node to realize the switching and selection of each state of the behavior tree. The existing agent parameters are input into the behavior tree, and after the corresponding nodes and state parameters are changed, the entity movement is updated according to the new steering force or target point, and the sensory part and the agent position status (whether it has reached the target point, etc.) are updated, and then the selection-execution process is circulated until the agent completes the task.
[0068] In one embodiment, step 104 includes: according to the task to be planned of the agent, replacing the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree with a customized planning sub-tree, and obtaining a customized hybrid reactive behavior tree as follows:
[0069] T = Selector ( Sequence ( C1 , A1 ), … , Sequence ( Cn , An ), PST )
[0070] Among them, T is the overall structure of the behavior tree model; PST represents a general planning subtree; Selector is a node type in the behavior tree, used to manage the execution order of multiple Sequence nodes; Sequence is the node type of the sequential execution mechanism in the behavior tree. The Sequence node will be executed in the order of its child nodes. Only when all child nodes are successfully executed, the Sequence node will return success. If any child node fails to execute, the Sequence node will immediately return failure and will not continue to execute subsequent child nodes; Sequence (Cn, An) is a sequential execution sequence composed of two child nodes, Cn and An, where Cn and An represent different basic behaviors or tasks.
[0071] Each situation subtree corresponds to a state-action pair in the decision space, and the last one is a known task planning space. The equivalence of the expressive power of other tree structure models can be proved through predicate logic deduction.
[0072] In one of the embodiments, the priority of the customized planning subtree is from left to right; the root node of the customized planning subtree is a sequential node, the planning target detection subtree is set on the left, and the planning execution subtree is set on the right, and the basic actions are iteratively executed according to the output plan; the customized planning subtree replaces the static obstacle avoidance subunit block and the walking subunit block in the reactive basic behavior tree.
[0073] In one embodiment, the root node of the planning target detection subtree is connected to a selection node and a sequence node; the root node is a sequence node with two child nodes, the selection node is connected to two condition nodes, and is used to measure the planning distance. When the agent has not yet planned, there is no sub-target state or it is far away from the current sub-target state, the selection node is executed successfully and enters the execution of the next sequence node; the sequence node is connected to two action nodes; it is used to use the current state of the agent as the sub-target planning state, and execute the planning execution node to call the preset planning algorithm and output the planning result; if the agent updates the planning state, the planning target detection subtree is executed successfully, and the execution of this round of customized planning subtree ends; if the agent is not updated, the left side returns success as a whole, and the root node of the planning target detection subtree controls the agent to enter the execution of the planning execution subtree. The root node is a sequence node.
[0074] In one embodiment, the plan execution subtree is used to loop into the plan execution subtree when the agent does not update the plan, and loop-call specific action execution nodes or achieve a series of sub-goals according to the plan until the plan goal is reached or a high-priority reactive behavior execution interrupts the plan execution.
[0075] In one of the embodiments, the planning execution subtree follows the walking subunit block, which is composed of a selector with three child nodes and three behavior blocks; the first behavior block is used to determine whether the intelligent agent has reached the final target point, and if it has reached it, the entire path planning and the behavior of following the path walking are terminated; the second behavior block is used to determine whether the target node in the current path needs to be updated according to the position of the intelligent agent. Since each walk needs to take a point on the optimal path as the target in turn, when it is determined that the intelligent agent has reached the currently set target node in the path, the target node is updated to the next point in the optimal path; when the first two behavior blocks are not executed, the third behavior block executes the basic action of approaching the current target point.
[0076] In a specific embodiment, for path planning, a common planning task for a mobile agent, a planning subtree based on the A* algorithm is designed. The planning action node can solve the global path of the defender from the current location to the target location. The path consists of multiple path points that serve as sub-goals of the path planning task, and the output order is the default path planning order.
[0077] After the path solution is completed at the planning action node, basic action nodes such as obtaining the next sub-target node and maneuvering to the target can be defined, and the sub-target condition detection of whether the path point has been reached can be combined to form a concise behavior tree combination structure framework for path planning tasks.
[0078] like Figure 4 As shown in the figure, in the general structure of the planning subtree of the custom behavior tree, the default tree structure is from left to right according to the priority. The root node of the subtree is a sequential node. The planning target detection subtree is set on the left, and the planning execution subtree is set on the right. The basic actions are iterated according to the output plan.
[0079] The planning target detection subtree on the left consists of a sequence node connecting a selection node and a sequence node. The selection node connects two conditional nodes and is responsible for measuring the planning distance. When the agent has not yet planned, there is no sub-target state, or it is far away from the current sub-target state, the selection node is executed successfully and enters the execution of the next sequence node. The sequence node connects two action nodes. First, the current state of the agent is used as the sub-target planning state, and based on this, the planning execution node is executed, the planning algorithm is called, and the planning result is output. If the agent updates the planning state, the planning target detection subtree is executed successfully, and the execution of this round of planning subtree ends. If it is not updated, it means that the agent operates according to the planning state, and the overall return on the left is successful. The sequence node as the root node controls the agent to enter the execution of the planning execution subtree.
[0080] The plan execution subtree on the right is set according to the specific plan output. When the agent does not update the plan, it loops into the plan execution subtree and loops to call specific action execution nodes or achieve a series of sub-goals according to the plan until the plan goal is reached or the high-priority reactive behavior execution interrupts the plan execution.
[0081] like Figure 5 As shown in the figure, in a general custom behavior tree, the default tree structure is from left to right according to the priority. The root node is the selection node, and the planning subtree with the lowest priority is set on the far right to complete the planning calculation and iterative execution of the output plan action. Figure 5 A mid-loop node refers to a node that calls a specific action execution node or achieves a series of sub-goals according to a planned loop.
[0082] A reactive situation processing sub-unit block is placed before the planning subtree, which is controlled by a sequence node. It can be a perception-action structure block or multiple conditions and action sequences, because the detection of conditions may be multiple and the reactive action may be several action sequences.
[0083] The structure represents the division of the entire state space by different conditional nodes. The subtree contained in each sequence node can be considered as the disposal strategy when the task state space is in a certain situation. Therefore, the decision-making process of the behavior tree can be regarded as continuously judging and disposing of unknown situations in the task.
[0084] For known planning tasks, the planning subtree is used to solve and execute. When the environment does not change dynamically, the agent executes according to the planned sub-goal sequence or action sequence. After reactively processing the unknown situation, the planning subtree will first determine the sub-goal state by the planning goal detection subtree, decide whether to re-plan the task, output a new sub-goal or action sequence, and then enter the planning execution subtree to select basic actions to execute.
[0085] In another embodiment, the path planning subtree of the customization part consists of two subtrees connected by a selector as a parent node, the first subtree is responsible for calculating the optimal path to follow using the A* algorithm, and the second subtree is responsible for moving along the set path.
[0086] The root node of the first subtree is a sequence node with two child nodes. The first child node determines whether the A* algorithm must be executed again to calculate the optimal path to the target point. When the agent performs other actions and does not loop through the planned execution subtree, this node needs to determine whether the current position of the agent is far away from the target node in the current path. If the agent is too far away from the target node in the path, it proves that the agent has deviated from the planned route before and needs to re-execute the A* algorithm for path planning. If the agent has just been initialized and the A* algorithm has not been executed, the A* algorithm will also be called.
[0087] If the previous selection node is successful, the second sequential node is executed, and the current position of the agent is re-recorded as the path starting point in the A* algorithm. The end point of the algorithm path remains unchanged, and the A* algorithm is re-called to obtain the new current position to the target point to the optimal path. The first subtree structure of the complete path planning is as follows Figure 6 shown.
[0088] The second subtree is the path-following part, which consists of a selector with three child nodes and three behavior blocks. The first behavior block is to determine whether the agent has reached the final target point. If it has reached the final target point, it will end the entire path planning and path-following behavior. The second behavior block determines whether it is necessary to update the target node in the current path based on the position of the agent. Since each walk needs to take a point on the optimal path as the target in turn, when it is determined that the defender has reached the currently set target node in the path, the target node is updated to the next point in the optimal path. When the first two behavior blocks are not executed, the basic action of approaching the target node in the current path is executed. The second subtree structure of the complete path planning is as follows: Figure 7 shown.
[0089] After the planning subtree model of the path planning part is constructed, it is equivalent to an encapsulated A* planner. This planning subtree has good use value in both global path planning and local planning. It only needs to input map information and the current position of the agent to achieve the optimal obstacle avoidance walking of the agent. For global path planning, it is only necessary to input the information of the static map and the starting position of the agent; in the dynamic planning process, if other reactive behavior nodes are combined before this path planning subtree, the priority of the subtree and each behavior node can be adjusted to achieve selective execution of path planning based on the execution results of other dynamic behaviors, and re-acquire the agent position and update the optimal path planning when necessary to achieve dynamic path planning.
[0090] In this embodiment, the customized behavior tree structure combining the complete reactive node and the path planning subtree is as follows: Figure 8 As shown. After the planning subtree model of the path planning part is constructed, it is equivalent to an encapsulated A* planner. This subtree has good use value in both global path planning and local planning. It only needs to input map information and the current position of the agent to achieve the optimal obstacle avoidance walking of the agent. For global path planning, it is only necessary to input the information of the static map and the starting position of the agent; in the dynamic planning process, if other reactive behavior nodes are combined before this path planning subtree, the priority of the subtree and each behavior node can be adjusted to achieve selective execution of path planning based on the execution results of other dynamic behaviors, and re-acquire the agent position and update the optimal path planning when necessary to achieve dynamic path planning.
[0091] It should be understood that although Figure 1 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 1 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0092] In one embodiment, Fig. 9 As shown, a CGF task planning simulation device based on a customized behavior tree is provided, comprising: a task relative acquisition module, a reactive basic behavior tree construction module and a customized hybrid reactive behavior tree construction module, wherein:
[0093] The task-relative acquisition module is used to obtain task assumptions for behavior modeling.
[0094] The reactive basic behavior tree construction module is used to construct a reactive basic behavior tree according to the predefined action priority in the task assumption; the reactive basic behavior tree includes: a root node, and multiple basic action sub-unit blocks connected to the root node; the multiple basic action sub-unit blocks include: an escape action sub-unit block, a static obstacle avoidance sub-unit block, and a walking sub-unit block.
[0095] The customized hybrid reactive behavior tree construction module is used to replace the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree with a customized planning sub-tree according to the task to be planned of the intelligent agent, so as to obtain a customized hybrid reactive behavior tree; the customized planning sub-tree is used to execute the planning action node to perceive the environment and accept the task to be planned, and the planner completes the calculation and solution of the task to be planned, and outputs a series of sub-goals or action sequences, and the control node calls the basic action in sequence according to the planning output loop to realize the output sequence.
[0096] In one of the embodiments, the root node of the reactive basic behavior tree in the reactive basic behavior tree construction module is a selection node, which is used to control the execution process of the entire reactive basic behavior tree; multiple basic action sub-unit blocks are respectively used to realize the intelligent agent's reaction to dynamic and static environments and walking actions, and the intelligent agent's task is completed by walking to the target point by calling the sub-unit blocks according to the priority from left to right.
[0097] In one embodiment, the sub-unit block in the reactive basic behavior tree building module includes a sequence node, a judgment or perception node and an action node; the sequence node connects the judgment or perception node and the action node; the sub-unit block is used to be controlled by the sequence node, and the judgment or perception node directly perceives and determines whether to execute the basic action of the action node; the basic actions include: escape action, obstacle avoidance action and walking action.
[0098] In one embodiment, the customized hybrid reactive behavior tree construction module is further used to replace the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree with the customized planning sub-tree according to the task to be planned of the agent, so as to obtain the customized hybrid reactive behavior tree as follows:
[0099] T = Selector ( Sequence ( C1 , A1 ), … , Sequence ( Cn , An ), PST )
[0100] Among them, PST represents a general planning subtree.
[0101] In one of the embodiments, the priority of the customized planning subtree in the customized hybrid reactive behavior tree construction module is from left to right; the root node of the customized planning subtree is a sequential node, the planning target detection subtree is set on the left, and the planning execution subtree is set on the right, and the basic actions are iteratively executed according to the output plan; the customized planning subtree replaces the static obstacle avoidance subunit block and the walking subunit block in the reactive basic behavior tree.
[0102] In one embodiment, the root node of the planning target detection subtree in the customized hybrid reaction behavior tree construction module is connected to a selection node and a sequence node; the root node is a sequence node with two child nodes, the selection node connects two condition nodes, and is used to measure the planning distance. When the agent has not yet planned, there is no sub-target state, or it is far away from the current sub-target state, the selection node is executed successfully and enters the execution of the next sequence node; the sequence node connects two action nodes; it is used to use the current state of the agent as the sub-target planning state, and execute the planning execution node to call the preset planning algorithm and output the planning result; if the agent updates the planning state, the planning target detection subtree is executed successfully, and the execution of this round of customized planning subtree ends; if the agent is not updated, the left side returns successfully as a whole, and the root node of the planning target detection subtree controls the agent to enter the execution of the planning execution subtree. The root node is a sequence node.
[0103] In one embodiment, the plan execution subtree in the customized hybrid reactive behavior tree construction module is used to loop into the plan execution subtree when the agent does not update the plan, and loop-call specific action execution nodes or achieve a series of sub-goals according to the plan until the plan goal is reached or a high-priority reactive behavior execution interrupts the plan execution.
[0104] In one of the embodiments, the planning execution subtree following walking subunit block part in the customized hybrid reaction behavior tree construction module is composed of a selector with three child nodes and three behavior blocks; the first behavior block is used to determine whether the intelligent agent has reached the final target point, and if it has reached it, the entire path planning and path following walking behavior are terminated; the second behavior block is used to determine whether the target node in the current path needs to be updated according to the position of the intelligent agent. Since each walk needs to take a point on the optimal path as the target in turn, when it is determined that the intelligent agent has reached the currently set target node in the path, the target node is updated to the next point in the optimal path; when the first two behavior blocks are not executed, the third behavior block executes the basic action of approaching the current target point.
[0105] The specific definition of the CGF task planning simulation device based on the customized behavior tree can be found in the above definition of the CGF task planning simulation method based on the customized behavior tree, which will not be repeated here. Each module in the above-mentioned CGF task planning simulation device based on the customized behavior tree can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0106] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Fig.10 As shown. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a CGF task planning simulation method based on a customized behavior tree is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse, etc.
[0107] Those skilled in the art will understand that Fig.10 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0108] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above method embodiment when executing the computer program.
[0109] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0110] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A CGF task planning simulation method based on a customized behavior tree, characterized in that: CGF refers to a virtual intelligent body that is autonomous or semi-autonomous and can respond to events and states in a virtual live environment by simulating human behavior through computer generation and control; the method includes: Obtain task scenarios for behavioral modeling; According to the priority of the predefined actions in the task assumption, a reactive basic behavior tree is constructed; the reactive basic behavior tree includes: a root node, and a plurality of basic action sub-unit blocks connected to the root node; the root node of the reactive basic behavior tree is a selection node, which is used to control the execution process of the entire reactive basic behavior tree; the plurality of basic action sub-unit blocks include from left to right: an escape action sub-unit block, a static obstacle avoidance sub-unit block and a walking sub-unit block; the plurality of basic action sub-unit blocks are respectively used to realize the reaction of the intelligent agent to the dynamic and static environment and the walking action, and by calling the sub-unit blocks according to the priority from left to right, the escape action sub-unit block is executed first, then the static obstacle avoidance sub-unit block is executed, and finally the walking sub-unit block is executed, and the intelligent agent task is completed by walking to the target point; the sub-unit block includes a sequence node, a judgment perception node and an action node; the sequence node connects the judgment perception node and the action node; The sub-unit block is used to be controlled by the sequence node, and the judgment and perception node directly perceives and determines whether to execute the basic action of the action node; the basic action includes: escape action, obstacle avoidance action and walking action; According to the task to be planned of the agent, the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree are replaced with a customized planning sub-tree to obtain a customized hybrid reactive behavior tree; the customized planning sub-tree is used to execute the planning action node to perceive the environment and accept the task to be planned, and the planner calculates and solves the task to be planned, outputs a series of sub-goals or action sequences, and the control node calls the basic action in sequence according to the planning output loop to realize the output sequence; the customized hybrid reactive behavior tree is: T = Selector ( Sequence ( C1 , A1 ), … , Sequence ( Cn , An ), PST ) Where T is the overall structure of the behavior tree model; PST represents a general planning subtree; Selector is a node type in the behavior tree, used to manage the execution order of multiple Sequence nodes; Sequence is the node type of the sequential execution mechanism in the behavior tree, and Sequence (Cn, An) is a sequential execution sequence consisting of two child nodes, Cn and An, where Cn and An represent different basic behaviors or tasks; The priority of the customized planning subtree is from left to right; the root node of the customized planning subtree is a sequential node, the planning target detection subtree is set on the left, and the planning execution subtree is set on the right, and the basic actions are iteratively executed according to the output plan; The custom planning subtree replaces the static obstacle avoidance subunit block and the walking subunit block in the reactive basic behavior tree; The root node of the planning target detection subtree is connected to a selection node and a sequence node; the root node is a sequence node with two child nodes, and the selection node is connected to two condition nodes for measuring the planning distance. When the agent has not yet planned, there is no sub-target state or it is far away from the current sub-target state, the selection node is executed successfully and enters the execution of the next sequence node; The sequence node connects two action nodes; it is used to take the current state of the agent as the sub-goal planning state, and execute the planning execution node to call the preset planning algorithm and output the planning result; if the agent updates the planning state, the planning target detection subtree is executed successfully, and the execution of the customized planning subtree in this round is completed; if the agent is not updated, the left side returns successfully as a whole, and the root node of the planning target detection subtree controls the agent to enter the execution of the planning execution subtree; the root node is a sequence node.
2. The method according to claim 1, characterized in that The subunit block includes a sequence node, a judgment perception node and an action node; the sequence node connects the judgment perception node and the action node; The subunit block is used to be controlled by the sequence node, and the judgment and perception node directly senses and determines whether to execute the basic action of the action node; The basic actions include: escape action, obstacle avoidance action and walking action.
3. The method according to claim 1, characterized in that The plan execution subtree is used to loop into the plan execution subtree when the agent does not update the plan, and loop-call specific action execution nodes or achieve a series of sub-goals according to the plan until the plan goal is reached or a high-priority reactive behavior execution interrupts the plan execution.
4. The method according to claim 1, characterized in that: The planning execution subtree follows the walking subunit block, which is composed of a selector with three child nodes and three behavior blocks; the first behavior block is used to determine whether the agent has reached the final target point, and if it has reached the final target point, the entire path planning and the behavior of following the path walking are terminated; The second behavior block is used to determine whether the target node in the current path needs to be updated based on the position of the intelligent agent. Since each walk needs to take a point on the optimal path as the target in turn, when it is determined that the intelligent agent has reached the currently set target node in the path, the target node is updated to the next point in the optimal path; when the first two behavior blocks are not executed, the third behavior block executes the basic action of approaching the current target point.
5. A CGF task planning simulation device based on a customized behavior tree, characterized in that: CGF refers to a virtual intelligent body that is controlled autonomously or semi-autonomously by computer generation and can autonomously respond to events and states in a virtual live environment by simulating human behavior; the device includes: Task-relative acquisition module, used to acquire task scenarios for behavior modeling; A reactive basic behavior tree construction module is used to construct a reactive basic behavior tree according to the predefined action priority in the task scenario; the reactive basic behavior tree includes: a root node, and multiple basic action sub-unit blocks connected to the root node; the root node of the reactive basic behavior tree is a selection node, which is used to control the execution process of the entire reactive basic behavior tree; the multiple basic action sub-unit blocks include from left to right: an escape action sub-unit block, a static obstacle avoidance sub-unit block and a walking sub-unit block; the multiple basic action sub-unit blocks are respectively used to realize the intelligent agent's reaction to the dynamic and static environment and the action Walking action, by calling the sub-unit blocks according to the priority from left to right, first executing the escape action sub-unit block, then executing the static obstacle avoidance sub-unit block, and finally executing the walking sub-unit block, walking to the target point to complete the agent task; the sub-unit block includes a sequence node, a judgment perception node and an action node; the sequence node connects the judgment perception node and the action node; the sub-unit block is used to be controlled by the sequence node, and the judgment perception node directly perceives and determines whether to execute the basic action of the action node; the basic actions include: escape action, obstacle avoidance action and walking action; A customized hybrid reactive behavior tree construction module is used to replace the static obstacle avoidance sub-unit block and the walking sub-unit block in the reactive basic behavior tree with a customized planning sub-tree according to the task to be planned of the intelligent agent, so as to obtain a customized hybrid reactive behavior tree; the customized planning sub-tree is used to execute the planning action node to perceive the environment and accept the task to be planned, and the planner calculates and solves the task to be planned, and outputs a series of sub-goals or action sequences, and the control node calls the basic action in sequence according to the planning output loop to realize the output sequence; the customized hybrid reactive behavior tree is: T = Selector ( Sequence ( C1 , A1 ), … , Sequence ( Cn , An ), PST ) Where T is the overall structure of the behavior tree model; PST represents a general planning subtree; Selector is a node type in the behavior tree, used to manage the execution order of multiple Sequence nodes; Sequence is the node type of the sequential execution mechanism in the behavior tree, and Sequence (Cn, An) is a sequential execution sequence consisting of two child nodes, Cn and An, where Cn and An represent different basic behaviors or tasks; The priority of the customized planning subtree is from left to right; the root node of the customized planning subtree is a sequential node, the planning target detection subtree is set on the left, and the planning execution subtree is set on the right, and the basic actions are iteratively executed according to the output plan; The custom planning subtree replaces the static obstacle avoidance subunit block and the walking subunit block in the reactive basic behavior tree; The root node of the planning target detection subtree is connected to a selection node and a sequence node; the root node is a sequence node with two child nodes, and the selection node is connected to two condition nodes for measuring the planning distance. When the agent has not yet planned, there is no sub-target state or it is far away from the current sub-target state, the selection node is executed successfully and enters the execution of the next sequence node; The sequence node connects two action nodes; it is used to take the current state of the agent as the sub-goal planning state, and execute the planning execution node to call the preset planning algorithm and output the planning result; if the agent updates the planning state, the planning target detection subtree is executed successfully, and the execution of the customized planning subtree in this round is completed; if the agent is not updated, the left side returns successfully as a whole, and the root node of the planning target detection subtree controls the agent to enter the execution of the planning execution subtree; the root node is a sequence node.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 4 is implemented.
