Package edu.wpi.first.wpilibj.simulation
Class REVPHSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.REVPHSim
public class REVPHSim extends Object
Class to control a simulated PneumaticHub (PH).
-
Constructor Summary
Constructors Constructor Description REVPHSim()
Constructs for the default PH.REVPHSim(int module)
Constructs from a PH module number (CAN ID).REVPHSim(PneumaticsBase module)
Constructs from a Compressor 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 compressor 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 compressor 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 compressor 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
-
registerSolenoidOutputCallback
public 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
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the 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
-
registerInitializedCallback
Register a callback to be run when the compressor is initialized.- 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.
-
getInitialized
Check whether the compressor has been initialized.- Returns:
- true if initialized
-
setInitialized
Define whether the compressor has been initialized.- Parameters:
initialized
- whether the compressor is initialized
-
registerCompressorOnCallback
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
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the 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
-
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.
-
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
-
registerPressureSwitchCallback
public 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
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the 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
-
registerCompressorCurrentCallback
public 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
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the 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
-
resetData
Reset all simulation data for this object.
-