Class XEncoder
java.lang.Object
xbot.common.controls.sensors.XEncoder
- All Implemented Interfaces:
DataFrameRefreshable
- Direct Known Subclasses:
EncoderWPIAdapter, MockEncoder
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.wpilib.tunable.TunableDoubleprotected DoubleSupplierprotected boolean -
Constructor Summary
ConstructorsConstructorDescriptionXEncoder(String name, int aChannel, int bChannel, double defaultDistancePerPulse, String owningSystemPrefix, TunableFactory tunableFactory, DevicePolice police, DataFrameRegistry dataFrameRegistry) -
Method Summary
Modifier and TypeMethodDescriptiondoubledoubleprotected abstract doubleprotected abstract doublegetRate()voidConsumes and processes inputs from the device or subsystem.voidsetDistancePerPulseSupplier(DoubleSupplier supplier) voidsetInverted(boolean inverted) final voidsetRateWindow(org.wpilib.units.measure.Time rateWindow) Sets the duration used to calculate the encoder rate.protected abstract voidsetRateWindowMilliseconds(int rateWindowMilliseconds) abstract voidupdateInputs(XEncoderInputs inputs)
-
Field Details
-
isInverted
protected boolean isInverted -
distancePerPulse
protected org.wpilib.tunable.TunableDouble distancePerPulse -
distancePerPulseSupplier
-
-
Constructor Details
-
XEncoder
public XEncoder(String name, int aChannel, int bChannel, double defaultDistancePerPulse, String owningSystemPrefix, TunableFactory tunableFactory, DevicePolice police, DataFrameRegistry dataFrameRegistry)
-
-
Method Details
-
setDistancePerPulseSupplier
-
getAdjustedDistance
public double getAdjustedDistance() -
getAdjustedRate
public double getAdjustedRate() -
setInverted
public void setInverted(boolean inverted) -
getRate
protected abstract double getRate() -
getDistance
protected abstract double getDistance() -
setRateWindow
public final void setRateWindow(org.wpilib.units.measure.Time rateWindow) Sets the duration used to calculate the encoder rate.The duration must be between 5 and 255 milliseconds, inclusive. It is rounded to the nearest millisecond to match the resolution supported by WPILib.
- Parameters:
rateWindow- rate calculation window
-
setRateWindowMilliseconds
protected abstract void setRateWindowMilliseconds(int rateWindowMilliseconds) -
updateInputs
-
refreshDataFrame
public void refreshDataFrame()Description copied from interface:DataFrameRefreshableConsumes and processes inputs from the device or subsystem.- Specified by:
refreshDataFramein interfaceDataFrameRefreshable
-