A method for formatting a vehicle logic behavior tree and related devices

CN116126290BActive Publication Date: 2026-11-03GUANGZHOU WERIDE TECH LTD CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202211490514.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-25
Publication Date
2026-11-03
Estimated Expiration
2042-11-25

AI Technical Summary

Technical Problem

In existing technologies, the structure of vehicle logic behavior trees is scattered and the node specifications are inconsistent, resulting in low efficiency when developing autonomous vehicles.

Method used

By folding the vehicle logic behavior tree to be formatted into virtual nodes, determining the virtual left boundary and formatting parameters, expanding and correcting the node positions, an intuitive and easy-to-understand formatted vehicle logic behavior tree is formed.

Benefits of technology

It improves the efficiency of autonomous vehicle development and reduces the time developers spend finding and editing nodes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116126290B_ABST
    Figure CN116126290B_ABST
Patent Text Reader

Abstract

The application discloses a formatting method of a vehicle logic behavior tree and related equipment, and the method comprises the following steps: acquiring a vehicle logic behavior tree to be formatted containing a plurality of nodes, folding the vehicle logic behavior tree to be formatted into a virtual node, determining a virtual left boundary and a formatting parameter of each layer of the folded and nested nodes, unfolding the virtual node to obtain an unfolded vehicle logic behavior tree, correcting the unfolded vehicle logic behavior tree through the virtual left boundary and the formatting parameter of each layer of the folded and nested nodes, and obtaining a formatted vehicle logic behavior tree. It can be seen that the vehicle logic behavior tree is formatted through folding and unfolding, so that the linear time complexity of the formatting process is low, the running speed is fast, the formatted vehicle logic behavior tree obtained through correction is more intuitive and easier for a developer to understand, and when the developer needs to drag or edit the nodes of the behavior tree, a large amount of time is not needed to spend on searching for the target node, and the development efficiency of the autonomous vehicle is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of wind turbine power generation, and more specifically, to a method for formatting a vehicle logic behavior tree and related equipment. Background Technology

[0002] With the development of intelligent technologies, vehicle driving is gradually moving towards artificial intelligence, using AI to assist or replace driver input to achieve autonomous driving. Autonomous driving places extremely high demands on driving safety, therefore requiring developers to maintain a high level of focus and caution during the development process. The behavior tree controlling the vehicle's logic is of significant guiding importance for autonomous vehicle development, and developers need to frequently review and edit it during the development process.

[0003] However, the behavior tree that controls vehicle logic has a scattered structure and inconsistent specifications for each node. When developers drag or edit the nodes of the behavior tree, it will take a lot of time, resulting in low efficiency in the development of autonomous vehicles. Summary of the Invention

[0004] In view of the above problems, this application is proposed to provide a method and related equipment for formatting a vehicle logic behavior tree, so as to improve the efficiency of autonomous driving developers in the process of developing autonomous vehicles.

[0005] To achieve the above objectives, the following specific solutions are proposed:

[0006] A method for formatting a vehicle logic behavior tree, comprising:

[0007] Obtain the vehicle logic behavior tree to be formatted, which contains several nodes;

[0008] The vehicle logic behavior tree to be formatted is folded into a virtual node, and the virtual left boundary of each nested folded node and the formatting parameters of the vehicle logic behavior tree to be formatted are determined. The virtual node includes multiple nested folded nodes.

[0009] Expanding the virtual nodes yields the expanded vehicle logic behavior tree;

[0010] The expanded vehicle logic behavior tree is corrected using the virtual left boundary of each nested and folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree.

[0011] Optionally, the vehicle logic behavior tree to be formatted is collapsed into a virtual node, and the virtual left boundary of each nested collapsed node is determined, as well as the formatting parameters of the vehicle logic behavior tree to be formatted, including:

[0012] Determine whether the logic behavior tree of the vehicle to be formatted contains only one node;

[0013] If so, determine that the vehicle logic behavior tree to be formatted is a virtual node;

[0014] If not, take the root node of the vehicle logic behavior tree to be formatted as the starting node and perform a depth-first traversal of each node of the vehicle logic behavior tree to be formatted.

[0015] During the depth-first traversal of the vehicle logic behavior tree to be formatted, if there are leaf nodes among the child nodes of the current node being traversed, the virtual left boundary of the current node is determined according to the position of the leftmost child node of the current node.

[0016] Analyze the heights of all nodes at the same level as the current node, as well as the virtual left boundary of the current node, to determine the formatting parameters of the current node;

[0017] In the vehicle logic behavior tree to be formatted, the leaf nodes of the current node are collapsed onto the current node to obtain the collapsed current node, and the process returns to the step of determining whether the vehicle logic behavior tree to be formatted contains only one node.

[0018] Optionally, the analysis of the heights of all nodes at the same level as the current node, and the virtual left boundary of the current node, to determine the formatting parameters of the current node includes:

[0019] Determine the maximum height among all nodes at the same level as the current node, and use it as the formatted height of the current node;

[0020] Based on the virtual left boundary of the current node, determine the offset of each child node of the current node;

[0021] The offset of each child node of the current node and the formatted height of the current node are used as the formatting parameters of the current node.

