Package edu.wpi.first.wpilibj.simulation
Class CTREPCMSim
java.lang.Object
edu.wpi.first.wpilibj.simulation.PneumaticsBaseSim
edu.wpi.first.wpilibj.simulation.CTREPCMSim
Class to control a simulated Pneumatic Control Module (PCM).
-
Field Summary
Fields inherited from class edu.wpi.first.wpilibj.simulation.PneumaticsBaseSim
m_index -
Constructor Summary
ConstructorsConstructorDescriptionConstructs for the default PCM.CTREPCMSim(int module) Constructs from a PCM module number (CAN ID).CTREPCMSim(PneumaticsControlModule module) Constructs from a PneumaticsControlModule object. -
Method Summary
Modifier and TypeMethodDescriptionbooleanCheck whether the closed loop compressor control is active.doubleRead the compressor current.booleanCheck if the compressor is on.booleanCheck whether the PCM/PH has been initialized.booleanCheck the value of the pressure switch.booleangetSolenoidOutput(int channel) Check the solenoid output on a specific channel.registerClosedLoopEnabledCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the closed loop state changes.registerCompressorCurrentCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the compressor current changes.registerCompressorOnCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the compressor activates.registerInitializedCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run when the PCM/PH is initialized.registerPressureSwitchCallback(NotifyCallback callback, boolean initialNotify) Register a callback to be run whenever the pressure switch value changes.registerSolenoidOutputCallback(int channel, NotifyCallback callback, boolean initialNotify) Register a callback to be run when the solenoid output on a channel changes.voidReset all simulation data for this object.voidsetClosedLoopEnabled(boolean closedLoopEnabled) Turn on/off the closed loop control of the compressor.voidsetCompressorCurrent(double compressorCurrent) Set the compressor current.voidsetCompressorOn(boolean compressorOn) Set whether the compressor is active.voidsetInitialized(boolean initialized) Define whether the PCM/PH has been initialized.voidsetPressureSwitch(boolean pressureSwitch) Set the value of the pressure switch.voidsetSolenoidOutput(int channel, boolean solenoidOutput) Change the solenoid output on a specific channel.Methods inherited from class edu.wpi.first.wpilibj.simulation.PneumaticsBaseSim
getForType
-
Constructor Details
-
CTREPCMSim
public CTREPCMSim()Constructs for the default PCM. -
CTREPCMSim
Constructs from a PCM module number (CAN ID).- Parameters:
module- module number
-
CTREPCMSim
Constructs from a PneumaticsControlModule object.- Parameters:
module- PCM module to simulate
-
-
Method Details
-
getClosedLoopEnabled
Check whether the closed loop compressor control is active.- Returns:
- true if active
-
setClosedLoopEnabled
Turn on/off the closed loop control of the compressor.- Parameters:
closedLoopEnabled- whether the control loop is active
-
registerClosedLoopEnabledCallback
public CallbackStore registerClosedLoopEnabledCallback(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
CallbackStoreobject associated with this callback.
-
getInitialized
Description copied from class:PneumaticsBaseSimCheck whether the PCM/PH has been initialized.- Specified by:
getInitializedin classPneumaticsBaseSim- Returns:
- true if initialized
-
setInitialized
Description copied from class:PneumaticsBaseSimDefine whether the PCM/PH has been initialized.- Specified by:
setInitializedin classPneumaticsBaseSim- Parameters:
initialized- true for initialized
-
registerInitializedCallback
Description copied from class:PneumaticsBaseSimRegister a callback to be run when the PCM/PH is initialized.- Specified by:
registerInitializedCallbackin classPneumaticsBaseSim- Parameters:
callback- the callbackinitialNotify- whether to run the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
getCompressorOn
Description copied from class:PneumaticsBaseSimCheck if the compressor is on.- Specified by:
getCompressorOnin classPneumaticsBaseSim- Returns:
- true if the compressor is active
-
setCompressorOn
Description copied from class:PneumaticsBaseSimSet whether the compressor is active.- Specified by:
setCompressorOnin classPneumaticsBaseSim- Parameters:
compressorOn- the new value
-
registerCompressorOnCallback
Description copied from class:PneumaticsBaseSimRegister a callback to be run when the compressor activates.- Specified by:
registerCompressorOnCallbackin classPneumaticsBaseSim- Parameters:
callback- the callbackinitialNotify- whether to run the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
getSolenoidOutput
Description copied from class:PneumaticsBaseSimCheck the solenoid output on a specific channel.- Specified by:
getSolenoidOutputin classPneumaticsBaseSim- Parameters:
channel- the channel to check- Returns:
- the solenoid output
-
setSolenoidOutput
Description copied from class:PneumaticsBaseSimChange the solenoid output on a specific channel.- Specified by:
setSolenoidOutputin 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:PneumaticsBaseSimRegister a callback to be run when the solenoid output on a channel changes.- Specified by:
registerSolenoidOutputCallbackin classPneumaticsBaseSim- 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
Description copied from class:PneumaticsBaseSimCheck the value of the pressure switch.- Specified by:
getPressureSwitchin classPneumaticsBaseSim- Returns:
- the pressure switch value
-
setPressureSwitch
Description copied from class:PneumaticsBaseSimSet the value of the pressure switch.- Specified by:
setPressureSwitchin classPneumaticsBaseSim- Parameters:
pressureSwitch- the new value
-
registerPressureSwitchCallback
Description copied from class:PneumaticsBaseSimRegister a callback to be run whenever the pressure switch value changes.- Specified by:
registerPressureSwitchCallbackin classPneumaticsBaseSim- Parameters:
callback- the callbackinitialNotify- whether the callback should be called with the initial value- Returns:
- the
CallbackStoreobject associated with this callback.
-
getCompressorCurrent
Description copied from class:PneumaticsBaseSimRead the compressor current.- Specified by:
getCompressorCurrentin classPneumaticsBaseSim- Returns:
- the current of the compressor connected to this module
-
setCompressorCurrent
Description copied from class:PneumaticsBaseSimSet the compressor current.- Specified by:
setCompressorCurrentin classPneumaticsBaseSim- Parameters:
compressorCurrent- the new compressor current
-
registerCompressorCurrentCallback
public CallbackStore registerCompressorCurrentCallback(NotifyCallback callback, boolean initialNotify) Description copied from class:PneumaticsBaseSimRegister a callback to be run whenever the compressor current changes.- Specified by:
registerCompressorCurrentCallbackin classPneumaticsBaseSim- Parameters:
callback- the callbackinitialNotify- whether to call the callback with the initial state- Returns:
- the
CallbackStoreobject associated with this callback.
-
resetData
Description copied from class:PneumaticsBaseSimReset all simulation data for this object.- Specified by:
resetDatain classPneumaticsBaseSim
-