Class CTREPCMJNI
java.lang.Object
org.wpilib.hardware.hal.JNIWrapper
org.wpilib.hardware.hal.CTREPCMJNI
-
Nested Class Summary
Nested classes/interfaces inherited from class JNIWrapper
JNIWrapper.Helper -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckSolenoidChannel(int channel) Checks if a solenoid channel number is valid.static voidclearAllStickyFaults(int handle) Clears all sticky faults on this device.static voidfireOneShot(int handle, int index) Fire a single solenoid shot.static voidfree(int handle) Frees a PCM handle.static booleangetClosedLoopControl(int handle) Get whether the PCM closed loop control is enabled.static booleangetCompressor(int handle) Get whether compressor is turned on.static doublegetCompressorCurrent(int handle) Returns the current drawn by the compressor.static booleangetCompressorCurrentTooHighFault(int handle) Return whether the compressor current is currently too high.static booleangetCompressorCurrentTooHighStickyFault(int handle) Returns whether the compressor current has been too high since sticky faults were last cleared.static booleangetCompressorNotConnectedFault(int handle) Returns whether the compressor is currently disconnected.static booleangetCompressorNotConnectedStickyFault(int handle) Returns whether the compressor has been disconnected since sticky faults were last cleared.static booleangetCompressorShortedFault(int handle) Returns whether the compressor is currently shorted.static booleangetCompressorShortedStickyFault(int handle) Returns whether the compressor has been shorted since sticky faults were last cleared.static booleangetPressureSwitch(int handle) Returns the state of the pressure switch.static intgetSolenoidDisabledList(int handle) Get a bitmask of disabled solenoids.static intgetSolenoids(int handle) Gets a bitmask of solenoid values.static booleangetSolenoidVoltageFault(int handle) Returns whether the solenoid is currently reporting a voltage fault.static booleangetSolenoidVoltageStickyFault(int handle) Returns whether the solenoid has reported a voltage fault since sticky faults were last cleared.static intinitialize(int busId, int module) Initializes a PCM.static voidsetClosedLoopControl(int handle, boolean enabled) Enables the compressor closed loop control using the digital pressure switch.static voidsetOneShotDuration(int handle, int index, int durMs) Set the duration for a single solenoid shot.static voidsetSolenoids(int handle, int mask, int values) Sets solenoids on a pneumatics module.Methods inherited from class JNIWrapper
forceLoad, suppressUnused
-
Method Details
-
initialize
public static int initialize(int busId, int module) Initializes a PCM.- Parameters:
busId- the bus idmodule- the CAN ID to initialize- Returns:
- the created PH handle
- See Also:
-
free
public static void free(int handle) Frees a PCM handle.- Parameters:
handle- the PCMhandle- See Also:
-
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
-
getCompressor
public static boolean getCompressor(int handle) Get whether compressor is turned on.- Parameters:
handle- the PCM handle- Returns:
- true if the compressor is turned on
- See Also:
-
setClosedLoopControl
public static void setClosedLoopControl(int handle, boolean enabled) Enables the compressor closed loop control 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 PCM handleenabled- true to enable closed loop control- See Also:
-
getClosedLoopControl
public static boolean getClosedLoopControl(int handle) Get whether the PCM closed loop control is enabled.- Parameters:
handle- the PCM handle- Returns:
- True if closed loop control is enabled, otherwise false.
-
getPressureSwitch
public static boolean getPressureSwitch(int handle) Returns the state of the pressure switch.- Parameters:
handle- the PCM handle- Returns:
- True if pressure switch indicates that the system is full, otherwise false.
- See Also:
-
getCompressorCurrent
public static double getCompressorCurrent(int handle) Returns the current drawn by the compressor.- Parameters:
handle- the PCM handle- Returns:
- The current drawn by the compressor in amps.
- See Also:
-
getCompressorCurrentTooHighFault
public static boolean getCompressorCurrentTooHighFault(int handle) Return whether the compressor current is currently too high.- Parameters:
handle- the PCM handle- Returns:
- True if the compressor current is too high, otherwise false.
- See Also:
-
getCompressorCurrentTooHighStickyFault
public static boolean getCompressorCurrentTooHighStickyFault(int handle) Returns whether the compressor current has been too high since sticky faults were last cleared. This fault is persistent and can be cleared by clearAllStickyFaults()- Parameters:
handle- the PCM handle- Returns:
- True if the compressor current has been too high since sticky faults were last cleared.
- See Also:
-
getCompressorShortedFault
public static boolean getCompressorShortedFault(int handle) Returns whether the compressor is currently shorted.- Parameters:
handle- the PCM handle- Returns:
- True if the compressor is currently shorted, otherwise false.
- See Also:
-
getCompressorShortedStickyFault
public static boolean getCompressorShortedStickyFault(int handle) Returns whether the compressor has been shorted since sticky faults were last cleared. This fault is persistent and can be cleared by clearAllStickyFaults()- Parameters:
handle- the PCM handle- Returns:
- True if the compressor has been shorted since sticky faults were last cleared, otherwise false.
- See Also:
-
getCompressorNotConnectedFault
public static boolean getCompressorNotConnectedFault(int handle) Returns whether the compressor is currently disconnected.- Parameters:
handle- the PCM handle- Returns:
- True if compressor is currently disconnected, otherwise false.
- See Also:
-
getCompressorNotConnectedStickyFault
public static boolean getCompressorNotConnectedStickyFault(int handle) Returns whether the compressor has been disconnected since sticky faults were last cleared. This fault is persistent and can be cleared by clearAllStickyFaults()- Parameters:
handle- the PCM handle- Returns:
- True if the compressor has been disconnected since sticky faults were last cleared, otherwise false.
- See Also:
-
getSolenoids
public static int getSolenoids(int handle) Gets a bitmask of solenoid values.- Parameters:
handle- the PCM handle- Returns:
- Bitmask containing the state of the solenoids. The LSB represents solenoid 0.
- See Also:
-
setSolenoids
public static void setSolenoids(int handle, int mask, int values) Sets solenoids on a pneumatics module.- Parameters:
handle- the PCM handlemask- Bitmask indicating which solenoids to set. The LSB represents solenoid 0.values- Bitmask indicating the desired states of the solenoids. The LSB represents solenoid 0.- See Also:
-
getSolenoidDisabledList
public static int getSolenoidDisabledList(int handle) Get a bitmask of disabled solenoids.- Parameters:
handle- the PCM handle- Returns:
- Bitmask indicating disabled solenoids. The LSB represents solenoid 0.
- See Also:
-
getSolenoidVoltageFault
public static boolean getSolenoidVoltageFault(int handle) Returns whether the solenoid is currently reporting a voltage fault.- Parameters:
handle- the PCM handle- Returns:
- True if solenoid is reporting a fault, otherwise false.
- See Also:
-
getSolenoidVoltageStickyFault
public static boolean getSolenoidVoltageStickyFault(int handle) Returns whether the solenoid has reported a voltage fault since sticky faults were last cleared. This fault is persistent and can be cleared by clearAllStickyFaults()- Parameters:
handle- the PCM handle- Returns:
- True if solenoid is reporting a fault, otherwise false.
- See Also:
-
clearAllStickyFaults
public static void clearAllStickyFaults(int handle) Clears all sticky faults on this device.- Parameters:
handle- the PCM handle- See Also:
-
fireOneShot
public static void fireOneShot(int handle, int index) Fire a single solenoid shot.- Parameters:
handle- the PCM handleindex- solenoid index- See Also:
-
setOneShotDuration
public static void setOneShotDuration(int handle, int index, int durMs) Set the duration for a single solenoid shot.- Parameters:
handle- the PCM handleindex- solenoid indexdurMs- shot duration in ms- See Also:
-