[0022] Optionally, the formatting parameter is the formatted height of each node, and the formatted height of each node is the maximum height among all nodes at the same level as that node;

[0023] The process of correcting the expanded vehicle logic behavior tree using the virtual left boundary of each nested and folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree includes:

[0024] Traverse each node of the expanded vehicle logic behavior tree;

[0025] During the depth-first traversal of the expanded vehicle logic behavior tree, if the first target node traversed is a non-leaf node, the coordinates of the first target node are determined based on the virtual left boundary and the formatted height of the first target node.

[0026] During the depth-first traversal of the expanded vehicle logic behavior tree, if the second target node being traversed is a leaf node, the coordinates of the second target node are determined based on the virtual left boundary of the parent node of the second target node and the formatted height of the second target node.

[0027] The x-axis coordinate of each parent node in the expanded vehicle logic behavior tree is set to the average of the x-axis coordinates of all child nodes of that parent node to obtain a formatted vehicle logic behavior tree.

[0028] Optionally, the coordinates of the first target node are determined based on the virtual left boundary and the formatted height of the first target node, including:

[0029] The x-axis coordinate of the first target node is determined based on the virtual left boundary of the first target node;

[0030] Based on the formatted height of the first target node and the y-axis coordinate of the parent node of the first target node, the y-axis coordinate of the first target node is determined, thereby determining the coordinates of the first target node.

[0031] Optionally, the method of determining the coordinates of the second target node based on the virtual left boundary of the parent node of the second target node and the formatted height of the second target node includes:

[0032] Based on the virtual left boundary of the parent node of the second target node, determine the cumulative offset of the second target node on the virtual left boundary of the parent node;

[0033] The x-axis coordinate of the second target node is determined based on the cumulative offset of the second target node;

[0034] Based on the formatted height of the second target node and the y-axis coordinate of the parent node of the second target node, the y-axis coordinate of the second target node is determined, thereby determining the coordinates of the second target node.

[0035] Optionally, traversing each node of the expanded vehicle logic behavior tree includes:

[0036] Initialize the coordinates of the root node of the expanded vehicle logic behavior tree;

[0037] Starting from the root node, traverse each node of the expanded vehicle logic behavior tree using a depth-first traversal.

[0038] A formatting device for a vehicle logic behavior tree, comprising:

[0039] The behavior tree acquisition unit is used to acquire a vehicle logic behavior tree to be formatted, which contains several nodes;

[0040] The behavior tree folding unit is used to fold the vehicle logic behavior tree to be formatted into a virtual node, and determine the virtual left boundary of each nested folded node, as well as the formatting parameters of the vehicle logic behavior tree to be formatted. The virtual node includes multiple nested folded nodes.

[0041] The behavior tree expansion unit is used to expand the virtual nodes to obtain an expanded vehicle logic behavior tree.

[0042] The behavior tree correction unit is used to correct the expanded vehicle logic behavior tree by using the virtual left boundary of the nested and folded nodes of each layer and the formatting parameters to obtain a formatted vehicle logic behavior tree.

[0043] Optionally, the behavior tree folding unit includes:

[0044] The behavior tree single node judgment unit is used to determine whether the vehicle logic behavior tree to be formatted includes only one node. If yes, the virtual node determination unit is executed; if no, the behavior tree traversal unit is executed.

[0045] The virtual node determination unit is used to determine that the vehicle logic behavior tree to be formatted is a virtual node;

[0046] The behavior tree traversal unit is used to perform a depth-first traversal of each node of the vehicle logic behavior tree to be formatted, starting from the root node of the root node of the vehicle logic behavior tree to be formatted.

[0047] The virtual left boundary determination unit is used to determine the virtual left boundary of the current node based on the position of the leftmost child node of the current node during the depth-first traversal of the vehicle logic behavior tree to be formatted.

[0048] The formatting parameter determination unit is used to analyze the height of each node at the same level as the current node, as well as the virtual left boundary of the current node, to determine the formatting parameters of the current node.

[0049] The node folding unit is used to fold the leaf nodes of the current node into the current node in the vehicle logic behavior tree to be formatted, to obtain the folded current node, and return to execute the step of determining whether the vehicle logic behavior tree to be formatted includes only one node.

[0050] Optionally, the formatting parameter determining unit includes:

[0051] The first formatting parameter determination subunit is used to determine the maximum height among all nodes at the same level as the current node, as the formatted height of the current node;

[0052] The second formatting parameter determines the sub-unit, which is used to determine the offset of each child node of the current node based on the virtual left boundary of the current node;

[0053] The third formatting parameter determination subunit is used to take the offset of each child node of the current node and the formatting height of the current node as the formatting parameters of the current node.

[0054] Optionally, the formatting parameter is the formatted height of each node, and the formatted height of each node is the maximum height among all nodes at the same level as that node;

[0055] The behavior tree correction unit includes:

[0056] The first behavior tree correction subunit is used to traverse each node of the expanded vehicle logic behavior tree.

[0057] The second behavior tree correction subunit is used to determine the coordinates of the first target node based on the virtual left boundary and the formatted height of the first target node when the first target node is a non-leaf node during the depth-first traversal of the expanded vehicle logic behavior tree.

