I want the node "SetBlackboardValue" to repeat 3 times. But it only runs once and the tree finishes execution. Is there something I am doing wrong here?
###################
import py_trees
from py_trees.decorators import Repeat
class SetBlackboardValue(py_trees.behaviour.Behaviour):
def init(self, name):
super().init(name)
repeat_behavior = Repeat(
name="Repeat",
child=SetBlackboardValue("Set Blackboard Value"),
num_success=3 # Set the number of times to repeat the node
)
root.add_child(repeat_behavior)
return root
def main():
behavior_tree = create_behavior_tree()
tree = py_trees.trees.BehaviourTree(behavior_tree)
try:
print("Behavior Tree Execution:")
tree.setup(timeout=15)
tree.tick()
# pass
# while tree.tick():
# pass
finally:
print("Behavior Tree Finished")
I want the node "SetBlackboardValue" to repeat 3 times. But it only runs once and the tree finishes execution. Is there something I am doing wrong here?
################### import py_trees from py_trees.decorators import Repeat
class SetBlackboardValue(py_trees.behaviour.Behaviour): def init(self, name): super().init(name)
def create_behavior_tree(): root = py_trees.composites.Sequence("Behavior Tree", False)
def main(): behavior_tree = create_behavior_tree() tree = py_trees.trees.BehaviourTree(behavior_tree)
if name == "main": main()