IdleTask

open class IdleTask : ForeverTask

Task that runs forever but does nothing. This is used as a default task on subsystems that don't have a default task. IdleTask is ignored from subsystem report telemetry via a string match to "IdleTask".

Since

1.0.0-pre

Constructors

Link copied to clipboard
constructor()

Inherited properties

Link copied to clipboard
Link copied to clipboard
protected open var fieldOverlay: Canvas

Convenience field to get a reference to FtcDashboard's field overlay for drawing on the field. Available as soon as init() has been called for this task.

Link copied to clipboard

Timeout value for an infinite task that will run forever.

Link copied to clipboard
Get a reference to the currently running BunyipsOpMode.
Link copied to clipboard
protected open var p: TelemetryPacket

Convenience field to get a reference to a TelemetryPacket for sending telemetry to the dashboard. Available as soon as init() has been called for this task.

Link copied to clipboard

Whether the task is finished or not via timeout or custom condition. Will be true regardless of the finisher being fired or not, as some tasks will handle this via finishNow().

Link copied to clipboard
open var timeout: Measure<Time>

Functions

Link copied to clipboard
protected open fun init()
Define code to run once, when the task is started.
Link copied to clipboard
protected open fun onFinish()
Finalising function to run once the task is finished.
Link copied to clipboard
protected open fun periodic()
To run as an active loop during this task's duration.

Inherited functions

Link copied to clipboard
fun after(otherTasks: Array<Task>): SequentialTaskGroup

Compose this task into a SequentialTaskGroup with the supplied tasks to run before this one.

Link copied to clipboard
fun defer(taskBuilder: () -> out Task): DynamicTask

Utility to create a new DynamicTask based on the supplied task builder. Useful for constructing tasks that use data that is not available at the build time of the wrapped task.

Link copied to clipboard
fun during(otherTasks: Array<Task>): DeadlineTaskGroup

Compose this task into a DeadlineTaskGroup with the supplied tasks to run these extra tasks until this task is done.

Link copied to clipboard
fun finish()

Tell a task to finish on the next iteration.

Link copied to clipboard
fun finishNow()

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.

Link copied to clipboard

Composes a ParallelTaskGroup with a WaitTask to run before this task. This will ensure the task runs for at least the specified time, and no-ops until the duration if it finishes early.

Link copied to clipboard

Time in seconds since the task was started.

Link copied to clipboard

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.

Link copied to clipboard
protected fun getFieldOverlay(): Canvas

Convenience field to get a reference to FtcDashboard's field overlay for drawing on the field. Available as soon as init() has been called for this task.

Link copied to clipboard
protected fun getP(): TelemetryPacket

Convenience field to get a reference to a TelemetryPacket for sending telemetry to the dashboard. Available as soon as init() has been called for this task.

Link copied to clipboard

Return whether this task has elected a dependency on a subsystem or not.

Link copied to clipboard

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.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
protected fun isTaskFinished(): Boolean
Return a boolean to this method to add custom criteria if a task should be considered finished.
protected abstract fun isTaskFinished(): Boolean

Return a boolean to this method to add custom criteria if a task should be considered finished.

Link copied to clipboard

Mute task reports from the Scheduler.

Link copied to clipboard
fun named(name: String): Task

Set the name of this task to be displayed in the OpMode.

Link copied to clipboard
fun on(subsystem: BunyipsSubsystem): Task

Set the subsystem you want to elect this task to run on, notifying the runner that this task should run there. This task is scheduled with default override behaviour.

Link copied to clipboard
protected open fun onInterrupt()

Finalising function that will be called after onFinish in the event this task is finished via a call to finish or finishNow. Override to add your own callback.

Link copied to clipboard
protected open fun onReset()

Called when the task is resetting now. Override this method to add custom reset behaviour, such as resetting any internal state variables such as iterators or lists.

Link copied to clipboard
open fun onSubsystem(subsystem: BunyipsSubsystem, override: Boolean): Task

Set the subsystem you want to elect this task to run on, notifying the runner that this task should run there.

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.
Link copied to clipboard

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.

Link copied to clipboard
fun preview(fieldOverlay: Canvas)

RoadRunner Action implementation to preview the action on the field overlay. This method no-ops as previews are done via DualTelemetry and the Drawing util.

open fun preview(fieldOverlay: Canvas)
Link copied to clipboard
fun race(otherTasks: Array<Task>): RaceTaskGroup

Compose this task into a RaceTaskGroup with the supplied tasks to run all of these tasks until one finishes.

Link copied to clipboard

Wrap this task in a RepeatTask where finish conditions are reset immediately.

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.
Link copied to clipboard
fun reset()

Reset a task to an uninitialised and unfinished state. Will no-op if the task is already fully reset.

Link copied to clipboard
fun run()

Should be called by your polling loop to run the task and manage all state properly.

fun run(p: TelemetryPacket): Boolean

RoadRunner Action implementation to run this Task.

abstract fun run(p: TelemetryPacket): Boolean
abstract fun run()
Link copied to clipboard
protected fun setFieldOverlay(<set-?>: Canvas)

Convenience field to get a reference to FtcDashboard's field overlay for drawing on the field. Available as soon as init() has been called for this task.

Link copied to clipboard
protected fun setP(<set-?>: TelemetryPacket)

Convenience field to get a reference to a TelemetryPacket for sending telemetry to the dashboard. Available as soon as init() has been called for this task.

Link copied to clipboard
fun then(otherTasks: Array<Task>): SequentialTaskGroup

Compose this task into a SequentialTaskGroup with the supplied tasks to follow after this one.

Link copied to clipboard
fun timeout(timeout: Measure<Time>): Task

Set the timeout of this task dynamically and return the task.

Link copied to clipboard

Get the name of this task. By default, it will be the class simple name, but you can call withName to set a custom name.

Link copied to clipboard

Get a verbose string representation of this task, including all of its properties.

Link copied to clipboard

Compose this task into a RaceTaskGroup with a WaitUntilTask based on this condition.

Link copied to clipboard
fun with(otherTasks: Array<Task>): ParallelTaskGroup

Compose this task into a ParallelTaskGroup with the supplied tasks to run all of these tasks at once.

Link copied to clipboard
open fun withName(name: String): Task

Set the name of this task to be displayed in the OpMode. You may override this method if required to enforce a naming convention/prefix.

Link copied to clipboard
fun withTimeout(timeout: Measure<Time>): Task

Set the timeout of this task dynamically and return the task.