[0058] The third behavior tree correction subunit is used to determine the coordinates of the second target node if the second target node being traversed is a leaf node during the depth-first traversal of the expanded vehicle logic behavior tree, based on the virtual left boundary of the parent node of the second target node and the formatted height of the second target node.

[0059] The fourth behavior tree correction subunit is used to set the x-axis coordinate of each parent node in the expanded vehicle logic behavior tree to the average of the x-axis coordinates of each child node of that parent node, so as to obtain a formatted vehicle logic behavior tree.

[0060] Optionally, the second row tree correction subunit includes:

[0061] The first node x-coordinate determination unit is used to determine the x-axis coordinate of the first target node based on the virtual left boundary of the first target node if the first target node being traversed is a non-leaf node during the depth-first traversal of the expanded vehicle logic behavior tree.

[0062] The first node y-coordinate determination unit is used to determine the y-coordinate of the first target node based on the formatted height of the first target node and the y-coordinate of the parent node of the first target node, so as to determine the coordinates of the first target node.

[0063] Optionally, the third row tree correction subunit includes:

[0064] The cumulative offset determination unit is used to determine the cumulative offset of the second target node on the virtual left boundary of the parent node of the second target node, based on the virtual left boundary of the parent node of the second target node, if the second target node is a leaf node during the depth-first traversal of the expanded vehicle logic behavior tree.

[0065] The second node x-coordinate determination unit is used to determine the x-axis coordinate of the second target node based on the cumulative offset of the second target node;

[0066] The second node y-coordinate determination unit is used to determine the y-coordinate of the second target node based on the formatted height of the second target node and the y-coordinate of the parent node of the second target node, so as to determine the coordinates of the second target node.

[0067] Optionally, the first behavior tree correction subunit includes:

[0068] The root node coordinate initialization unit is used to initialize the coordinates of the root node of the expanded vehicle logic behavior tree.

[0069] The tree expansion traversal unit is used to traverse each node of the expanded vehicle logic behavior tree, starting from the root node, in a depth-first manner.

[0070] A formatting device for a vehicle logic behavior tree, including a memory and a processor;

[0071] The memory is used to store programs;

[0072] The processor is used to execute the program to implement the various steps of the vehicle logic behavior tree formatting method as described above.

[0073] A storage medium storing a computer program that, when executed by a processor, implements the steps of the formatting method for a vehicle logic behavior tree as described above.

[0074] By employing the above technical solution, this application obtains a vehicle logic behavior tree to be formatted, containing several nodes, folds the vehicle logic behavior tree to be formatted into a virtual node, and determines the virtual left boundary of each nested folded node, as well as the formatting parameters of the vehicle logic behavior tree to be formatted. The virtual node includes multiple nested folded nodes. Expanding the virtual node yields an expanded vehicle logic behavior tree. By using the virtual left boundary of each nested folded node and the formatting parameters, the expanded vehicle logic behavior tree is corrected to obtain a formatted vehicle logic behavior tree. Therefore, the vehicle logic behavior tree can be formatted by folding and expanding, resulting in low linear time complexity and fast execution speed. Furthermore, during the folding process of the vehicle logic behavior tree to be formatted, the virtual left boundary used to correct the vehicle logic behavior tree and the formatting parameters are determined, making the resulting formatted vehicle logic behavior tree more intuitive and easier for developers to understand. Therefore, when developers need to drag or edit nodes in the behavior tree, they do not need to spend a lot of time searching for target nodes, thereby improving the development efficiency of autonomous vehicles. Attached Figure Description

[0075] Various other advantages and benefits will become apparent to those skilled in the art upon reading the following detailed description of preferred embodiments. The accompanying drawings are for illustrative purposes only and are not intended to limit the scope of this application. Furthermore, the same reference numerals denote the same parts throughout the drawings. In the drawings:

[0076] Figure 1 A flowchart for implementing a formatted vehicle logic behavior tree provided in an embodiment of this application;

[0077] Figure 2 This is a schematic diagram of the vehicle logic behavior tree provided in the embodiments of this application when it is not formatted;

[0078] Figure 3 A schematic diagram of the formatted vehicle logic behavior tree provided in the embodiments of this application;

[0079] Figure 4 A schematic diagram of a device structure for implementing a formatted vehicle logic behavior tree is provided in an embodiment of this application;

[0080] Figure 5 This is a schematic diagram of the structure of a device for implementing a formatted vehicle logic behavior tree, provided in an embodiment of this application. Detailed Implementation

[0081] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0082] The proposed solution can be implemented based on a terminal with data processing capabilities, such as a computer, server, or cloud platform.

[0083] Next, combined Figure 1 The formatting method for the vehicle logic behavior tree in this application may include the following steps:

[0084] Step S110: Obtain the vehicle logic behavior tree to be formatted, which contains several nodes.

[0085] It is understandable that the logic behavior tree of the vehicle to be formatted can contain several nodes, with two connected nodes having a parent-child relationship, and the size of each node can be different.

