Package edu.wpi.first.wpilibj2.command
Class RunCommand
java.lang.Object
edu.wpi.first.wpilibj2.command.Command
edu.wpi.first.wpilibj2.command.FunctionalCommand
edu.wpi.first.wpilibj2.command.RunCommand
- All Implemented Interfaces:
Sendable
public class RunCommand extends FunctionalCommand
A command that runs a Runnable continuously. Has no end condition as-is; either subclass it or
use
Command.withTimeout(double)
or Command.until(BooleanSupplier)
to give it one.
If you only wish to execute a Runnable once, use InstantCommand
.
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 RunCommand(Runnable toRun, Subsystem... requirements)
Creates a new RunCommand. -
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
-
RunCommand
Creates a new RunCommand. The Runnable will be run continuously until the command ends. Does not run when disabled.- Parameters:
toRun
- the Runnable to runrequirements
- the subsystems to require
-