Class REVPHSim


  • public class REVPHSim
    extends Object
    Class to control a simulated PneumaticHub (PH).
    • 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 monitor
        callback - the callback
        initialNotify - 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 check
        solenoidOutput - 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 callback
        initialNotify - 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 callback
        initialNotify - 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 callback
        initialNotify - 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 callback
        initialNotify - 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 callback
        initialNotify - 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.