[0086] For example Figure 2 A vehicle logic behavior tree to be formatted can include nodes A, B, C, D, E, F, G, and H. A is the root node, B and C are both children of A (A is the parent node of B and C, and so on), E and D are both children of B, F is a child of C, H is a child of F, and G is a child of D. Each node can be viewed and edited. However, when developers need to analyze the level of a specific node in the vehicle logic behavior tree, they cannot directly obtain the result and must spend time manually organizing the tree, delaying development. Therefore, it is necessary to format the vehicle logic behavior tree.

[0087] Step S120: Fold the vehicle logic behavior tree to be formatted into a virtual node, and determine the virtual left boundary of each nested folded node, as well as the formatting parameters of the vehicle logic behavior tree to be formatted.

[0088] Specifically, the virtual node may include multiple nested and folded nodes.

[0089] For example, consider a vehicle logic behavior tree to be formatted. This tree can include nodes A, B, D, and G. When node G is collapsed to node D, node D becomes a virtual node, containing one level of nested nodes G. Further, when virtual node D is collapsed to node B, node B becomes a virtual node, containing two levels of nested virtual nodes D (which already contain G). Further, when virtual node B is collapsed to node A, the entire vehicle logic behavior tree to be formatted is virtual node A, which includes three levels of nested nodes.

[0090] The virtual left boundary can be obtained by using a preset node folding algorithm when each parent node is folded. The virtual left boundary can be located to the left of the leftmost child node of the parent node.

[0091] Step S130: Expand the virtual nodes to obtain the expanded vehicle logic behavior tree.

[0092] Specifically, the virtual nodes can be expanded in the order of depth-first traversal of the vehicle logic behavior tree to be formatted, thereby obtaining the expanded vehicle logic behavior tree.

[0093] Step S140: Correct the expanded vehicle logic behavior tree by using the virtual left boundary of each nested and folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree.

[0094] Understandably, the expanded vehicle logic behavior tree after the virtual nodes are expanded does not standardize the position of each node. To provide developers with a more intuitive vehicle logic behavior tree, the virtual left boundary and formatting parameters can be used as correction parameters to adjust each node in the vehicle logic behavior tree.

[0095] For example Figure 3 , Figure 2 The scattered vehicle logic behavior tree shown is transformed into a clear and hierarchical formatted vehicle logic behavior tree by folding, unfolding and correcting it, which helps developers improve the development efficiency of autonomous vehicles.

[0096] The vehicle logic behavior tree formatting method provided in this embodiment obtains a vehicle logic behavior tree to be formatted, containing several nodes. The method folds the vehicle logic behavior tree to be formatted into a virtual node, determines the virtual left boundary of each nested folded node, and sets the formatting parameters of the vehicle logic behavior tree to be formatted. The virtual node includes multiple nested folded nodes. Expanding the virtual node yields an expanded vehicle logic behavior tree. The expanded vehicle logic behavior tree is then corrected using the virtual left boundary of each nested folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree. Therefore, the method can format the vehicle logic behavior tree by folding and expanding, resulting in low linear time complexity and fast execution speed. Furthermore, by determining the virtual left boundary and formatting parameters used to correct the vehicle logic behavior tree during the folding process, the resulting formatted vehicle logic behavior tree is more intuitive and easier for developers to understand. Therefore, when developers need to drag or edit nodes in the behavior tree, they do not need to spend a lot of time searching for target nodes, thus improving the development efficiency of autonomous vehicles.

[0097] In some embodiments of this application, the process of step S120 above, folding the vehicle logic behavior tree to be formatted into a virtual node, determining the virtual left boundary of each nested folded node, and the formatting parameters of the vehicle logic behavior tree to be formatted are described. This process may include:

[0098] S1. Determine whether the vehicle logic behavior tree to be formatted includes only one node. If yes, execute S2; otherwise, execute S3.

[0099] It is understandable that since the vehicle logic behavior tree to be formatted has multiple nodes and is scattered, it needs to be formatted. Therefore, the vehicle logic behavior tree to be formatted needs to be folded. When the vehicle logic behavior tree to be formatted contains only one node, it can be said that the vehicle logic behavior tree to be formatted has been folded; otherwise, it has not been folded.

[0100] S2. Determine that the vehicle logic behavior tree to be formatted is a virtual node.

[0101] It is understandable that when the vehicle logic behavior tree to be formatted includes only one node, it can be said that the vehicle logic behavior tree to be formatted has been folded several times to obtain the final node. Therefore, it can be determined that the vehicle logic behavior tree to be formatted is a virtual node, which contains multiple layers of nested and folded nodes.

[0102] S3. Using the root node of the vehicle logic behavior tree to be formatted as the starting node, perform a depth-first traversal of each node of the vehicle logic behavior tree to be formatted.

[0103] For example Figure 2 The logic behavior tree of the vehicle to be formatted is traversed in a depth-first manner, and the order can be root node A → left child node B of A → left child node D of B → child node G of D.

[0104] S4. During the depth-first traversal of the vehicle logic behavior tree to be formatted, if there are leaf nodes among the child nodes of the current node, the virtual left boundary of the current node is determined according to the position of the leftmost child node of the current node.

