robokudo.behaviours.run_until¶
Timing behavior for RoboKudo behavior trees.
This module provides a behavior that runs for a specified duration before succeeding. It can be used to:
Create timed delays in behavior trees
Implement timeout mechanisms
Create periodic behaviors with reset capability
The behavior tracks elapsed time across multiple ticks and supports optional automatic reset after completion.
Classes¶
Returns py_trees.Status.RUNNING until wait_seconds is reached starting from the first call to update. If update is |
Module Contents¶
- class robokudo.behaviours.run_until.RunUntil(name='RunUntil', wait_seconds: float = 10, reset_on_done: bool = True)¶
-
Bases:
py_trees.BehaviourReturns py_trees.Status.RUNNING until wait_seconds is reached starting from the first call to update. If update is called after the Behaviour waited for wait_seconds or longer py_trees.Status.SUCCESS will be returned. If reset_on_done is True this will start over after returning py_trees.Status.SUCCESS once.
- Variables:
-
wait_seconds – Number of seconds to wait before succeeding
reset_on_done – Whether to reset timer after succeeding
waited_seconds – Accumulated wait time so far
last_time – Timestamp of last update
- wait_seconds = 10¶
- reset_on_done = True¶
- waited_seconds = 0¶
- last_time = None¶
- initialise() None¶
-
Reset the behavior’s internal timing state.
Called when the behavior is first ticked and after it completes if reset_on_done is True.
- update() py_trees.common.Status¶
-
Update the behavior’s elapsed time and check for completion.
This method: * Updates the total elapsed time since initialization * Checks if the wait duration has been reached * Handles resetting if configured to do so * Returns appropriate status based on elapsed time
- Returns:
-
SUCCESS if wait_seconds has elapsed, RUNNING otherwise
- Return type:
-
py_trees.common.Status