Package edu.wpi.first.wpilibj.simulation
Class REVPHSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.PneumaticsBaseSim
edu.wpi.first.wpilibj.simulation.REVPHSim
public class REVPHSim extends PneumaticsBaseSim
Class to control a simulated PneumaticHub (PH).
-
Field Summary
-
Constructor Summary
Constructors Constructor Description REVPHSim()
Constructs for the default PH.REVPHSim(int module)
Constructs from a PH module number (CAN ID).REVPHSim(PneumaticHub module)
Constructs from a PneumaticHum object. -
Method Summary
Modifier and Type Method Description int
getCompressorConfigType()
Check whether the closed loop compressor control is active.double
getCompressorCurrent()
Read the compressor current.boolean
getCompressorOn()
Check if the compressor is on.boolean
getInitialized()
Check whether the PCM/PH has been initialized.boolean
getPressureSwitch()
Check the value of the pressure switch.boolean
getSolenoidOutput(int channel)
Check the solenoid output on a specific channel.CallbackStore
registerCompressorConfigTypeCallback(NotifyCallback callback, boolean initialNotify)
Register a callback to be run whenever the closed loop state changes.CallbackStore
registerCompressorCurrentCallback(NotifyCallback callback, boolean initialNotify)
Register a callback to be run whenever the compressor current changes.CallbackStore
registerCompressorOnCallback(NotifyCallback callback, boolean initialNotify)
Register a callback to be run when the compressor activates.CallbackStore
registerInitializedCallback(NotifyCallback callback, boolean initialNotify)
Register a callback to be run when the PCM/PH is initialized.CallbackStore
registerPressureSwitchCallback(NotifyCallback callback, boolean initialNotify)
Register a callback to be run whenever the pressure switch value changes.CallbackStore
registerSolenoidOutputCallback(int channel, NotifyCallback callback, boolean initialNotify)
Register a callback to be run when the solenoid output on a channel changes.void
resetData()
Reset all simulation data for this object.void
setCompressorConfigType(int compressorConfigType)
Turn on/off the closed loop control of the compressor.void
setCompressorCurrent(double compressorCurrent)
Set the compressor current.void
setCompressorOn(boolean compressorOn)
Set whether the compressor is active.void
setInitialized(boolean initialized)
Define whether the PCM/PH has been initialized.void
setPressureSwitch(boolean pressureSwitch)
Set the value of the pressure switch.void
setSolenoidOutput(int channel, boolean solenoidOutput)
Change the solenoid output on a specific channel.
-
Constructor Details
-
Method Details
-
getCompressorConfigType
Check whether the closed loop compressor control is active.- Returns:
- config type
-
setCompressorConfigType
Turn on/off the closed loop control of the compressor.- Parameters:
compressorConfigType
- compressor config type
-
registerCompressorConfigTypeCallback
public CallbackStore registerCompressorConfigTypeCallback(NotifyCallback callback, boolean initialNotify)Register a callback to be run whenever the closed loop state changes.- Parameters:
callback
- the callbackinitialNotify
- whether the callback should be called with the initial value- Returns:
- the
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
getInitialized
Description copied from class:PneumaticsBaseSim
Check whether the PCM/PH has been initialized.- Specified by:
getInitialized
in classPneumaticsBaseSim
- Returns:
- true if initialized
-
setInitialized
Description copied from class:PneumaticsBaseSim
Define whether the PCM/PH has been initialized.- Specified by:
setInitialized
in classPneumaticsBaseSim
- Parameters:
initialized
- true for initialized
-
registerInitializedCallback
Description copied from class:PneumaticsBaseSim
Register a callback to be run when the PCM/PH is initialized.- Specified by:
registerInitializedCallback
in classPneumaticsBaseSim
- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
getCompressorOn
Description copied from class:PneumaticsBaseSim
Check if the compressor is on.- Specified by:
getCompressorOn
in classPneumaticsBaseSim
- Returns:
- true if the compressor is active
-
setCompressorOn
Description copied from class:PneumaticsBaseSim
Set whether the compressor is active.- Specified by:
setCompressorOn
in classPneumaticsBaseSim
- Parameters:
compressorOn
- the new value
-
registerCompressorOnCallback
Description copied from class:PneumaticsBaseSim
Register a callback to be run when the compressor activates.- Specified by:
registerCompressorOnCallback
in classPneumaticsBaseSim
- Parameters:
callback
- the callbackinitialNotify
- whether to run the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
getSolenoidOutput
Description copied from class:PneumaticsBaseSim
Check the solenoid output on a specific channel.- Specified by:
getSolenoidOutput
in classPneumaticsBaseSim
- Parameters:
channel
- the channel to check- Returns:
- the solenoid output
-
setSolenoidOutput
Description copied from class:PneumaticsBaseSim
Change the solenoid output on a specific channel.- Specified by:
setSolenoidOutput
in classPneumaticsBaseSim
- Parameters:
channel
- the channel to checksolenoidOutput
- the new solenoid output
-
registerSolenoidOutputCallback
public CallbackStore registerSolenoidOutputCallback(int channel, NotifyCallback callback, boolean initialNotify)Description copied from class:PneumaticsBaseSim
Register a callback to be run when the solenoid output on a channel changes.- Specified by:
registerSolenoidOutputCallback
in classPneumaticsBaseSim
- Parameters:
channel
- the channel to monitorcallback
- the callbackinitialNotify
- should the callback be run with the initial value- Returns:
- the
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
getPressureSwitch
Description copied from class:PneumaticsBaseSim
Check the value of the pressure switch.- Specified by:
getPressureSwitch
in classPneumaticsBaseSim
- Returns:
- the pressure switch value
-
setPressureSwitch
Description copied from class:PneumaticsBaseSim
Set the value of the pressure switch.- Specified by:
setPressureSwitch
in classPneumaticsBaseSim
- Parameters:
pressureSwitch
- the new value
-
registerPressureSwitchCallback
public CallbackStore registerPressureSwitchCallback(NotifyCallback callback, boolean initialNotify)Description copied from class:PneumaticsBaseSim
Register a callback to be run whenever the pressure switch value changes.- Specified by:
registerPressureSwitchCallback
in classPneumaticsBaseSim
- Parameters:
callback
- the callbackinitialNotify
- whether the callback should be called with the initial value- Returns:
- the
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
getCompressorCurrent
Description copied from class:PneumaticsBaseSim
Read the compressor current.- Specified by:
getCompressorCurrent
in classPneumaticsBaseSim
- Returns:
- the current of the compressor connected to this module
-
setCompressorCurrent
Description copied from class:PneumaticsBaseSim
Set the compressor current.- Specified by:
setCompressorCurrent
in classPneumaticsBaseSim
- Parameters:
compressorCurrent
- the new compressor current
-
registerCompressorCurrentCallback
public CallbackStore registerCompressorCurrentCallback(NotifyCallback callback, boolean initialNotify)Description copied from class:PneumaticsBaseSim
Register a callback to be run whenever the compressor current changes.- Specified by:
registerCompressorCurrentCallback
in classPneumaticsBaseSim
- Parameters:
callback
- the callbackinitialNotify
- whether to call the callback with the initial state- Returns:
- the
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
resetData
Description copied from class:PneumaticsBaseSim
Reset all simulation data for this object.- Specified by:
resetData
in classPneumaticsBaseSim
-