Python 行为树 py_trees的一种注意情况: memory=True | False
py_trees…composites.Sequence(name=“root”,memory=True)
官方文档是这样写的
If configured with memory and a child returned with running on the previous tick, it will proceed directly to the running behaviour, skipping any and all preceding behaviours. With memory is useful for moving through a long running series of tasks. Without memory is useful if you want conditional guards in place preceding the work that you always want checked off.
在Sequence节点中:
memory参数为True时,当一个tick来临时,如果上一个状态中Sequence节点的子节点处于Running状态,那么行为树会直接处理该子节点,忽略该节点前面的兄弟节点;
memory参数为False时,当一个tick来临时,即使上一个状态中Sequence节点的子节点处于Running状态,行为树也会依次处理各个子节点,即不忽略该节点前面的兄弟节点。也就是说,如果希望一个action在执行时,每一tick都检查以下action的执行条件,可以将条件节点和action节点共处于一个父Sequence节点下,并设置memory=False。
参考:BehavioTree.CPP库中,作者使用ReactiveSequence实现了该逻辑,如下
If we use a ReactiveSequence instead,
when the child MoveBase returns RUNNING,
the sequence is restarted and the condition BatteryOK is executed again.
标签:False,Sequence,py,memory,tick,True,节点
From: https://blog.csdn.net/hxd942634/article/details/137637630