Package lib.commands

Class ThresholdCommand<T extends Comparable<T>>

java.lang.Object
edu.wpi.first.wpilibj2.command.Command
lib.commands.ThresholdCommand<T>
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable

public class ThresholdCommand<T extends Comparable<T>> extends edu.wpi.first.wpilibj2.command.Command
Threshold command takes in a command, a supplier, and a threshold. When the threshold is passed by the supplier, it starts the command. When the threshold stops being passed, it cancels the command.
  • Nested Class Summary

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

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

    Fields
    Modifier and Type
    Field
    Description
    protected final edu.wpi.first.wpilibj2.command.Command
     
    protected final boolean
     
    protected final Supplier<T>
     
    protected final T
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ThresholdCommand(edu.wpi.first.wpilibj2.command.Command command, Supplier<T> axis, T threshold)
     
    ThresholdCommand(edu.wpi.first.wpilibj2.command.Command command, Supplier<T> supplier, T threshold, boolean invert)
     
    ThresholdCommand(String name, edu.wpi.first.wpilibj2.command.Command command, Supplier<T> supplier, T threshold, boolean invert)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected boolean
     

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

    addRequirements, addRequirements, alongWith, andThen, andThen, asProxy, beforeStarting, beforeStarting, cancel, deadlineFor, deadlineWith, end, finallyDo, finallyDo, getInterruptionBehavior, getName, getRequirements, getSubsystem, handleInterrupt, hasRequirement, ignoringDisable, initialize, initSendable, isFinished, isScheduled, onlyIf, onlyWhile, raceWith, repeatedly, runsWhenDisabled, 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
  • Field Details

    • command

      protected final edu.wpi.first.wpilibj2.command.Command command
    • supplier

      protected final Supplier<T extends Comparable<T>> supplier
    • threshold

      protected final T extends Comparable<T> threshold
    • invert

      protected final boolean invert
  • Constructor Details

    • ThresholdCommand

      public ThresholdCommand(String name, edu.wpi.first.wpilibj2.command.Command command, Supplier<T> supplier, T threshold, boolean invert)
    • ThresholdCommand

      public ThresholdCommand(edu.wpi.first.wpilibj2.command.Command command, Supplier<T> supplier, T threshold, boolean invert)
    • ThresholdCommand

      public ThresholdCommand(edu.wpi.first.wpilibj2.command.Command command, Supplier<T> axis, T threshold)
  • Method Details

    • pastThreshold

      protected boolean pastThreshold()
    • execute

      public void execute()
      Overrides:
      execute in class edu.wpi.first.wpilibj2.command.Command