Package edu.wpi.first.hal
Class REVPHJNI
java.lang.Object
edu.wpi.first.hal.JNIWrapper
edu.wpi.first.hal.REVPHJNI
public class REVPHJNI extends JNIWrapper
REV Pneumatic Hub (PH) HAL JNI functions.
- See Also:
- "REVPH.h"
-
Nested Class Summary
-
Field Summary
Fields Modifier and Type Field Description static int
COMPRESSOR_CONFIG_TYPE_ANALOG
static int
COMPRESSOR_CONFIG_TYPE_DIGITAL
static int
COMPRESSOR_CONFIG_TYPE_DISABLED
static int
COMPRESSOR_CONFIG_TYPE_HYBRID
-
Constructor Summary
Constructors Constructor Description REVPHJNI()
-
Method Summary
Modifier and Type Method Description static boolean
checkSolenoidChannel(int channel)
Checks if a solenoid channel number is valid.static void
clearStickyFaults(int handle)
Clears the sticky faults.static void
fireOneShot(int handle, int index, int durMs)
Fire a single solenoid shot for the specified duration.static void
free(int handle)
Frees a PH handle.static double
get5VVoltage(int handle)
Returns the current voltage of the regulated 5v supply.static double
getAnalogVoltage(int handle, int channel)
Returns the raw voltage of the specified analog input channel.static boolean
getCompressor(int handle)
Get whether compressor is turned on.static int
getCompressorConfig(int handle)
Get compressor configuration from the PH.static double
getCompressorCurrent(int handle)
Returns the current drawn by the compressor.static REVPHFaults
getFaults(int handle)
Returns the faults currently active on the PH.static int
getFaultsNative(int handle)
Returns the faults currently active on the PH.static double
getInputVoltage(int handle)
Returns the current input voltage for the PH.static boolean
getPressureSwitch(int handle)
Returns the state of the digital pressure switch.static double
getSolenoidCurrent(int handle)
Returns the total current drawn by all solenoids.static int
getSolenoids(int handle)
Gets a bitmask of solenoid values.static double
getSolenoidVoltage(int handle)
Returns the current voltage of the solenoid power supply.static REVPHStickyFaults
getStickyFaults(int handle)
Returns the sticky faults currently active on this device.static int
getStickyFaultsNative(int handle)
Returns the sticky faults currently active on this device.static REVPHVersion
getVersion(int handle)
Returns the hardware and firmware versions of the PH.static int
initialize(int module)
Initializes a PH.static void
setClosedLoopControlAnalog(int handle, double minAnalogVoltage, double maxAnalogVoltage)
Enables the compressor in analog mode.static void
setClosedLoopControlDigital(int handle)
Enables the compressor in digital mode using the digital pressure switch.static void
setClosedLoopControlDisabled(int handle)
Disable Compressor.static void
setClosedLoopControlHybrid(int handle, double minAnalogVoltage, double maxAnalogVoltage)
Enables the compressor in hybrid mode.static void
setCompressorConfig(int handle, double minAnalogVoltage, double maxAnalogVoltage, boolean forceDisable, boolean useDigital)
Send compressor configuration to the PH.static void
setSolenoids(int handle, int mask, int values)
Sets solenoids on a PH.
-
Field Details
-
Constructor Details
-
Method Details
-
initialize
Initializes a PH.- Parameters:
module
- the CAN ID to initialize- Returns:
- the created PH handle
- See Also:
- "HAL_InitializeREVP"
-
free
Frees a PH handle.- Parameters:
handle
- the PH handle- See Also:
- "HAL_FreeREVPH"
-
checkSolenoidChannel
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
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 handleminAnalogVoltage
- The compressor will turn on when the analog pressure sensor voltage drops below this valuemaxAnalogVoltage
- The compressor will turn off when the analog pressure sensor reaches this value.forceDisable
- Disable CompressoruseDigital
- use the digital pressure switch- See Also:
- "HAL_SetREVPHCompressorConfig"
-
setClosedLoopControlDisabled
Disable Compressor.- Parameters:
handle
- the PH handle- See Also:
- "HAL_SetREVPHClosedLoopControlDisabled"
-
setClosedLoopControlDigital
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 handleminAnalogVoltage
- The compressor will turn on when the analog pressure sensor voltage drops below this valuemaxAnalogVoltage
- 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 handleminAnalogVoltage
- 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
Get compressor configuration from the PH.- Parameters:
handle
- the PH handle- Returns:
- compressor configuration
- See Also:
- "HAL_GetREVPHCompressorConfig"
-
getPressureSwitch
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
Returns the raw voltage of the specified analog input channel.- Parameters:
handle
- the PH handlechannel
- The analog input channel to read voltage from.- Returns:
- The voltage of the specified analog input channel in volts.
- See Also:
- "HAL_GetREVPHAnalogVoltage"
-
getCompressorCurrent
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
Gets a bitmask of solenoid values.- Parameters:
handle
- the PH handle- Returns:
- solenoid values
- See Also:
- "HAL_GetREVPHSolenoids"
-
setSolenoids
Sets solenoids on a PH.- Parameters:
handle
- the PH handlemask
- bitmask to setvalues
- solenoid values- See Also:
- "HAL_SetREVPHSolenoids"
-
fireOneShot
Fire a single solenoid shot for the specified duration.- Parameters:
handle
- the PH handleindex
- solenoid indexdurMs
- shot duration in ms- See Also:
- "HAL_FireREVPHOneShot"
-
clearStickyFaults
Clears the sticky faults.- Parameters:
handle
- the PH handle- See Also:
- "HAL_ClearREVPHStickyFaults"
-
getInputVoltage
Returns the current input voltage for the PH.- Parameters:
handle
- the PH handle- Returns:
- The input voltage in volts.
- See Also:
- "HAL_GetREVPHVoltage"
-
get5VVoltage
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
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
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
Returns the sticky faults currently active on this device.- Parameters:
handle
- the PH handle- Returns:
- The sticky faults.
- See Also:
- "HAL_GetREVPHStickyFaults"
-
getStickyFaults
Returns the sticky faults currently active on this device.- Parameters:
handle
- the PH handle- Returns:
- The sticky faults.
- See Also:
- "HAL_GetREVPHStickyFaults"
-
getFaultsNative
Returns the faults currently active on the PH.- Parameters:
handle
- the PH handle- Returns:
- The faults.
- See Also:
- "HAL_GetREVPHFaults"
-
getFaults
Returns the faults currently active on the PH.- Parameters:
handle
- the PH handle- Returns:
- The faults.
- See Also:
- "HAL_GetREVPHFaults"
-
getVersion
Returns the hardware and firmware versions of the PH.- Parameters:
handle
- the PH handle- Returns:
- The hardware and firmware versions.
- See Also:
- "HAL_GetREVPHVersion"
-