[0105] For example, when Figure 2 When node B in the logic behavior tree of the vehicle to be formatted is traversed, since node B has a leaf node E, the virtual left boundary of node B can be determined based on the position of the leftmost child node D of node B. The virtual left boundary of node B is located to the left of node D.

[0106] Furthermore, during the depth-first traversal of the vehicle logic behavior tree to be formatted, if there are no leaf nodes among the child nodes of the current node being traversed, the traversal continues from the current node in the depth-first traversal order.

[0107] S5. Analyze the height of each node at the same level as the current node, as well as the virtual left boundary of the current node, and determine the formatting parameters of the current node.

[0108] Understandably, since the nodes of the vehicle logic behavior tree to be formatted have parent-child relationships but are scattered, it is necessary to analyze the formatting parameters of each node when the node is collapsed.

[0109] Specifically, the process of analyzing the heights of all nodes at the same level as the current node, and the virtual left boundary of the current node, to determine the formatting parameters of the current node may include:

[0110] S51. Determine the maximum height among all nodes at the same level as the current node, and use it as the formatted height of the current node.

[0111] Specifically, the height of each node can represent the y-coordinate of the top edge of the node. The height of the current node can be compared with the height of other nodes at the same level to obtain the maximum height of the current level. The maximum height of the current level can be used as the formatted height of the current node and other nodes at the same level.

[0112] S52. Determine the offset of each child node of the current node based on the virtual left boundary of the current node.

[0113] Specifically, if the child node of the current node is the leftmost child node of the current node, the offset of the child node can represent the distance from the virtual left boundary. If the child node of the current node is not the leftmost child node of the current node, the offset of the node can represent the distance from the nearest sibling node on the left.

[0114] S53. Use the offset of each child node of the current node and the formatted height of the current node as the formatting parameters of the current node.

[0115] Specifically, the formatting parameters of the current node can be cached in the current node so that they can be retrieved from the cache when the position of the current node needs to be adjusted.

[0116] S6. In the vehicle logic behavior tree to be formatted, collapse the leaf node of the current node onto the current node to obtain the collapsed current node, and return to execute S1.

[0117] Specifically, when the leaf node of the current node collapses into the current node, the leaf node can be hidden within the current node. In this case, the leaf node is not considered to exist in the logic behavior tree of the vehicle to be formatted.

[0118] The formatting method for the vehicle logic behavior tree provided in this embodiment folds each node in the vehicle logic behavior tree to be formatted in a depth-first traversal order, thereby obtaining the virtual left boundary and formatting parameters used to correct the node position. The implementation of this process has a low linear time complexity.

[0119] In some embodiments of this application, when the formatting parameter mentioned in the above embodiments is the formatting height of each node, the process of correcting the expanded vehicle logic behavior tree by using the virtual left boundary of each nested and folded node and the formatting parameter, as mentioned in the above embodiments, to obtain a formatted vehicle logic behavior tree is described. This process may include:

[0120] S1. Traverse each node of the expanded vehicle logic behavior tree.

[0121] Specifically, the process of traversing each node of the expanded vehicle logic behavior tree may include:

[0122] S1. Initialize the coordinates of the root node of the expanded vehicle logic behavior tree.

[0123] Understandably, in order to provide developers with a more easily understandable vehicle logic behavior tree, the coordinates of the root node of the expanded vehicle logic behavior tree can be initialized to the commonly used coordinates preset by developers, such as (0, 0). Then, the subtrees located at the root node can change accordingly as the coordinates of the root node change after initialization. For example, other nodes except the root node can be translated as the root node is translated.

[0124] S12. Starting from the root node, traverse each node of the expanded vehicle logic behavior tree in a depth-first manner.

[0125] S2. During the depth-first traversal of the expanded vehicle logic behavior tree, if the first target node traversed is a non-leaf node, the coordinates of the first target node are determined based on the virtual left boundary and the formatted height of the first target node.

[0126] The formatted height of each node is the maximum height among all nodes at the same level as that node.

[0127] It is understandable that the coordinates of the first target node are corrected coordinates, which can be corrected by the virtual left boundary and formatting height obtained during the process of folding the vehicle logic behavior tree to be formatted.

[0128] Specifically, the process of determining the coordinates of the first target node based on its virtual left boundary and formatted height may include:

[0129] S21. Determine the x-axis coordinate of the first target node based on the virtual left boundary of the first target node.

[0130] Specifically, the x-axis coordinate of the first target node can be set to a position at a preset interval to the right of the virtual left boundary.

[0131] S22. Based on the formatted height of the first target node and the y-axis coordinate of the parent node of the first target node, determine the y-axis coordinate of the first target node to determine the coordinates of the first target node.

[0132] Specifically, the y-axis coordinate of the first target node can be set to the sum of the y-axis coordinate of its parent node and its formatted height, or the coordinate of the first target node can be set such that the difference between the top edge of the parent node and the bottom edge of this node is the formatted height of the first target node, thereby avoiding the intersection between the parent node and the child node.

[0133] It is understandable that once the x-axis and y-axis coordinates of the first target node are determined, the position of the first target node in the planar coordinate system can be determined.

