Package edu.wpi.first.wpilibj2.command
Class RunCommand
java.lang.Object
edu.wpi.first.wpilibj2.command.CommandBase
edu.wpi.first.wpilibj2.command.FunctionalCommand
edu.wpi.first.wpilibj2.command.RunCommand
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 interface edu.wpi.first.wpilibj2.command.Command
Command.InterruptionBehavior
-
Field Summary
Fields inherited from class edu.wpi.first.wpilibj2.command.FunctionalCommand
m_isFinished, m_onEnd, m_onExecute, m_onInit
-
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.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, onlyIf, onlyWhile, raceWith, repeatedly, runsWhenDisabled, schedule, 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
-