addTaskAtIndex

fun addTaskAtIndex(index: Int, @NotNull newTask: Task)

Insert a task at a specific index in the queue. This is useful for adding tasks that should be run at a specific point in the autonomous sequence. Note that this function immediately produces side effects, and subsequent calls will not be able to insert tasks at the same index due to the shifting of tasks.

Parameters

index

the index to insert the task at, starting from 0

newTask

the task to add to the run queue


fun addTaskAtIndex(index: Int, @NotNull runnable: Runnable)

Insert a task at a specific index in the queue. This is useful for adding tasks that should be run at a specific point in the autonomous sequence. Note that this function immediately produces side effects, and subsequent calls will not be able to insert tasks at the same index due to the shifting of tasks.

Parameters

index

the index to insert the task at, starting from 0

runnable

the code to add to the run queue to run once