Scheduler

Scheduler and command plexus for use with the BunyipsLib task system in TeleOp.

Author

Lucas Bubner, 2024

Since

1.0.0-pre

See also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Controller trigger creator.

Link copied to clipboard
inner class ScheduledTask(originalRunCondition: Condition)

A task that will run when a condition is met.

Properties

Inherited properties

Link copied to clipboard
protected val opMode: BunyipsOpMode?

Get a reference to the currently running BunyipsOpMode.

Functions

Link copied to clipboard
fun addSubsystems(vararg dispatch: BunyipsSubsystem)

Add subsystems to the scheduler. This will ensure the update() method of the subsystems is called, and that commands can be scheduled on these subsystems. This is REQUIRED to be called if using a base implementation of Scheduler. If you are using a CommandBasedBunyipsOpMode, see the use() method or rely on the automatic features during construction that will add subsystems at construction with no need to call this method.

Link copied to clipboard

Run a task always. This is the same as calling .when(() -> true).

Link copied to clipboard
fun disable()

Disable all subsystems attached to the Scheduler.

Link copied to clipboard

Create a new controller button trigger creator for the driver.

Link copied to clipboard
fun enable()

Enable all subsystems attached to the Scheduler, unless they failed from null assertion.

Link copied to clipboard

Get all allocated tasks.

Link copied to clipboard
fun mute()

Mute Scheduler telemetry.

Link copied to clipboard

Create a new controller button trigger creator.

Run a task when a condition is met. This condition will be evaluated continuously.

Link copied to clipboard

Create a new controller button trigger creator for the operator.

Link copied to clipboard
fun run()

Run the scheduler. This will run all subsystems and tasks allocated to the scheduler. This should be called in the activeLoop() method of the BunyipsOpMode, and is automatically called in CommandBasedBunyipsOpMode.

Link copied to clipboard
fun unmute()

Unmute Scheduler telemetry.

Link copied to clipboard

Create a new controller button trigger creator.

Run a task when a condition is met. This condition will be evaluated continuously.

Link copied to clipboard

Run a task when a condition is met. This condition will be evaluated according to a falling-edge detection.

Link copied to clipboard

Run a task when a condition is met. This condition will be evaluated according to a rising-edge detection.

Inherited functions

Link copied to clipboard
protected fun opMode(@NonNull ifRunning: Consumer<BunyipsOpMode>)

Null check consumer for the opMode field which will no-op the given consumer if an active BunyipsOpMode is not present (i.e. the opMode field is null). This method is the same to the BunyipsOpMode.ifRunning method, and is supplied here for convenience.

Link copied to clipboard
protected fun require(@Nullable nullableOpMode: BunyipsOpMode?): BunyipsOpMode

Null assertion for the opMode field which throws a NullPointerException if an active BunyipsOpMode is not present (i.e. the supplied field is null). This method replicates Objects.requireNonNull but has a built-in message to alert the user of a non-active OpMode.