Bases: Action
Action used if no other action is available.
Reset recycled attribute of all actions at the end.
Source code in cogip/tools/planner/actions/action_wait.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34 | class WaitAction(Action):
"""
Action used if no other action is available.
Reset recycled attribute of all actions at the end.
"""
def __init__(self, planner: "Planner", strategy: "Strategy", delay_seconds: int = 2):
super().__init__("Wait action", planner, strategy)
self.delay_seconds = delay_seconds
self.before_action_func = self.before_wait
self.after_action_func = self.after_wait
def weight(self) -> float:
return 1
async def before_wait(self):
self.logger.debug(f"Robot {self.planner.robot_id}: WaitAction: before action")
async def after_wait(self):
self.logger.debug(f"Robot {self.planner.robot_id}: WaitAction: after action")
await asyncio.sleep(self.delay_seconds)
for action in self.strategy:
action.recycled = False
|