Class XAnalogInput

java.lang.Object
xbot.common.controls.sensors.XAnalogInput
All Implemented Interfaces:
DataFrameRefreshable, XBaseIO
Direct Known Subclasses:
AnalogInputWPIAdapater, MockAnalogInput

public abstract class XAnalogInput extends Object implements XBaseIO, DataFrameRefreshable
  • Field Details

    • channel

      protected int channel
  • Constructor Details

  • Method Details

    • getVoltage

      public abstract double getVoltage()
      Returns the current unfiltered voltage directly from the device.
    • getAverageVoltage

      public final double getAverageVoltage()
      Returns the software-window average captured by refreshDataFrame(). Reading this value never adds a sample, so multiple consumers see the same value during a robot loop. Before the first data-frame refresh, this falls back to the current raw voltage.
    • setAverageSampleWindow

      public final void setAverageSampleWindow(int samples)
      Configures the number of robot-loop samples in the software averaging window.
      Parameters:
      samples - number of samples, from 1 through 128
    • setAverageBits

      @Deprecated public final void setAverageBits(int bits)
      Deprecated.
      WPILib 2027 removed FPGA averaging. Prefer setAverageSampleWindow(int) to state the software filter size directly.
      Configures a software averaging window of 2^bits robot-loop samples.
    • refreshDataFrame

      public final void refreshDataFrame()
      Captures exactly one raw-voltage sample for the software averaging window.
      Specified by:
      refreshDataFrame in interface DataFrameRefreshable
    • getAsDigital

      public abstract boolean getAsDigital(double threshold)