Robot Core Documentation
|
Additional Inherited Members | |
![]() | |
Command () | |
![]() | |
Set< Subsystem > | m_requirements = new HashSet<>() |
Defers Command construction to runtime. Runs the command returned by the supplier when this command is initialized, and ends when it ends. Useful for performing runtime tasks before creating a new command. If this command is interrupted, it will cancel the command.
Note that the supplier must create a new Command each call. For selecting one of a preallocated set of commands, use SelectCommand
.
This class is provided by the NewCommands VendorDep
edu.wpi.first.wpilibj2.command.DeferredCommand.DeferredCommand | ( | Supplier< Command > | supplier, |
Set< Subsystem > | requirements ) |
Creates a new DeferredCommand that runs the supplied command when initialized, and ends when it ends. Useful for lazily creating commands at runtime. The Supplier
will be called each time this command is initialized. The Supplier must create a new Command each call.
void edu.wpi.first.wpilibj2.command.DeferredCommand.end | ( | boolean | interrupted | ) |
The action to take when the command ends. Called when either the command finishes normally, or when it interrupted/canceled.
Do not schedule commands here that share requirements with this command. Use andThen(Command...)
instead.
interrupted | whether the command was interrupted/canceled |
Reimplemented from edu.wpi.first.wpilibj2.command.Command.
void edu.wpi.first.wpilibj2.command.DeferredCommand.execute | ( | ) |
The main body of a command. Called repeatedly while the command is scheduled.
Reimplemented from edu.wpi.first.wpilibj2.command.Command.
void edu.wpi.first.wpilibj2.command.DeferredCommand.initialize | ( | ) |
The initial subroutine of a command. Called once when the command is initially scheduled.
Reimplemented from edu.wpi.first.wpilibj2.command.Command.
void edu.wpi.first.wpilibj2.command.DeferredCommand.initSendable | ( | SendableBuilder | builder | ) |
Initializes this Sendable
object.
builder | sendable builder |
Reimplemented from edu.wpi.first.wpilibj2.command.Command.
boolean edu.wpi.first.wpilibj2.command.DeferredCommand.isFinished | ( | ) |
Whether the command has finished. Once a command finishes, the scheduler will call its end() method and un-schedule it.
Reimplemented from edu.wpi.first.wpilibj2.command.Command.