Package lib.commands

Class RunIf

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
edu.wpi.first.wpilibj2.command.ConditionalCommand
lib.commands.RunIfElse
lib.commands.RunIf
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable

public class RunIf extends RunIfElse
  • Nested Class Summary

    Nested classes/interfaces inherited from class edu.wpi.first.wpilibj2.command.Command

    edu.wpi.first.wpilibj2.command.Command.InterruptionBehavior
  • Constructor Summary

    Constructors
    Constructor
    Description
    RunIf(edu.wpi.first.wpilibj2.command.Command command, BooleanSupplier... conditions)
    Run a command based on a conditional callback.
  • Method Summary

    Methods inherited from class edu.wpi.first.wpilibj2.command.ConditionalCommand

    end, execute, getInterruptionBehavior, initialize, initSendable, isFinished, runsWhenDisabled

    Methods inherited from class edu.wpi.first.wpilibj2.command.Command

    addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, deadlineWith, finallyDo, finallyDo, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, schedule, setName, setSubsystem, unless, until, withDeadline, withInterruptBehavior, withName, withTimeout, withTimeout

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • RunIf

      public RunIf(edu.wpi.first.wpilibj2.command.Command command, BooleanSupplier... conditions)
      Run a command based on a conditional callback. For example, if you only want to shoot if a shooter is ready (based on its isReady() function), use: new RunIf(new Shoot(), shooter::isReady)

      Conditions are AND-ed together (command will only run if ALL are true).

      Parameters:
      command - The command to be run if the condition is met
      conditions - A variable number of condition functions