Package edu.wpi.first.wpilibj.simulation
Class PneumaticsBaseSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.PneumaticsBaseSim
- Direct Known Subclasses:
CTREPCMSim,REVPHSim
Common base class for pneumatics module simulation classes.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPneumaticsBaseSim(int index) Constructs a PneumaticsBaseSim with the given index.protectedPneumaticsBaseSim(PneumaticsBase module) Constructs a PneumaticsBaseSim for the given module. -
Method Summary
Modifier and TypeMethodDescriptionabstract doubleRead the compressor current.abstract booleanCheck if the compressor is on.static PneumaticsBaseSimgetForType(int module, PneumaticsModuleType type) Get a module sim for a specific type.abstract booleanCheck whether the PCM/PH has been initialized.abstract booleanCheck the value of the pressure switch.abstract booleangetSolenoidOutput(int channel) Check the solenoid output on a specific channel.abstract CallbackStoreregisterCompressorCurrentCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the compressor current changes.abstract CallbackStoreregisterCompressorOnCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the compressor activates.abstract CallbackStoreregisterInitializedCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the PCM/PH is initialized.abstract CallbackStoreregisterPressureSwitchCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the pressure switch value changes.abstract CallbackStoreregisterSolenoidOutputCallback(int channel, NotifyCallback callback, boolean initialNotify) Register a callback to be run when the solenoid output on a channel changes.abstract voidReset all simulation data for this object.abstract voidsetCompressorCurrent(double compressorCurrent) Set the compressor current.abstract voidsetCompressorOn(boolean compressorOn) Set whether the compressor is active.abstract voidsetInitialized(boolean initialized) Define whether the PCM/PH has been initialized.abstract voidsetPressureSwitch(boolean pressureSwitch) Set the value of the pressure switch.abstract voidsetSolenoidOutput(int channel, boolean solenoidOutput) Change the solenoid output on a specific channel.
-
Field Details
-
m_index
PneumaticsBase index.
-
-
Constructor Details
-
PneumaticsBaseSim
Constructs a PneumaticsBaseSim with the given index.- Parameters:
index- The index.
-
PneumaticsBaseSim
Constructs a PneumaticsBaseSim for the given module.- Parameters:
module- The module.
-
-
Method Details
-
getForType
Get a module sim for a specific type.- Parameters:
module- the module number / CAN ID.type- the module type.- Returns:
- the module object.
-
getInitialized
Check whether the PCM/PH has been initialized.- Returns:
- true if initialized
-
setInitialized
Define whether the PCM/PH has been initialized.- Parameters:
initialized- true for initialized
-
registerInitializedCallback
public abstract CallbackStore registerInitializedCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the PCM/PH is initialized.- Parameters:
callback- the callbackinitialNotify- whether to run the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
getCompressorOn
Check if the compressor is on.- Returns:
- true if the compressor is active
-
setCompressorOn
Set whether the compressor is active.- Parameters:
compressorOn- the new value
-
registerCompressorOnCallback
public abstract CallbackStore registerCompressorOnCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the compressor activates.- Parameters:
callback- the callbackinitialNotify- whether to run the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
getSolenoidOutput
Check the solenoid output on a specific channel.- Parameters:
channel- the channel to check- Returns:
- the solenoid output
-
setSolenoidOutput
Change the solenoid output on a specific channel.- Parameters:
channel- the channel to checksolenoidOutput- the new solenoid output
-
registerSolenoidOutputCallback
public abstract CallbackStore registerSolenoidOutputCallback(int channel, NotifyCallback callback, boolean initialNotify) Register a callback to be run when the solenoid output on a channel changes.- Parameters:
channel- the channel to monitorcallback- the callbackinitialNotify- should the callback be run with the initial value- Returns:
- the
CallbackStoreobject associated with this callback.
-
getPressureSwitch
Check the value of the pressure switch.- Returns:
- the pressure switch value
-
setPressureSwitch
Set the value of the pressure switch.- Parameters:
pressureSwitch- the new value
-
registerPressureSwitchCallback
public abstract CallbackStore registerPressureSwitchCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the pressure switch value changes.- Parameters:
callback- the callbackinitialNotify- whether the callback should be called with the initial value- Returns:
- the
CallbackStoreobject associated with this callback.
-
getCompressorCurrent
Read the compressor current.- Returns:
- the current of the compressor connected to this module
-
setCompressorCurrent
Set the compressor current.- Parameters:
compressorCurrent- the new compressor current
-
registerCompressorCurrentCallback
public abstract CallbackStore registerCompressorCurrentCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the compressor current changes.- Parameters:
callback- the callbackinitialNotify- whether to call the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
resetData
Reset all simulation data for this object.
-