java.lang.Object
io.github.tigerbotics7125.tigerlib.input.trigger.Trigger
All Implemented Interfaces:
edu.wpi.first.util.sendable.Sendable, BooleanSupplier
Direct Known Subclasses:
JoystickAxisTrigger, JoystickPOVTrigger, JoystickTrigger

public class Trigger extends Object implements BooleanSupplier, edu.wpi.first.util.sendable.Sendable
This class provides a way to track a boolean compared to time as a circuit would.

This class is meant to be a replacement for WPILib's version. Anything that uses a WPILib Trigger can easily be converted to work with this class.

  • Constructor Details

    • Trigger

      public Trigger(BooleanSupplier input)
      Create a new Trigger Object.
      Parameters:
      input - The boolean input.
    • Trigger

      public Trigger(BooleanSupplier input, edu.wpi.first.math.filter.Debouncer debouncer)
      Create a Trigger Object with a debouncer on a raw input.
      Parameters:
      input - The boolean input.
      debouncer - The debouncer object to pad bounces with.
  • Method Details

    • getAsBoolean

      public boolean getAsBoolean()
      Specified by:
      getAsBoolean in interface BooleanSupplier
      Returns:
      The input to this Trigger.
    • join

      public Trigger join(TriggerGroup triggerGroup)
    • leave

      public Trigger leave(TriggerGroup triggerGroup)
    • trigger

      public Trigger trigger(Trigger.ActivationCondition activateFor, edu.wpi.first.wpilibj2.command.Command cmd)
      Execute the given command when/while this Trigger is triggered.
      Parameters:
      cmd - The Command to trigger.
      Returns:
      This Trigger for chaining methods.
    • enable

      public void enable()
      Enables this Trigger.
    • disable

      public void disable()
      Disables this Trigger.
    • isEnabled

      public boolean isEnabled()
      Returns:
      If this Trigger is enabled.
    • isDisabled

      public boolean isDisabled()
      Returns:
      If this Trigger is disabled.
    • and

      public Trigger and(Trigger other)
      Create a Trigger representing a logical AND with another Trigger.
       AND
       |A|B||C|
       |0|0||0|
       |1|0||0|
       |0|1||0|
       |1|1||1|
       
      Parameters:
      other - The other Trigger.
      Returns:
      A Trigger representing logical AND.
    • nand

      public Trigger nand(Trigger other)
      Create a Trigger representing a logical NAND with another Trigger.
       NAND
       |A|B||C|
       |0|0||1|
       |1|0||1|
       |0|1||1|
       |1|1||0|
       
      Parameters:
      other - The other Trigger.
      Returns:
      A Trigger representing logical NAND.
    • or

      public Trigger or(Trigger other)
      Create a Trigger representing a logical OR with another Trigger.
       OR
       |A|B||C|
       |0|0||0|
       |1|0||1|
       |0|1||1|
       |1|1||1|
       
      Parameters:
      other - The other Trigger.
      Returns:
      A Trigger representing logical OR.
    • xor

      public Trigger xor(Trigger other)
      Create a Trigger representing a logical XOR with another Trigger.
       XOR
       |A|B||C|
       |0|0||0|
       |1|0||1|
       |0|1||1|
       |1|1||0|
       
      Parameters:
      other - The other Trigger.
      Returns:
      A Trigger representing logical XOR.
    • nor

      public Trigger nor(Trigger other)
      Create a Trigger representing a logical NOR with another Trigger.
       NOR
       |A|B||C|
       |0|0||1|
       |1|0||0|
       |0|1||0|
       |1|1||0|
       
      Parameters:
      other - The other Trigger.
      Returns:
      A Trigger representing logical NOR.
    • xnor

      public Trigger xnor(Trigger other)
      Create a Trigger representing a logical XNOR with another Trigger.
       XNOR
       |A|B||C|
       |0|0||1|
       |1|0||0|
       |0|1||0|
       |1|1||1|
       
      Parameters:
      other - The other Trigger.
      Returns:
      A Trigger representing logical XNOR.
    • not

      public Trigger not()
      Create a Trigger representing a logical NOT.
       NOT
       |A||B|
       |0||1|
       |1||0|
       
      Returns:
      A Trigger representing logical NOT.
    • initSendable

      public void initSendable(edu.wpi.first.util.sendable.SendableBuilder builder)
      Specified by:
      initSendable in interface edu.wpi.first.util.sendable.Sendable