001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package edu.wpi.first.wpilibj2.command;
006
007import java.util.function.BooleanSupplier;
008
009/**
010 * A command that runs a Runnable continuously. Has no end condition as-is; either subclass it or
011 * use {@link Command#withTimeout(double)} or {@link Command#until(BooleanSupplier)} to give it one.
012 * If you only wish to execute a Runnable once, use {@link InstantCommand}.
013 *
014 * <p>This class is provided by the NewCommands VendorDep
015 */
016public class RunCommand extends FunctionalCommand {
017  /**
018   * Creates a new RunCommand. The Runnable will be run continuously until the command ends. Does
019   * not run when disabled.
020   *
021   * @param toRun the Runnable to run
022   * @param requirements the subsystems to require
023   */
024  public RunCommand(Runnable toRun, Subsystem... requirements) {
025    super(() -> {}, toRun, interrupted -> {}, () -> false, requirements);
026  }
027}