Package edu.wpi.first.wpilibj.simulation
Class AnalogOutputSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.AnalogOutputSim
Class to control a simulated analog output.
-
Constructor Summary
ConstructorsConstructorDescriptionAnalogOutputSim(int channel) Constructs from an analog output channel number.AnalogOutputSim(AnalogOutput analogOutput) Constructs from an AnalogOutput object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck whether this analog output has been initialized.doubleRead the analog output voltage.registerInitializedCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when this analog output is initialized.registerVoltageCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the voltage changes.voidReset all simulation data on this object.voidsetInitialized(boolean initialized) Define whether this analog output has been initialized.voidsetVoltage(double voltage) Set the analog output voltage.
-
Constructor Details
-
AnalogOutputSim
Constructs from an AnalogOutput object.- Parameters:
analogOutput- AnalogOutput to simulate
-
AnalogOutputSim
Constructs from an analog output channel number.- Parameters:
channel- Channel number
-
-
Method Details
-
registerVoltageCallback
Register a callback to be run whenever the voltage changes.- Parameters:
callback- the callbackinitialNotify- whether to call the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
getVoltage
Read the analog output voltage.- Returns:
- the voltage on this analog output
-
setVoltage
Set the analog output voltage.- Parameters:
voltage- the new voltage on this analog output
-
registerInitializedCallback
Register a callback to be run when this analog output is initialized.- Parameters:
callback- the callbackinitialNotify- whether to run the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
getInitialized
Check whether this analog output has been initialized.- Returns:
- true if initialized
-
setInitialized
Define whether this analog output has been initialized.- Parameters:
initialized- whether this object is initialized
-
resetData
Reset all simulation data on this object.
-