A decorator's tick is exactly the same as a normal proceedings for a Behaviour's tick except that it also ticks the decorated child node. Yields: :class:`~py_trees.behaviour.Behaviour`: a reference to itself or one of its children
(self)
| 46 | self.decorated.parent = self |
| 47 | |
| 48 | def tick(self): |
| 49 | """ |
| 50 | A decorator's tick is exactly the same as a normal proceedings for |
| 51 | a Behaviour's tick except that it also ticks the decorated child node. |
| 52 | Yields: |
| 53 | :class:`~py_trees.behaviour.Behaviour`: a reference to itself or one of its children |
| 54 | """ |
| 55 | self.logger.debug("%s.tick()" % self.__class__.__name__) |
| 56 | # initialise just like other behaviours/composites |
| 57 | if self.status != py_trees.common.Status.RUNNING: |
| 58 | self.initialise() |
| 59 | # interrupt proceedings and process the child node |
| 60 | # (including any children it may have as well) |
| 61 | for node in self.decorated.tick(): |
| 62 | yield node |
| 63 | # resume normal proceedings for a Behaviour's tick |
| 64 | new_status = self.update() |
| 65 | if new_status not in list(py_trees.common.Status): |
| 66 | self.logger.error( |
| 67 | "A behaviour returned an invalid status, setting to INVALID [%s][%s]" % (new_status, self.name)) |
| 68 | new_status = py_trees.common.Status.INVALID |
| 69 | if new_status != py_trees.common.Status.RUNNING: |
| 70 | self.stop(new_status) |
| 71 | self.status = new_status |
| 72 | yield self |
| 73 | |
| 74 | def stop(self, new_status=py_trees.common.Status.INVALID): |
| 75 | """ |
no test coverage detected