Class RunCommand

java.lang.Object
edu.wpi.first.wpilibj2.command.CommandBase
edu.wpi.first.wpilibj2.command.RunCommand
All Implemented Interfaces:
Sendable, Command

public class RunCommand
extends CommandBase
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

  • Field Details

  • Constructor Details

    • RunCommand

      public RunCommand​(Runnable toRun, Subsystem... requirements)
      Creates a new RunCommand. The Runnable will be run continuously until the command ends. Does not run when disabled.
      Parameters:
      toRun - the Runnable to run
      requirements - the subsystems to require
  • Method Details

    • execute

      public void execute()
      Description copied from interface: Command
      The main body of a command. Called repeatedly while the command is scheduled.