Extensible flexible behavior tree construction and simulation method based on SysML
By defining the behavior tree element model and simulation method based on SysML, the problem of SysML being difficult to support behavior tree expression and simulation is solved, and the linkage simulation of behavior tree, state machine, and activity graph is realized, improving the scalability and maintenance of the system.
Patent Information
- Application Number
- CN202411412456.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-25
AI Technical Summary
The prior art is difficult to effectively extend SysML to support the expression and simulation of behavior trees, making it difficult to maintain and linkage when dealing with complex behavior systems.
By defining the behavior tree element model, construction method and simulation method based on SysML, the linkage simulation of behavior trees, state machines, and activity graphs is realized, and the expression ability of SysML is expanded to support the construction and simulation of complex behavior trees.
It realizes the scalability and flexibility of the behavior tree, can effectively handle complex behavior systems, and improves the system's maintenance and simulation capabilities.
Smart Images

Figure CN119512514A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of engineering system modeling and simulation, and in particular to a SysML-based extensible and flexible behavior tree construction and simulation method. Background Art
[0002] Behavior trees are mathematical models of planned execution used in computer science, robotics, control systems, and video games. They describe switching between a finite set of tasks in a modular way. Their strength is the ability to create very complex tasks composed of simpler tasks without worrying about how the simpler tasks are implemented. Behavior trees have some similarities to hierarchical state machines, the key being that the main building block of the behavior is a task rather than a state. The ease of understanding of behavior trees makes them less error prone and very popular in the game developer community. Behavior trees have been shown to generalize to several other control architectures.
[0003] The system design language SysML specifies the expression of state machines, but does not specify the expression of behavior trees. Different state classes are interdependent and difficult to decouple; and after the basic state is subdivided, the state machine will be very difficult to maintain. Therefore, it is necessary to expand the expression function of SysML behavior trees to analyze systems with a large number of complex behaviors.
[0004] Therefore, those skilled in the art provide a SysML-based extensible and flexible behavior tree construction and simulation method to solve the problems raised in the above background technology. Summary of the invention
[0005] 1. Technical issues to be resolved
[0006] In view of the deficiencies in the prior art, the present invention provides an extensible and flexible behavior tree construction and simulation method based on SysML. Based on the SysML standard, the expression method of the behavior tree is defined, and a simulation method based on the SysML standard is provided to realize the linkage simulation of the behavior tree, state machine, and activity diagram.
[0007] (II) Technical solution
[0008] To achieve the above objectives, the present invention is implemented through the following technical solutions:
[0009] A scalable and flexible behavior tree construction and simulation method based on SysML, comprising the following steps:
[0010] Step 1: Define the behavior tree metamodel based on SysML;
[0011] Step 2: Define the behavior tree construction method based on SysML;
[0012] Step 3: Define the behavior tree simulation method based on SysML;
[0013] Step 4: Define the joint simulation method of state machine, activity diagram, and behavior tree based on SysML.
[0014] Furthermore, in step 1, defining a behavior tree metamodel based on SysML specifically includes:
[0015] 1. Control Node
[0016] a) Sequence: reuses the SequenceNode type in the UML2.5 standard, indicating that child nodes are executed in sequence until one of the child nodes returns a failure status or all child nodes return a success status;
[0017] b) Alternative: reuse the Decision node of the activity diagram, which means executing the child nodes in sequence until one of the child nodes returns a success status or all the child nodes return a failure status;
[0018] c) Parallel: Reuse the collection node Fork of the activity diagram, which means executing all child nodes in parallel until at least M child nodes (the value of M is between 1 and N) return a success status or all child nodes return a failure status;
[0019] d) Decoration: Using uml:class as the metamodel, define decoration nodes such as inversion (inverting the execution result), force (forcing a success or failure return), repeat (repeated execution returns a failure or reaches a specified number of repetitions), and delay (executing a child node after a specified delay);
[0020] 2. Execution Node
[0021] a) Execution node definition: reuse the activity type of SysML activity diagram and extend two properties: return value (enumeration type: success) and running status (enumeration type:);
[0022] b) Use of execution nodes: reuse the Action node type of SysML activity diagram;
[0023] 3. Relationships between nodes
[0024] Use the control flow of activity diagrams to express;
[0025] 4. Other nodes
[0026] Customized nodes can be built using the metamodel mechanism according to user needs.
[0027] Furthermore, in step 2, defining a behavior tree construction method based on SysML specifically includes:
[0028] a. The execution node construction method adopts an object-oriented approach (definition and instance) to construct, and the control node is a logical control node that can be used directly;
[0029] b. When building an execution node, first create a new execution node definition (Activity type), and then build its behavior process through scripts, activity diagrams, or sub-behavior trees;
[0030] C. Create a new Behavior Tree view, drag the execution node and control node to the Behavior Tree for modeling. At this time, the object type generated by the dragged execution node is the Action type.
[0031] Furthermore, in step 3, defining a behavior tree simulation method based on SysML specifically includes:
[0032] a. The simulation of the behavior tree can be converted into the simulation of the equivalent activity diagram;
[0033] b. Sequence;
[0034] c. Alternative;
[0035] d. Parallel;
[0036] e. Decorating nodes: Since decorating nodes are often the logical processing of node return values, a new opaque behavior is created in the implementation, the return value is passed into the behavior, and the logic script is edited to process the return value.
[0037] Furthermore, the decoration node specifically includes:
[0038] a) Inversion: pass the return value of the execution node to the newly created opaque behavior and negate it;
[0039] b) Force: pass the return value of the execution node to the newly created opaque behavior, forcing it to return true or false;
[0040] c) Repeat: It comes with a loop global variable, initialized to 0, and incremented by 1 each time it is executed until the condition is met;
[0041] d) Delay: Reuse the activity diagram time event node and set the delay time.
[0042] Furthermore, in the step 4, the method for co-simulating a state machine, an activity diagram, and a behavior tree based on SysML is defined, specifically including: since most tools based on the SysML standard have realized the co-simulation of state diagrams and activity diagrams, the behavior tree simulation of this method is based on the activity diagram simulation, and thus seamless co-simulation with the state machine and the activity diagram can be realized.
[0043] Furthermore, the method defines an expression method of a behavior tree based on the SysML standard, and provides a simulation method based on the SysML standard to realize linkage simulation of a behavior tree, a state machine, and an activity diagram.
[0044] (III) Beneficial effects
[0045] The present invention provides a SysML-based extensible and flexible behavior tree construction and simulation method.
[0046] It has the following beneficial effects:
[0047] 1. The present invention provides an extensible and flexible behavior tree construction and simulation method based on SysML. The method is based on the SysML language standard and only uses its language characteristics to realize the definition of the behavior tree metamodel. It can be well integrated with the SysML model to achieve complementary capabilities. Based on the SysML language standard, the construction of the behavior tree is defined in an object-oriented manner, and the definition and usage scenarios of the behavior execution nodes are separated to facilitate expansion.
[0048] 2. The present invention provides an extensible and flexible behavior tree construction and simulation method based on SysML. The behavior tree execution node reuse in this method is based on SysML activity type node. It can be used not only for behavior tree modeling, but also for activity diagram modeling, and has a wider range of applications.
[0049] 3. The present invention provides a scalable and flexible behavior tree construction and simulation method based on SysML. The method converts the behavior tree into an equivalent activity diagram and then performs simulation, which can achieve seamless joint simulation with other SysML behavior diagrams. The required control nodes are customized through the metamodel mechanism, thereby achieving flexibility and high scalability of the behavior tree nodes. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] Figure 1 It is a schematic diagram of sequential simulation conversion of the present invention;
[0051] Figure 2 It is a schematic diagram of an alternative simulation conversion of the present invention;
[0052] Figure 3 It is a schematic diagram of the parallel simulation conversion of the present invention. DETAILED DESCRIPTION
[0053] The following will be combined with the drawings in the specific embodiments of the present invention to clearly and completely describe the technical solutions in the specific embodiments of the present invention. Obviously, the specific embodiments described are only part of the specific embodiments of the present invention, not all of the specific embodiments. Based on the specific embodiments of the present invention, all other specific embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] The specific embodiment of the present invention provides a scalable and flexible behavior tree construction and simulation method based on SysML, comprising the following steps:
[0056] Step 1: Define the behavior tree metamodel based on SysML
[0057] 1. Control Node
[0058] a) Sequence: reuses the SequenceNode type in the UML2.5 standard, indicating that child nodes are executed in sequence until one of the child nodes returns a failure status or all child nodes return a success status;
[0059] b) Alternative: reuse the Decision node of the activity diagram, which means executing the child nodes in sequence until one of the child nodes returns a success status or all the child nodes return a failure status;
[0060] c) Parallel: Reuse the collection node Fork of the activity diagram, which means executing all child nodes in parallel until at least M child nodes (the value of M is between 1 and N) return a success status or all child nodes return a failure status;
[0061] d) Decoration: Using uml:class as the metamodel, define decoration nodes such as inversion (inverting the execution result), force (forcing a success or failure return), repeat (repeated execution returns a failure or reaches a specified number of repetitions), and delay (executing a child node after a specified delay);
[0062] 2. Execution Node
[0063] a) Execution node definition: reuse the activity type of SysML activity diagram and extend two properties: return value (enumeration type: success) and running status (enumeration type:);
[0064] b) Use of execution nodes: reuse the Action node type of SysML activity diagram;
[0065] 3. Relationships between nodes
[0066] Use the control flow of activity diagrams to express;
[0067] 4. Other nodes
[0068] Customized nodes can be built using the metamodel mechanism according to user needs;
[0069] Step 2: Define the behavior tree construction method based on SysML
[0070] a. The execution node construction method adopts an object-oriented approach (definition and instance) to construct, and the control node is a logical control node that can be used directly;
[0071] b. When building an execution node, first create a new execution node definition (Activity type), and then build its behavior process through scripts, activity diagrams, or sub-behavior trees;
[0072] C. Create a new Behavior Tree view, drag the execution node and control node to the Behavior Tree for modeling. At this time, the object type generated by the dragged execution node is the Action type;
[0073] Step 3: Define the behavior tree simulation method based on SysML
[0074] a. The simulation of the behavior tree can be converted into the simulation of the equivalent activity diagram;
[0075] b. Sequence, such as Figure 1 As shown;
[0076] c. Alternative, such as Figure 2 As shown;
[0077] d. Parallel, such as Figure 3 As shown;
[0078] e. Decorating nodes: Since decorating nodes are often used to perform logical processing on the node return value, a new opaque behavior is created in the implementation, the return value is passed into the behavior, and the logic script is edited to process the return value;
[0079] a) Inversion: pass the return value of the execution node to the newly created opaque behavior and negate it;
[0080] b) Force: pass the return value of the execution node to the newly created opaque behavior, forcing it to return true or false;
[0081] c) Repeat: It comes with a loop global variable, initialized to 0, and incremented by 1 each time it is executed until the condition is met;
[0082] d) Delay: reuse the activity diagram time event node and set the delay time;
[0083] Step 4: Define the joint simulation method of state machine, activity diagram and behavior tree based on SysML
[0084] Since most tools based on the SysML standard have realized the joint simulation of state diagrams and activity diagrams, the behavior tree simulation of this method is based on activity diagram simulation, so it can achieve seamless joint simulation with state machines and activity diagrams.
[0085] The present invention proposes a method, based on the SysML standard, to define an expression method of a behavior tree, and provides a simulation method based on the SysML standard to realize linkage simulation of a behavior tree, a state machine, and an activity diagram.
[0086] Although specific embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the specific embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.
Claims
1. A scalable and flexible behavior tree construction and simulation method based on SysML, characterized in that: The following steps are involved: Step 1: Define the behavior tree metamodel based on SysML; Step 2: Define the behavior tree construction method based on SysML; Step 3: Define the behavior tree simulation method based on SysML; Step 4: Define the joint simulation method of state machine, activity diagram, and behavior tree based on SysML.
2. According to the SysML-based extensible and flexible behavior tree construction and simulation method according to claim 1, it is characterized in that: In step 1, defining a behavior tree metamodel based on SysML specifically includes:
1. Control Node a) Sequence: reuses the SequenceNode type in the UML2.5 standard, indicating that child nodes are executed in sequence until one of the child nodes returns a failure status or all child nodes return a success status; b) Alternative: reuse the Decision node of the activity diagram, which means executing the child nodes in sequence until one of the child nodes returns a success status or all the child nodes return a failure status; c) Parallel: Reuse the collection node Fork of the activity diagram, which means executing all child nodes in parallel until at least M child nodes return a success status or all child nodes return a failure status; d) Decoration: Using uml:class as the metamodel, define decoration nodes such as inversion, force, repeat, delay, etc.
2. Execution Node a) Execution node definition: reuse the Activity type of SysML activity diagram and extend two properties: return value and running status; b) Use of execution nodes: reuse the Action node type of SysML activity diagram; 3. Relationships between nodes Use the control flow of activity diagrams to express; 4. Other nodes Customized nodes can be built using the metamodel mechanism according to user needs.
3. The method for constructing and simulating a scalable and flexible behavior tree based on SysML according to claim 1, characterized in that: In step 2, defining a behavior tree construction method based on SysML specifically includes: a. The execution node construction method adopts an object-oriented approach, and the control node is a logical control node that can be used directly; b. When building an execution node, first create a new execution node to define the Activity type, and then build its behavior process through scripts, activity diagrams, or sub-behavior trees; C. Create a new Behavior Tree view, drag the execution node and control node to the Behavior Tree for modeling. At this time, the object type generated by the dragged execution node is the Action type.
4. The method for constructing and simulating a scalable and flexible behavior tree based on SysML according to claim 1, characterized in that: In step 3, defining a behavior tree simulation method based on SysML specifically includes: a. The simulation of the behavior tree can be converted into the simulation of the equivalent activity diagram; b. Sequence; c. Alternative; d. Parallel; e. Decorating nodes: Since decorating nodes are often the logical processing of node return values, a new opaque behavior is created in the implementation, the return value is passed into the behavior, and the logic script is edited to process the return value.
5. The method for constructing and simulating a scalable and flexible behavior tree based on SysML according to claim 4, characterized in that: The decoration nodes specifically include: a) Inversion: pass the return value of the execution node to the newly created opaque behavior and negate it; b) Force: pass the return value of the execution node to the newly created opaque behavior, forcing it to return true or false; c) Repeat: It comes with a loop global variable, initialized to 0, and incremented by 1 each time it is executed until the condition is met; d) Delay: Reuse the activity diagram time event node and set the delay time.
6. The method for constructing and simulating a scalable and flexible behavior tree based on SysML according to claim 1, characterized in that: In the step 4, the method for jointly simulating a state machine, an activity diagram, and a behavior tree based on SysML is defined, specifically including: since most tools based on the SysML standard have realized the joint simulation of state diagrams and activity diagrams, the behavior tree simulation of this method is based on the activity diagram simulation, and thus seamless joint simulation with the state machine and activity diagram can be realized.
7. The method for constructing and simulating a scalable and flexible behavior tree based on SysML according to claim 1, characterized in that: This method is based on the SysML standard, defines the expression method of behavior tree, and provides a simulation method based on the SysML standard to realize the linkage simulation of behavior tree, state machine and activity diagram.