[0134] S3. During the depth-first traversal of the expanded vehicle logic behavior tree, if the second target node being traversed is a leaf node, the coordinates of the second target node are determined based on the virtual left boundary of the parent node of the second target node and the formatted height of the second target node.

[0135] It is understandable that the coordinates of the determined second target node are the corrected coordinates, which can be corrected by the virtual left boundary and formatting height obtained during the process of folding the vehicle logic behavior tree to be formatted.

[0136] Specifically, the process of determining the coordinates of the second target node based on the virtual left boundary of the parent node and the formatted height of the second target node may include:

[0137] S31. Determine the cumulative offset of the second target node on the virtual left boundary of the parent node based on the virtual left boundary of the parent node.

[0138] Specifically, each node with the same parent node can have the same virtual left boundary, and the cumulative offset of each node with the same parent node can represent the distance between that node and the virtual left boundary.

[0139] S32. Determine the x-axis coordinate of the second target node based on the cumulative offset of the second target node.

[0140] Specifically, the x-axis coordinate of the second target node can be set to the position of the cumulative offset to the right of the virtual left boundary.

[0141] S33. Based on the formatted height of the second target node and the y-axis coordinate of the parent node of the second target node, determine the y-axis coordinate of the second target node to determine the coordinates of the second target node.

[0142] Specifically, the y-axis coordinate of the second target node can be set to the sum of the y-axis coordinate of its parent node and its formatted height, or the coordinate of the second target node can be set such that the difference between the top edge of the parent node and the bottom edge of this node is the formatted height of the second target node, thereby avoiding the intersection between the parent node and the child node.

[0143] It is understandable that once the x-axis and y-axis coordinates of the second target node are determined, the position of the second target node in the planar coordinate system can be determined.

[0144] S4. Set the x-axis coordinate of each parent node in the expanded vehicle logic behavior tree to the average of the x-axis coordinates of each child node of that parent node, so as to obtain a formatted vehicle logic behavior tree.

[0145] Understandably, by setting the x-axis coordinate of each parent node to the average of the x-axis coordinates of all its child nodes, the parent node is positioned at the center of all its child nodes, thus presenting the hierarchical relationship between the nodes of the formatted vehicle logic behavior tree to developers more intuitively.

[0146] The following describes the formatting apparatus for implementing a vehicle logic behavior tree provided in the embodiments of this application. The formatting apparatus for implementing a vehicle logic behavior tree described below and the formatting method for implementing a vehicle logic behavior tree described above can be referred to in correspondence.

[0147] See Figure 4 , Figure 4 This is a schematic diagram of a formatting device for implementing a vehicle logic behavior tree, as disclosed in an embodiment of this application.

[0148] like Figure 4 As shown, the device may include:

[0149] Behavior tree acquisition unit 11 is used to acquire a vehicle logic behavior tree to be formatted, which contains several nodes;

[0150] The behavior tree folding unit 12 is used to fold the vehicle logic behavior tree to be formatted into a virtual node, and determine the virtual left boundary of each nested folded node, as well as the formatting parameters of the vehicle logic behavior tree to be formatted. The virtual node includes multiple nested folded nodes.

[0151] Behavior tree expansion unit 13 is used to expand the virtual nodes to obtain an expanded vehicle logic behavior tree;

[0152] The behavior tree correction unit 14 is used to correct the expanded vehicle logic behavior tree by using the virtual left boundary of the nested and folded nodes of each layer and the formatting parameters to obtain a formatted vehicle logic behavior tree.

[0153] Optionally, the behavior tree folding unit includes:

[0154] The behavior tree single node judgment unit is used to determine whether the vehicle logic behavior tree to be formatted includes only one node. If yes, the virtual node determination unit is executed; if no, the behavior tree traversal unit is executed.

[0155] The virtual node determination unit is used to determine that the vehicle logic behavior tree to be formatted is a virtual node;

[0156] The behavior tree traversal unit is used to perform a depth-first traversal of each node of the vehicle logic behavior tree to be formatted, starting from the root node of the root node of the vehicle logic behavior tree to be formatted.

[0157] The virtual left boundary determination unit is used to determine the virtual left boundary of the current node based on the position of the leftmost child node of the current node during the depth-first traversal of the vehicle logic behavior tree to be formatted.

[0158] The formatting parameter determination unit is used to analyze the height of each node at the same level as the current node, as well as the virtual left boundary of the current node, to determine the formatting parameters of the current node.

[0159] The node folding unit is used to fold the leaf nodes of the current node into the current node in the vehicle logic behavior tree to be formatted, to obtain the folded current node, and return to execute the step of determining whether the vehicle logic behavior tree to be formatted includes only one node.

[0160] Optionally, the formatting parameter determining unit includes:

[0161] The first formatting parameter determination subunit is used to determine the maximum height among all nodes at the same level as the current node, as the formatted height of the current node;

[0162] The second formatting parameter determines the sub-unit, which is used to determine the offset of each child node of the current node based on the virtual left boundary of the current node;

[0163] The third formatting parameter determination subunit is used to take the offset of each child node of the current node and the formatting height of the current node as the formatting parameters of the current node.

