Skip to content

Selector with memory may need bugfix? #477

@jaehyeon-holiday

Description

@jaehyeon-holiday

https://github.com/splintered-reality/py_trees/blob/devel/py_trees/composites.py
in line 424~432,

tick() function of class Selector should be fixed like this?
otherwise, Selector with memory calls stop for not-running high-priority child every tick, even though the child is in already INVALID status

         if self.memory:
             assert self.current_child is not None  # should never be true, help mypy out
             index = self.children.index(self.current_child)
             # clear out preceding status' - not actually necessary but helps
             # visualise the case of memory vs no memory
-            for child in itertools.islice(self.children, None, index):
-                child.stop(common.Status.INVALID)
+            for child in itertools.islice(self.children, None, index):
+                if child.status != common.Status.INVALID:
+                    child.stop(common.Status.INVALID)
         else:
             index = 0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions