Package edu.wpi.first.wpilibj2.command
Class InstantCommand
java.lang.Object
edu.wpi.first.wpilibj2.command.Command
edu.wpi.first.wpilibj2.command.FunctionalCommand
edu.wpi.first.wpilibj2.command.InstantCommand
- All Implemented Interfaces:
Sendable
- Direct Known Subclasses:
PrintCommand
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 class edu.wpi.first.wpilibj2.command.Command
Command.InterruptionBehavior
-
Field Summary
-
Constructor Summary
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. -
Method Summary
Methods inherited from class edu.wpi.first.wpilibj2.command.FunctionalCommand
end, execute, initialize, isFinished
Methods inherited from class edu.wpi.first.wpilibj2.command.Command
addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineWith, finallyDo, finallyDo, getInterruptionBehavior, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, initSendable, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, runsWhenDisabled, schedule, setName, setSubsystem, unless, until, withInterruptBehavior, withName, withTimeout
-
Constructor Details
-
InstantCommand
Creates a new InstantCommand that runs the given Runnable with the given requirements.- Parameters:
toRun
- the Runnable to runrequirements
- the subsystems required by this command
-
InstantCommand
public InstantCommand()Creates a new InstantCommand with a Runnable that does nothing. Useful only as a no-arg constructor to call implicitly from subclass constructors.
-