Package edu.wpi.first.wpilibj.simulation
Class REVPHSim
- java.lang.Object
-
- edu.wpi.first.wpilibj.simulation.REVPHSim
-
-
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
All Methods Instance Methods Concrete Methods 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 Detail
-
REVPHSim
public REVPHSim()
Constructs for the default PH.
-
REVPHSim
public REVPHSim(int module)
Constructs from a PH module number (CAN ID).- Parameters:
module
- module number
-
REVPHSim
public REVPHSim(PneumaticsBase module)
Constructs from a Compressor object.- Parameters:
module
- PCM module to simulate
-
-
Method Detail
-
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
public boolean getSolenoidOutput(int channel)
Check the solenoid output on a specific channel.- Parameters:
channel
- the channel to check- Returns:
- the solenoid output
-
setSolenoidOutput
public void setSolenoidOutput(int channel, boolean solenoidOutput)
Change the solenoid output on a specific channel.- Parameters:
channel
- the channel to checksolenoidOutput
- the new solenoid output
-
registerInitializedCallback
public CallbackStore registerInitializedCallback(NotifyCallback callback, boolean initialNotify)
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
public boolean getInitialized()
Check whether the compressor has been initialized.- Returns:
- true if initialized
-
setInitialized
public void setInitialized(boolean initialized)
Define whether the compressor has been initialized.- Parameters:
initialized
- whether the compressor is initialized
-
registerCompressorOnCallback
public 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
CallbackStore
object associated with this callback. Save a reference to this object so GC doesn't cancel the callback.
-
getCompressorOn
public boolean getCompressorOn()
Check if the compressor is on.- Returns:
- true if the compressor is active
-
setCompressorOn
public void setCompressorOn(boolean compressorOn)
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
public int getCompressorConfigType()
Check whether the closed loop compressor control is active.- Returns:
- config type
-
setCompressorConfigType
public void setCompressorConfigType(int compressorConfigType)
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
public boolean getPressureSwitch()
Check the value of the pressure switch.- Returns:
- the pressure switch value
-
setPressureSwitch
public void setPressureSwitch(boolean pressureSwitch)
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
public double getCompressorCurrent()
Read the compressor current.- Returns:
- the current of the compressor connected to this module
-
setCompressorCurrent
public void setCompressorCurrent(double compressorCurrent)
Set the compressor current.- Parameters:
compressorCurrent
- the new compressor current
-
resetData
public void resetData()
Reset all simulation data for this object.
-
-