blob: 34d8fa4cbffbf76c94bd5942030285c6cbd38f18 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
from py_trees.behaviour import Behaviour
from py_trees.common import Status
# This provides the same functionality as py_trees's internal Timer class, but
# uses the number of steps instead of time, ensuring the same result regardless
# of the simulation speed.
class Sleep(Behaviour):
def __init__(self, name, steps=20):
super().__init__(name)
self.steps = steps
def update(self):
while self.steps > 0:
self.steps -= 1
return Status.RUNNING
return Status.SUCCESS
|