LambdaCommand

open class LambdaCommand : Command

A Command that is created using lambdas to define each function instead of manually overriding the functions.

Author

BeepBot99

Inheritors

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
open override var interruptible: Boolean

Whether this command can be stopped due to a conflict of Subsystems.

Link copied to clipboard
open override val isDone: Boolean

Whether this command has completed running. Often implemented using a getter function, although it can be set directly for commands that stop instantly or never stop. Please note that in certain circumstances the command will be stopped before this evaluates to true, most notably during subsystem conflicts or when the OpMode has been stopped.

Link copied to clipboard
open override var subsystems: Set<Subsystem>

A set of all Subsystems this command implements.

Functions

Link copied to clipboard

Adds a subsystem to the set of subsystems that the command implements

Link copied to clipboard
fun addSubsystems(vararg subsystemsArr: Subsystem): LambdaCommand

Adds subsystems to the set of subsystems that the command implements

Link copied to clipboard

Returns a SequentialGroup with a Delay and then this command

Link copied to clipboard
fun and(vararg commands: Command): ParallelGroup

Returns a ParallelGroup with this command and an arbitrary number of other commands

Link copied to clipboard

Returns a ParallelDeadlineGroup with this command as the deadline

Link copied to clipboard

Returns a ParallelRaceGroup with this command and a Delay of time

Link copied to clipboard
operator fun invoke()

Allows you to directly "call" a command

Link copied to clipboard

Returns a PerpetualCommand that wraps this command

Link copied to clipboard
fun raceWith(vararg commands: Command): ParallelRaceGroup

Returns a ParallelRaceGroup with this command and an arbitrary number of other commands

Link copied to clipboard
fun setInterruptible(isInterruptible: Boolean): LambdaCommand

Sets whether the command can be stopped due to an overlap of subsystems

Link copied to clipboard

Sets the function that returns whether the command has finished running

Link copied to clipboard

Sets the function that is called when the command is first scheduled

Link copied to clipboard

Sets the function that is called when the command is finished Receives a boolean that is whether the command has been interrupted

Link copied to clipboard

Sets the subsystem that the command implements

Link copied to clipboard
fun setSubsystems(vararg subsystemsArr: Subsystem): LambdaCommand

Sets the subsystems that the command implements

Link copied to clipboard

Sets the function that is called repeatedly while the command is running

Link copied to clipboard
open override fun start()

Called once when the command is first started

Link copied to clipboard
open override fun stop(interrupted: Boolean)

Called once when the command is stopped.

Link copied to clipboard
fun then(vararg commands: Command): SequentialGroup

Returns a SequentialGroup with this command and an arbitrary number of other commands

Link copied to clipboard

Returns a SequentialGroup with this command and then a Delay

Link copied to clipboard
open override fun update()

Called repeatedly while the command is running.

Link copied to clipboard

Returns a ParallelDeadlineGroup with this command and the passed command as the deadline