Package edu.wpi.first.wpilibj.simulation
Class AnalogInputSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.AnalogInputSim
Class to control a simulated analog input.
-
Constructor Summary
ConstructorsConstructorDescriptionAnalogInputSim
(int channel) Constructs from an analog input channel number.AnalogInputSim
(AnalogInput analogInput) Constructs from an AnalogInput object. -
Method Summary
Modifier and TypeMethodDescriptionint
Get the accumulator center.long
Get the accumulator count.int
Get the accumulator deadband.boolean
Check if the accumulator has been initialized.long
Get the accumulator value.int
Get the number of average bits.boolean
Check if this analog input has been initialized.int
Get the amount of oversampling bits.double
Get the voltage.registerAccumulatorCenterCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator center.registerAccumulatorCountCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator count.registerAccumulatorDeadbandCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator deadband.registerAccumulatorInitializedCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on whether the accumulator is initialized.registerAccumulatorValueCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator value.registerAverageBitsCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the number of average bits.registerInitializedCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on whether the analog input is initialized.registerOversampleBitsCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the amount of oversampling bits.registerVoltageCallback
(NotifyCallback callback, boolean initialNotify) Register a callback on the voltage.void
Reset all simulation data for this object.void
setAccumulatorCenter
(int accumulatorCenter) Change the accumulator center.void
setAccumulatorCount
(long accumulatorCount) Change the accumulator count.void
setAccumulatorDeadband
(int accumulatorDeadband) Change the accumulator deadband.void
setAccumulatorInitialized
(boolean accumulatorInitialized) Change whether the accumulator has been initialized.void
setAccumulatorValue
(long accumulatorValue) Change the accumulator value.void
setAverageBits
(int averageBits) Change the number of average bits.void
setInitialized
(boolean initialized) Change whether this analog input has been initialized.void
setOversampleBits
(int oversampleBits) Change the amount of oversampling bits.void
setVoltage
(double voltage) Change the voltage.
-
Constructor Details
-
AnalogInputSim
Constructs from an AnalogInput object.- Parameters:
analogInput
- AnalogInput to simulate
-
AnalogInputSim
Constructs from an analog input channel number.- Parameters:
channel
- Channel number
-
-
Method Details
-
registerInitializedCallback
Register a callback on whether the analog input is initialized.- Parameters:
callback
- the callback that will be called whenever the analog input is initializedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getInitialized
Check if this analog input has been initialized.- Returns:
- true if initialized
-
setInitialized
Change whether this analog input has been initialized.- Parameters:
initialized
- the new value
-
registerAverageBitsCallback
Register a callback on the number of average bits.- Parameters:
callback
- the callback that will be called whenever the number of average bits is changedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getAverageBits
Get the number of average bits.- Returns:
- the number of average bits
-
setAverageBits
Change the number of average bits.- Parameters:
averageBits
- the new value
-
registerOversampleBitsCallback
Register a callback on the amount of oversampling bits.- Parameters:
callback
- the callback that will be called whenever the oversampling bits are changed.initialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getOversampleBits
Get the amount of oversampling bits.- Returns:
- the amount of oversampling bits
-
setOversampleBits
Change the amount of oversampling bits.- Parameters:
oversampleBits
- the new value
-
registerVoltageCallback
Register a callback on the voltage.- Parameters:
callback
- the callback that will be called whenever the voltage is changed.initialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getVoltage
Get the voltage.- Returns:
- the voltage
-
setVoltage
Change the voltage.- Parameters:
voltage
- the new value
-
registerAccumulatorInitializedCallback
public CallbackStore registerAccumulatorInitializedCallback(NotifyCallback callback, boolean initialNotify) Register a callback on whether the accumulator is initialized.- Parameters:
callback
- the callback that will be called whenever the accumulator is initializedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getAccumulatorInitialized
Check if the accumulator has been initialized.- Returns:
- true if initialized
-
setAccumulatorInitialized
Change whether the accumulator has been initialized.- Parameters:
accumulatorInitialized
- the new value
-
registerAccumulatorValueCallback
public CallbackStore registerAccumulatorValueCallback(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator value.- Parameters:
callback
- the callback that will be called whenever the accumulator value is changed.initialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getAccumulatorValue
Get the accumulator value.- Returns:
- the accumulator value
-
setAccumulatorValue
Change the accumulator value.- Parameters:
accumulatorValue
- the new value
-
registerAccumulatorCountCallback
public CallbackStore registerAccumulatorCountCallback(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator count.- Parameters:
callback
- the callback that will be called whenever the accumulator count is changed.initialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getAccumulatorCount
Get the accumulator count.- Returns:
- the accumulator count.
-
setAccumulatorCount
Change the accumulator count.- Parameters:
accumulatorCount
- the new count.
-
registerAccumulatorCenterCallback
public CallbackStore registerAccumulatorCenterCallback(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator center.- Parameters:
callback
- the callback that will be called whenever the accumulator center is changedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getAccumulatorCenter
Get the accumulator center.- Returns:
- the accumulator center
-
setAccumulatorCenter
Change the accumulator center.- Parameters:
accumulatorCenter
- the new center
-
registerAccumulatorDeadbandCallback
public CallbackStore registerAccumulatorDeadbandCallback(NotifyCallback callback, boolean initialNotify) Register a callback on the accumulator deadband.- Parameters:
callback
- the callback that will be called whenever the accumulator deadband is changedinitialNotify
- if true, the callback will be run on the initial value- Returns:
- the
CallbackStore
object associated with this callback.
-
getAccumulatorDeadband
Get the accumulator deadband.- Returns:
- the accumulator deadband
-
setAccumulatorDeadband
Change the accumulator deadband.- Parameters:
accumulatorDeadband
- the new deadband
-
resetData
Reset all simulation data for this object.
-