automation
Automator ¶
Automator(
steerer: Optional[Steerer],
*,
default_automation: Optional[Callable] = None,
on_interrupt: Optional[Callable] = None
) -> None
An automator allows running automations, i.e. coroutines that can be paused and resumed.
See Click-and-drive for a simple example of an automation.
steerer: If provided, manually steering the robot will pause a currently running automation.
default_automation: If provided, it allows the automator to start a new automation without passing an automation (e.g. via an "Play"-button like offered by the automation controls). The passed function should return a new coroutine on every call (see Play-pause-stop example).
on_interrupt: Optional callback that will be called when an automation pauses or stops.
disable ¶
disable(because: str) -> None
Disables the automator.
No automations can be started while the automator is disabled. If an automation is running or paused it will be stopped. You need to provide a cause which will be used as notification message.
enable ¶
enable() -> None
Enables the automator.
It is enabled by default.
It can be disabled by calling disable()
.
pause ¶
pause(because: str) -> None
Pauses the current automation.
You need to provide a cause which will be used as notification message.
start ¶
start(coro: Optional[Coroutine] = None) -> None
Starts a new automation.
You can pass any coroutine. The automator will make sure it can be paused, resumed and stopped.
stop ¶
stop(because: str) -> None
Stops the current automation.
You need to provide a cause which will be used as notification message.
Events¶
Name | Description |
---|---|
AUTOMATION_STARTED | an automation has been started |
AUTOMATION_PAUSED | an automation has been paused (string argument: description of the cause) |
AUTOMATION_RESUMED | an automation has been resumed |
AUTOMATION_STOPPED | an automation has been stopped (string argument: description of the cause) |
AUTOMATION_FAILED | an automation has failed to complete (string argument: description of the cause) |
AUTOMATION_COMPLETED | an automation has been completed |
app_controls ¶
app_controls(
robot_brain: RobotBrain, automator: Automator
) -> None
The AppControls module enables the connection with a mobile-app-based user interface.
It uses a given RobotBrain object to communicate with Lizard running on a microcontroller and in turn being connected to a mobile app via Bluetooth Low Energy. It displays buttons to control a given automator.
Events¶
Name | Description |
---|---|
APP_CONNECTED | an app connected via bluetooth (used to refresh information or similar) |
automation_controls ¶
automation_controls(automator: Automator) -> None
This UI element contains start/stop/pause/resume buttons for controlling a given automator.
See Play-pause-stop for a simple example of the automation controls.