| Behavior Tree(BT)is a behavior modeling tool derived from computer game design.It has the advantages of modularity,hierarchy,reactivity,and readability,which can be used to model the behavior of agents and implement the task-switching functionalities.Despite the increasing popularity of BT in the field of robotics,the current application of BT in parallel task execution is still immature.There are two main reasons for this.First,the parallel control node in the classic BT model requires that the tasks of the sub-nodes are independent of each other.However,it is common to have dependencies between the parallel tasks in practical applications,which requires synchronization and cooperation to accomplish the mission.In addition,resource-related problems such as competition,starvation,and deadlock often occur when executing BT tasks in parallel.However,classic BT only allows setting the priority of tasks to ensure the orderly execution of parallel tasks,it does not systematically analyze how to use resources reasonably in the behavior tree to improve the efficiency of task execution.In view of the above problems,this thesis carries out research to improve the task synchronization and resource scheduling in BT parallel execution.The main work is as follows:(1)In order to improve the synchronization of parallel tasks in BT,this thesis proposes to introduce a hierarchical structure to parallel tasks,Parallel tasks are categorized into the leader task and follower tasks,and state values is defined for each task to indicate its execution progress,there can only be one leader task while multiple follower tasks are allowed.On this basis,this thesis designs strong synchronization and weak synchronization parallel execution control nodes,which synchronize the execution of parallel tasks by comparing the state values of the leader and follower tasks.In particular,the strong synchronization node has stricter restrictions on parallel tasks,in which the execution of follower tasks is adjusted at any time to keep their state value consistent with that of the leader.In comparison,the weak synchronization allows a certain difference in status value between the followers and the leaders.Only when the difference is higher than a set threshold value,an adjustment will be made.(2)In order to solve the problem of resource scheduling in BT parallel execution,this thesis proposes to integrate several classic resource scheduling algorithms into BT.In particular,this thesis designs priority four new types of BT control nodes for resource scheduling optimization: priority nodes,high response ratio nodes,proportional share nodes,rotate nodes.The priority node determines the order of resource use through the priority of the task;the high response ratio node allocates the use of resources considering factors such as the execution time and waiting time of the task;the proportional share node randomly selects a task to use the resources at each time step by a given probability,rotating nodes is the fairest,in which tasks use resources in turn.(3)Simulation experiments are designed with Robot Operating System(ROS)as the platform,and two different scenarios are used for evaluation.First,this thesis verifies the mechanism of parallel execution task synchronization.The results show that the hierarchical task architecture proposed in this topic can effectively establish connections for parallel tasks,and complete task synchronization well under the regulation of control nodes.In addition,the experimental results of the resource scheduling for parallel tasks verify that the resource scheduling control nodes proposed in this topic achieve the expected results. |