[0164] Optionally, the formatting parameter is the formatted height of each node, and the formatted height of each node is the maximum height among all nodes at the same level as that node;

[0165] The behavior tree correction unit includes:

[0166] The first behavior tree correction subunit is used to traverse each node of the expanded vehicle logic behavior tree.

[0167] The second behavior tree correction subunit is used to determine the coordinates of the first target node based on the virtual left boundary and the formatted height of the first target node when the first target node is a non-leaf node during the depth-first traversal of the expanded vehicle logic behavior tree.

[0168] The third behavior tree correction subunit is used to determine the coordinates of the second target node if the second target node being traversed is a leaf node during the depth-first traversal of the expanded vehicle logic behavior tree, based on the virtual left boundary of the parent node of the second target node and the formatted height of the second target node.

[0169] The fourth behavior tree correction subunit is used to set the x-axis coordinate of each parent node in the expanded vehicle logic behavior tree to the average of the x-axis coordinates of each child node of that parent node, so as to obtain a formatted vehicle logic behavior tree.

[0170] Optionally, the second row tree correction subunit includes:

[0171] The first node x-coordinate determination unit is used to determine the x-axis coordinate of the first target node based on the virtual left boundary of the first target node if the first target node being traversed is a non-leaf node during the depth-first traversal of the expanded vehicle logic behavior tree.

[0172] The first node y-coordinate determination unit is used to determine the y-coordinate of the first target node based on the formatted height of the first target node and the y-coordinate of the parent node of the first target node, so as to determine the coordinates of the first target node.

[0173] Optionally, the third row tree correction subunit includes:

[0174] The cumulative offset determination unit is used to determine the cumulative offset of the second target node on the virtual left boundary of the parent node of the second target node, based on the virtual left boundary of the parent node of the second target node, if the second target node is a leaf node during the depth-first traversal of the expanded vehicle logic behavior tree.

[0175] The second node x-coordinate determination unit is used to determine the x-axis coordinate of the second target node based on the cumulative offset of the second target node;

[0176] The second node y-coordinate determination unit is used to determine the y-coordinate of the second target node based on the formatted height of the second target node and the y-coordinate of the parent node of the second target node, so as to determine the coordinates of the second target node.

[0177] Optionally, the first behavior tree correction subunit includes:

[0178] The root node coordinate initialization unit is used to initialize the coordinates of the root node of the expanded vehicle logic behavior tree.

[0179] The tree expansion traversal unit is used to traverse each node of the expanded vehicle logic behavior tree, starting from the root node, in a depth-first manner.

[0180] The vehicle logic behavior tree formatting device provided in this application embodiment can be applied to vehicle logic behavior tree formatting devices, such as terminals: mobile phones, computers, etc. Optionally, Figure 5 The hardware structure block diagram of the formatting device for the vehicle logic behavior tree is shown, with reference to... Figure 5 The hardware structure of the vehicle logic behavior tree formatting device may include: at least one processor 1, at least one communication interface 2, at least one memory 3, and at least one communication bus 4.

[0181] In this embodiment of the application, the number of processor 1, communication interface 2, memory 3, and communication bus 4 is at least one, and processor 1, communication interface 2, and memory 3 communicate with each other through communication bus 4;

[0182] Processor 1 may be a central processing unit (CPU), an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement embodiments of the present invention.

[0183] Memory 3 may include high-speed RAM, and may also include non-volatile memory, such as at least one disk storage device;

[0184] The memory stores a program, which the processor can call. The program is used for:

[0185] Obtain the vehicle logic behavior tree to be formatted, which contains several nodes;

[0186] The vehicle logic behavior tree to be formatted is folded into a virtual node, and the virtual left boundary of each nested folded node and the formatting parameters of the vehicle logic behavior tree to be formatted are determined. The virtual node includes multiple nested folded nodes.

[0187] Expanding the virtual nodes yields the expanded vehicle logic behavior tree;

[0188] The expanded vehicle logic behavior tree is corrected using the virtual left boundary of each nested and folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree.

[0189] Optionally, the refined and extended functions of the program can be found in the description above.

[0190] This application embodiment also provides a storage medium that can store a program suitable for execution by a processor, the program being used for:

[0191] Obtain the vehicle logic behavior tree to be formatted, which contains several nodes;

[0192] The vehicle logic behavior tree to be formatted is folded into a virtual node, and the virtual left boundary of each nested folded node and the formatting parameters of the vehicle logic behavior tree to be formatted are determined. The virtual node includes multiple nested folded nodes.

[0193] Expanding the virtual nodes yields the expanded vehicle logic behavior tree;

[0194] The expanded vehicle logic behavior tree is corrected using the virtual left boundary of each nested and folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree.

[0195] Optionally, the refined and extended functions of the program can be found in the description above.

[0196] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0197] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.

