Class AnalogTriggerSim

java.lang.Object
edu.wpi.first.wpilibj.simulation.AnalogTriggerSim

public class AnalogTriggerSim extends Object
Class to control a simulated analog trigger.
  • Constructor Details

    • AnalogTriggerSim

      public AnalogTriggerSim(AnalogTrigger analogTrigger)
      Constructs from an AnalogTrigger object.
      Parameters:
      analogTrigger - AnalogTrigger to simulate
  • Method Details

    • createForChannel

      public static AnalogTriggerSim createForChannel(int channel)
      Creates an AnalogTriggerSim for an analog input channel.
      Parameters:
      channel - analog input channel
      Returns:
      Simulated object
      Throws:
      NoSuchElementException - if no AnalogTrigger is configured for that channel
    • createForIndex

      public static AnalogTriggerSim createForIndex(int index)
      Creates an AnalogTriggerSim for a simulated index. The index is incremented for each simulated AnalogTrigger.
      Parameters:
      index - simulator index
      Returns:
      Simulated object
    • registerInitializedCallback

      public CallbackStore registerInitializedCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on whether the analog trigger is initialized.
      Parameters:
      callback - the callback that will be called whenever the analog trigger is initialized
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getInitialized

      public boolean getInitialized()
      Check if this analog trigger has been initialized.
      Returns:
      true if initialized
    • setInitialized

      public void setInitialized(boolean initialized)
      Change whether this analog trigger has been initialized.
      Parameters:
      initialized - the new value
    • registerTriggerLowerBoundCallback

      public CallbackStore registerTriggerLowerBoundCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on the lower bound.
      Parameters:
      callback - the callback that will be called whenever the lower bound is changed
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getTriggerLowerBound

      public double getTriggerLowerBound()
      Get the lower bound.
      Returns:
      the lower bound
    • setTriggerLowerBound

      public void setTriggerLowerBound(double triggerLowerBound)
      Change the lower bound.
      Parameters:
      triggerLowerBound - the new lower bound
    • registerTriggerUpperBoundCallback

      public CallbackStore registerTriggerUpperBoundCallback(NotifyCallback callback, boolean initialNotify)
      Register a callback on the upper bound.
      Parameters:
      callback - the callback that will be called whenever the upper bound is changed
      initialNotify - if true, the callback will be run on the initial value
      Returns:
      the CallbackStore object associated with this callback.
    • getTriggerUpperBound

      public double getTriggerUpperBound()
      Get the upper bound.
      Returns:
      the upper bound
    • setTriggerUpperBound

      public void setTriggerUpperBound(double triggerUpperBound)
      Change the upper bound.
      Parameters:
      triggerUpperBound - the new upper bound
    • resetData

      public void resetData()
      Reset all simulation data for this object.