Class XAnalogInput
java.lang.Object
xbot.common.controls.sensors.XAnalogInput
- All Implemented Interfaces:
DataFrameRefreshable, XBaseIO
- Direct Known Subclasses:
AnalogInputWPIAdapater, MockAnalogInput
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionXAnalogInput(int channel, DevicePolice police, DataFrameRegistry dataFrameRegistry) -
Method Summary
Modifier and TypeMethodDescriptionabstract booleangetAsDigital(double threshold) final doubleReturns the software-window average captured byrefreshDataFrame().abstract doubleReturns the current unfiltered voltage directly from the device.final voidCaptures exactly one raw-voltage sample for the software averaging window.final voidsetAverageBits(int bits) Deprecated.WPILib 2027 removed FPGA averaging.final voidsetAverageSampleWindow(int samples) Configures the number of robot-loop samples in the software averaging window.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface XBaseIO
getChannel
-
Field Details
-
channel
protected int channel
-
-
Constructor Details
-
XAnalogInput
-
-
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 byrefreshDataFrame(). 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.WPILib 2027 removed FPGA averaging. PrefersetAverageSampleWindow(int)to state the software filter size directly.Configures a software averaging window of2^bitsrobot-loop samples. -
refreshDataFrame
public final void refreshDataFrame()Captures exactly one raw-voltage sample for the software averaging window.- Specified by:
refreshDataFramein interfaceDataFrameRefreshable
-
getAsDigital
public abstract boolean getAsDigital(double threshold)
-