Skip to content

Commit

Permalink
[composites] Reduce circulation when the parallel node policy is Succ…
Browse files Browse the repository at this point in the history
…essOnOne (#440)
  • Loading branch information
starrye authored Sep 3, 2024
1 parent 2b7caf2 commit 7d3d907
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions py_trees/composites.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,14 +731,11 @@ def tick(self) -> typing.Iterator[behaviour.Behaviour]:
new_status = common.Status.SUCCESS
self.current_child = self.children[-1]
elif type(self.policy) is common.ParallelPolicy.SuccessOnOne:
successful = [
child
for child in self.children
if child.status == common.Status.SUCCESS
]
if successful:
new_status = common.Status.SUCCESS
self.current_child = successful[-1]
for child in reversed(self.children):
if child.status == common.Status.SUCCESS:
new_status = common.Status.SUCCESS
self.current_child = child
break
elif type(self.policy) is common.ParallelPolicy.SuccessOnSelected:
if all(
[c.status == common.Status.SUCCESS for c in self.policy.children]
Expand Down

0 comments on commit 7d3d907

Please sign in to comment.