Class REVPHJNI


public class REVPHJNI
extends JNIWrapper
REV Pneumatic Hub (PH) HAL JNI functions.
See Also:
"REVPH.h"
  • Field Details

  • Constructor Details

  • Method Details

    • initialize

      public static int initialize​(int module)
      Initializes a PH.
      Parameters:
      module - the CAN ID to initialize
      Returns:
      the created PH handle
      See Also:
      "HAL_InitializeREVP"
    • free

      public static void free​(int handle)
      Frees a PH handle.
      Parameters:
      handle - the PH handle
      See Also:
      "HAL_FreeREVPH"
    • checkSolenoidChannel

      public static boolean checkSolenoidChannel​(int channel)
      Checks if a solenoid channel number is valid.
      Parameters:
      channel - the channel to check
      Returns:
      true if the channel is valid, otherwise false
      See Also:
      "HAL_CheckREVPHSolenoidChannel"
    • getCompressor

      public static boolean getCompressor​(int handle)
      Get whether compressor is turned on.
      Parameters:
      handle - the PH handle
      Returns:
      true if the compressor is turned on
      See Also:
      "HAL_GetREVPHCompressor"
    • setCompressorConfig

      public static void setCompressorConfig​(int handle, double minAnalogVoltage, double maxAnalogVoltage, boolean forceDisable, boolean useDigital)
      Send compressor configuration to the PH.
      Parameters:
      handle - the PH handle
      minAnalogVoltage - The compressor will turn on when the analog pressure sensor voltage drops below this value
      maxAnalogVoltage - The compressor will turn off when the analog pressure sensor reaches this value.
      forceDisable - Disable Compressor
      useDigital - use the digital pressure switch
      See Also:
      "HAL_SetREVPHCompressorConfig"
    • setClosedLoopControlDisabled

      public static void setClosedLoopControlDisabled​(int handle)
      Disable Compressor.
      Parameters:
      handle - the PH handle
      See Also:
      "HAL_SetREVPHClosedLoopControlDisabled"
    • setClosedLoopControlDigital

      public static void setClosedLoopControlDigital​(int handle)
      Enables the compressor in digital mode using the digital pressure switch. The compressor will turn on when the pressure switch indicates that the system is not full, and will turn off when the pressure switch indicates that the system is full.
      Parameters:
      handle - the PH handle
      See Also:
      "HAL_SetREVPHClosedLoopControlDigital"
    • setClosedLoopControlAnalog

      public static void setClosedLoopControlAnalog​(int handle, double minAnalogVoltage, double maxAnalogVoltage)
      Enables the compressor in analog mode. This mode uses an analog pressure sensor connected to analog channel 0 to cycle the compressor. The compressor will turn on when the pressure drops below minAnalogVoltage and will turn off when the pressure reaches maxAnalogVoltage. This mode is only supported by the REV PH with the REV Analog Pressure Sensor connected to analog channel 0.
      Parameters:
      handle - the PH handle
      minAnalogVoltage - The compressor will turn on when the analog pressure sensor voltage drops below this value
      maxAnalogVoltage - The compressor will turn off when the analog pressure sensor reaches this value.
      See Also:
      "HAL_SetREVPHClosedLoopControlAnalog"
    • setClosedLoopControlHybrid

      public static void setClosedLoopControlHybrid​(int handle, double minAnalogVoltage, double maxAnalogVoltage)
      Enables the compressor in hybrid mode. This mode uses both a digital pressure switch and an analog pressure sensor connected to analog channel 0 to cycle the compressor.

      The compressor will turn on when \a both:

      - The digital pressure switch indicates the system is not full AND - The analog pressure sensor indicates that the pressure in the system is below the specified minimum pressure.

      The compressor will turn off when \a either:

      - The digital pressure switch is disconnected or indicates that the system is full OR - The pressure detected by the analog sensor is greater than the specified maximum pressure.

      Parameters:
      handle - the PH handle
      minAnalogVoltage - The compressor will turn on when the analog pressure sensor voltage drops below this value and the pressure switch indicates that the system is not full.
      maxAnalogVoltage - The compressor will turn off when the analog pressure sensor reaches this value or the pressure switch is disconnected or indicates that the system is full.
      See Also:
      "HAL_SetREVPHClosedLoopControlHybrid"
    • getCompressorConfig

      public static int getCompressorConfig​(int handle)
      Get compressor configuration from the PH.
      Parameters:
      handle - the PH handle
      Returns:
      compressor configuration
      See Also:
      "HAL_GetREVPHCompressorConfig"
    • getPressureSwitch

      public static boolean getPressureSwitch​(int handle)
      Returns the state of the digital pressure switch.
      Parameters:
      handle - the PH handle
      Returns:
      True if pressure switch indicates that the system is full, otherwise false.
      See Also:
      "HAL_GetREVPHPressureSwitch"
    • getAnalogVoltage

      public static double getAnalogVoltage​(int handle, int channel)
      Returns the raw voltage of the specified analog input channel.
      Parameters:
      handle - the PH handle
      channel - The analog input channel to read voltage from.
      Returns:
      The voltage of the specified analog input channel in volts.
      See Also:
      "HAL_GetREVPHAnalogVoltage"
    • getCompressorCurrent

      public static double getCompressorCurrent​(int handle)
      Returns the current drawn by the compressor.
      Parameters:
      handle - the PH handle
      Returns:
      The current drawn by the compressor in amps.
      See Also:
      "HAL_GetREVPHCompressorCurrent"
    • getSolenoids

      public static int getSolenoids​(int handle)
      Gets a bitmask of solenoid values.
      Parameters:
      handle - the PH handle
      Returns:
      solenoid values
      See Also:
      "HAL_GetREVPHSolenoids"
    • setSolenoids

      public static void setSolenoids​(int handle, int mask, int values)
      Sets solenoids on a PH.
      Parameters:
      handle - the PH handle
      mask - bitmask to set
      values - solenoid values
      See Also:
      "HAL_SetREVPHSolenoids"
    • fireOneShot

      public static void fireOneShot​(int handle, int index, int durMs)
      Fire a single solenoid shot for the specified duration.
      Parameters:
      handle - the PH handle
      index - solenoid index
      durMs - shot duration in ms
      See Also:
      "HAL_FireREVPHOneShot"
    • clearStickyFaults

      public static void clearStickyFaults​(int handle)
      Clears the sticky faults.
      Parameters:
      handle - the PH handle
      See Also:
      "HAL_ClearREVPHStickyFaults"
    • getInputVoltage

      public static double getInputVoltage​(int handle)
      Returns the current input voltage for the PH.
      Parameters:
      handle - the PH handle
      Returns:
      The input voltage in volts.
      See Also:
      "HAL_GetREVPHVoltage"
    • get5VVoltage

      public static double get5VVoltage​(int handle)
      Returns the current voltage of the regulated 5v supply.
      Parameters:
      handle - the PH handle
      Returns:
      The current voltage of the 5v supply in volts.
      See Also:
      "HAL_GetREVPH5VVoltage"
    • getSolenoidCurrent

      public static double getSolenoidCurrent​(int handle)
      Returns the total current drawn by all solenoids.
      Parameters:
      handle - the PH handle
      Returns:
      Total current drawn by all solenoids in amps.
      See Also:
      "HAL_GetREVPHSolenoidCurrent"
    • getSolenoidVoltage

      public static double getSolenoidVoltage​(int handle)
      Returns the current voltage of the solenoid power supply.
      Parameters:
      handle - the PH handle
      Returns:
      The current voltage of the solenoid power supply in volts.
      See Also:
      "HAL_GetREVPHSolenoidVoltage"
    • getStickyFaultsNative

      public static int getStickyFaultsNative​(int handle)
      Returns the sticky faults currently active on this device.
      Parameters:
      handle - the PH handle
      Returns:
      The sticky faults.
      See Also:
      "HAL_GetREVPHStickyFaults"
    • getStickyFaults

      public static REVPHStickyFaults getStickyFaults​(int handle)
      Returns the sticky faults currently active on this device.
      Parameters:
      handle - the PH handle
      Returns:
      The sticky faults.
      See Also:
      "HAL_GetREVPHStickyFaults"
    • getFaultsNative

      public static int getFaultsNative​(int handle)
      Returns the faults currently active on the PH.
      Parameters:
      handle - the PH handle
      Returns:
      The faults.
      See Also:
      "HAL_GetREVPHFaults"
    • getFaults

      public static REVPHFaults getFaults​(int handle)
      Returns the faults currently active on the PH.
      Parameters:
      handle - the PH handle
      Returns:
      The faults.
      See Also:
      "HAL_GetREVPHFaults"
    • getVersion

      public static REVPHVersion getVersion​(int handle)
      Returns the hardware and firmware versions of the PH.
      Parameters:
      handle - the PH handle
      Returns:
      The hardware and firmware versions.
      See Also:
      "HAL_GetREVPHVersion"