[0198] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A method for formatting a vehicle logic behavior tree, characterized in that, include: Obtain the vehicle logic behavior tree to be formatted, which contains several nodes; The vehicle logic behavior tree to be formatted is folded into a virtual node, and the virtual left boundary of each nested folded node and the formatting parameters of the vehicle logic behavior tree to be formatted are determined. The virtual node includes multiple nested folded nodes. Expanding the virtual nodes yields the expanded vehicle logic behavior tree; The expanded vehicle logic behavior tree is corrected by using the virtual left boundary of each nested and folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree. The formatting parameter is the formatted height of each node, and the formatted height of each node is the maximum height among all nodes at the same level as that node; The process of correcting the expanded vehicle logic behavior tree using the virtual left boundary of each nested and folded node and the formatting parameters to obtain a formatted vehicle logic behavior tree includes: Traverse each node of the expanded vehicle logic behavior tree; During the depth-first traversal of the expanded vehicle logic behavior tree, if the first target node traversed is a non-leaf node, the coordinates of the first target node are determined based on the virtual left boundary and the formatted height of the first target node. During the depth-first traversal of the expanded vehicle logic behavior tree, if the second target node being traversed is a leaf node, the coordinates of the second target node are determined based on the virtual left boundary of the parent node of the second target node and the formatted height of the second target node. The x-axis coordinate of each parent node in the expanded vehicle logic behavior tree is set to the average of the x-axis coordinates of all child nodes of that parent node to obtain a formatted vehicle logic behavior tree.

2. The method according to claim 1, characterized in that, The vehicle logic behavior tree to be formatted is collapsed into a virtual node, and the virtual left boundary of each nested collapsed node is determined, along with the formatting parameters of the vehicle logic behavior tree to be formatted, including: Determine whether the logic behavior tree of the vehicle to be formatted contains only one node; If so, determine that the vehicle logic behavior tree to be formatted is a virtual node; If not, take the root node of the vehicle logic behavior tree to be formatted as the starting node and perform a depth-first traversal of each node of the vehicle logic behavior tree to be formatted. During the depth-first traversal of the vehicle logic behavior tree to be formatted, if there are leaf nodes among the child nodes of the current node being traversed, the virtual left boundary of the current node is determined according to the position of the leftmost child node of the current node. Analyze the heights of all nodes at the same level as the current node, as well as the virtual left boundary of the current node, to determine the formatting parameters of the current node; In the vehicle logic behavior tree to be formatted, the leaf nodes of the current node are collapsed onto the current node to obtain the collapsed current node, and the process returns to the step of determining whether the vehicle logic behavior tree to be formatted contains only one node.

3. The method according to claim 2, characterized in that, The analysis of the heights of all nodes at the same level as the current node, and the virtual left boundary of the current node, determines the formatting parameters of the current node, including: Determine the maximum height among all nodes at the same level as the current node, and use it as the formatted height of the current node; Based on the virtual left boundary of the current node, determine the offset of each child node of the current node; The offset of each child node of the current node and the formatted height of the current node are used as the formatting parameters of the current node.

4. The method according to claim 1, characterized in that, The coordinates of the first target node are determined based on its virtual left boundary and formatted height, including: The x-axis coordinate of the first target node is determined based on the virtual left boundary of the first target node; Based on the formatted height of the first target node and the y-axis coordinate of the parent node of the first target node, the y-axis coordinate of the first target node is determined, thereby determining the coordinates of the first target node.

5. The method according to claim 1, characterized in that, The coordinates of the second target node are determined based on the virtual left boundary of its parent node and the formatted height of the second target node, including: Based on the virtual left boundary of the parent node of the second target node, determine the cumulative offset of the second target node on the virtual left boundary of the parent node; The x-axis coordinate of the second target node is determined based on the cumulative offset of the second target node; Based on the formatted height of the second target node and the y-axis coordinate of the parent node of the second target node, the y-axis coordinate of the second target node is determined, thereby determining the coordinates of the second target node.

6. The method according to claim 1, characterized in that, Traversing each node of the expanded vehicle logic behavior tree includes: Initialize the coordinates of the root node of the expanded vehicle logic behavior tree; Starting from the root node, traverse each node of the expanded vehicle logic behavior tree using a depth-first traversal.

7. A formatting device for a vehicle logic behavior tree, characterized in that, The apparatus, applied to the formatting method for the vehicle logic behavior tree as described in claim 1, comprises: The behavior tree acquisition unit is used to acquire a vehicle logic behavior tree to be formatted, which contains several nodes; The behavior tree folding unit is used to fold the vehicle logic behavior tree to be formatted into a virtual node, and to determine the virtual left boundary of each nested folded node, as well as the formatting parameters of the vehicle logic behavior tree to be formatted. The virtual node includes multiple nested folded nodes. The behavior tree expansion unit is used to expand the virtual nodes to obtain an expanded vehicle logic behavior tree. The behavior tree correction unit is used to correct the expanded vehicle logic behavior tree by using the virtual left boundary of the nested and folded nodes of each layer and the formatting parameters to obtain a formatted vehicle logic behavior tree.

8. A formatting device for a vehicle logic behavior tree, characterized in that, Including memory and processor; The memory is used to store programs; The processor is configured to execute the program to implement the steps of the method for formatting a vehicle logic behavior tree as described in any one of claims 1-6.

9. A storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the formatting method for the vehicle logic behavior tree as described in any one of claims 1-6.