Task
A task, or command is an action that can be performed by a robot. This has been designed to reflect closely the command-based programming style used in FRC, while still being reflective of the past nature of how the Task system was implemented in BunyipsLib.
The task system in BunyipsLib has been constructed from the ground-up with a more lightweight ecosystem where Tasks are at their core stripped into running some code for some time, somewhere. The original behaviour of tasks running outright used to be the legacy roots of how Tasks worked, and since has adopted some command-based structures that work alongside the lightweight premise of a Task being "a Runnable with a timeout" with a run implementation left to the user.
Some different implementations on how Tasks are interpreted are demonstrated in these classes:
Scheduler
BunyipsOpMode
AutonomousBunyipsOpMode
BunyipsSubsystem
Tasks
Author
Lucas Bubner, 2024
Since
1.0.0-pre
Inheritors
Constructors
A task that does not have an integrated timeout, and will rely on manual intervention and isTaskFinished.
Properties
Functions
Force a task to finish immediately, and fire the onFinish() method without waiting for the next polling loop. This method is useful when your task needs to die and needs to finish up immediately. If your finisher has already been fired, this method will do nothing but ensure that the task is marked as finished.
Get the subsystem reference that this task has elected a dependency on. Will return an Optional where if it is not present, this task is not dependent on any subsystem.
Return whether this task has elected a dependency on a subsystem or not.
Query (but not update) the finished state of the task. This will return true if the task is finished and the finisher has been fired.
Return a boolean to this method to add custom criteria if a task should be considered finished.
Set the subsystem you want to elect this task to run on, notifying the runner that this task should run there.
Update and query the state of the task if it is finished. This will return true if the task is finished and the finisher has been fired.
Get a verbose string representation of this task, including all of its properties.
Mute task reports from the Scheduler.
Set the timeout of this task dynamically and return the task.