- Direct Known Subclasses:
public class InstantCommand extends FunctionalCommand
A Command that runs instantly; it will initialize, execute once, and end on the same iteration of the scheduler. Users can either pass in a Runnable and a set of requirements, or else subclass this command if desired.
This class is provided by the NewCommands VendorDep
Nested Class Summary
Nested classes/interfaces inherited from interface edu.wpi.first.wpilibj2.command.Command
Fields inherited from class edu.wpi.first.wpilibj2.command.FunctionalCommand
m_isFinished, m_onEnd, m_onExecute, m_onInit
Fields inherited from class edu.wpi.first.wpilibj2.command.CommandBase
Constructors Constructor Description
InstantCommand()Creates a new InstantCommand with a Runnable that does nothing.
InstantCommand(Runnable toRun, Subsystem... requirements)Creates a new InstantCommand that runs the given Runnable with the given requirements.
Methods inherited from class edu.wpi.first.wpilibj2.command.FunctionalCommand
end, execute, initialize, isFinished
Methods inherited from class edu.wpi.first.wpilibj2.command.CommandBase
addRequirements, getName, getRequirements, getSubsystem, initSendable, setName, setSubsystem
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface edu.wpi.first.wpilibj2.command.Command
alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineWith, finallyDo, getInterruptionBehavior, handleInterrupt, hasRequirement, ignoringDisable, isScheduled, perpetually, raceWith, repeatedly, runsWhenDisabled, schedule, unless, until, withInterrupt, withInterruptBehavior, withName, withTimeout
InstantCommandpublic InstantCommand(Runnable toRun, Subsystem... requirements)Creates a new InstantCommand that runs the given Runnable with the given requirements.
toRun- the Runnable to run
requirements- the subsystems required by this command
InstantCommandpublic InstantCommand()Creates a new InstantCommand with a Runnable that does nothing. Useful only as a no-arg constructor to call implicitly from subclass constructors.