Package edu.wpi.first.wpilibj
Class PneumaticsControlModule
java.lang.Object
edu.wpi.first.wpilibj.PneumaticsControlModule
- All Implemented Interfaces:
PneumaticsBase,AutoCloseable
Module class for controlling a Cross The Road Electronics Pneumatics Control Module.
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a PneumaticsControlModule with the default ID (0).PneumaticsControlModule(int module) Constructs a PneumaticsControlModule. -
Method Summary
Modifier and TypeMethodDescriptionintcheckAndReserveSolenoids(int mask) Check to see if the solenoids marked in the bitmask can be reserved, and if so, reserve them.booleancheckSolenoidChannel(int channel) Check if a solenoid channel is valid.voidClears all sticky faults on this device.voidclose()voidDisables the compressor.voidenableCompressorAnalog(double minPressure, double maxPressure) Enables the compressor in digital mode.voidEnables the compressor in digital mode using the digital pressure switch.voidenableCompressorHybrid(double minPressure, double maxPressure) Enables the compressor in digital mode.voidfireOneShot(int index) Fire a single solenoid shot.doublegetAnalogVoltage(int channel) Unsupported by the CTRE PCM.booleanReturns whether the compressor is active or not.Returns the active compressor configuration.doubleReturns the current drawn by the compressor in amps.booleanReturn whether the compressor current is currently too high.booleanReturns whether the compressor current has been too high since sticky faults were last cleared.booleanReturns whether the compressor is currently disconnected.booleanReturns whether the compressor has been disconnected since sticky faults were last cleared.booleanReturns whether the compressor is currently shorted.booleanReturns whether the compressor has been shorted since sticky faults were last cleared.intGet module number for this module.doublegetPressure(int channel) Unsupported by the CTRE PCM.booleanReturns the state of the pressure switch.intGet a bitmask of disabled solenoids.intGets a bitmask of solenoid values.booleanReturns whether the solenoid is currently reporting a voltage fault.booleanReturns whether the solenoid has reported a voltage fault since sticky faults were last cleared.Create a compressor object.makeDoubleSolenoid(int forwardChannel, int reverseChannel) Create a double solenoid object for the specified channels.makeSolenoid(int channel) Create a solenoid object for the specified channel.booleanReserve the compressor.voidsetOneShotDuration(int index, int durMs) Set the duration for a single solenoid shot.voidsetSolenoids(int mask, int values) Sets solenoids on a pneumatics module.voidUnreserve the compressor.voidunreserveSolenoids(int mask) Unreserve the solenoids marked in the bitmask.
-
Constructor Details
-
PneumaticsControlModule
public PneumaticsControlModule()Constructs a PneumaticsControlModule with the default ID (0). -
PneumaticsControlModule
Constructs a PneumaticsControlModule.- Parameters:
module- module number to construct
-
-
Method Details
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfacePneumaticsBase
-
getCompressor
Description copied from interface:PneumaticsBaseReturns whether the compressor is active or not.- Specified by:
getCompressorin interfacePneumaticsBase- Returns:
- True if the compressor is on - otherwise false.
-
getPressureSwitch
Description copied from interface:PneumaticsBaseReturns the state of the pressure switch.- Specified by:
getPressureSwitchin interfacePneumaticsBase- Returns:
- True if pressure switch indicates that the system is not full, otherwise false.
-
getCompressorCurrent
Description copied from interface:PneumaticsBaseReturns the current drawn by the compressor in amps.- Specified by:
getCompressorCurrentin interfacePneumaticsBase- Returns:
- The current drawn by the compressor.
-
getCompressorCurrentTooHighFault
Return whether the compressor current is currently too high.- Returns:
- True if the compressor current is too high, otherwise false.
- See Also:
-
getCompressorCurrentTooHighStickyFault
Returns whether the compressor current has been too high since sticky faults were last cleared. This fault is persistent and can be cleared byclearAllStickyFaults()- Returns:
- True if the compressor current has been too high since sticky faults were last cleared.
- See Also:
-
getCompressorShortedFault
Returns whether the compressor is currently shorted.- Returns:
- True if the compressor is currently shorted, otherwise false.
- See Also:
-
getCompressorShortedStickyFault
Returns whether the compressor has been shorted since sticky faults were last cleared. This fault is persistent and can be cleared byclearAllStickyFaults()- Returns:
- True if the compressor has been shorted since sticky faults were last cleared, otherwise false.
- See Also:
-
getCompressorNotConnectedFault
Returns whether the compressor is currently disconnected.- Returns:
- True if compressor is currently disconnected, otherwise false.
- See Also:
-
getCompressorNotConnectedStickyFault
Returns whether the compressor has been disconnected since sticky faults were last cleared. This fault is persistent and can be cleared byclearAllStickyFaults()- Returns:
- True if the compressor has been disconnected since sticky faults were last cleared, otherwise false.
- See Also:
-
setSolenoids
Description copied from interface:PneumaticsBaseSets solenoids on a pneumatics module.- Specified by:
setSolenoidsin interfacePneumaticsBase- Parameters:
mask- 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.
-
getSolenoids
Description copied from interface:PneumaticsBaseGets a bitmask of solenoid values.- Specified by:
getSolenoidsin interfacePneumaticsBase- Returns:
- Bitmask containing the state of the solenoids. The LSB represents solenoid 0.
-
getModuleNumber
Description copied from interface:PneumaticsBaseGet module number for this module.- Specified by:
getModuleNumberin interfacePneumaticsBase- Returns:
- module number
-
getSolenoidDisabledList
Description copied from interface:PneumaticsBaseGet a bitmask of disabled solenoids.- Specified by:
getSolenoidDisabledListin interfacePneumaticsBase- Returns:
- Bitmask indicating disabled solenoids. The LSB represents solenoid 0.
-
getSolenoidVoltageFault
Returns whether the solenoid is currently reporting a voltage fault.- Returns:
- True if solenoid is reporting a fault, otherwise false.
- See Also:
-
getSolenoidVoltageStickyFault
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()- Returns:
- True if solenoid is reporting a fault, otherwise false.
- See Also:
-
clearAllStickyFaults
Clears all sticky faults on this device. -
fireOneShot
Description copied from interface:PneumaticsBaseFire a single solenoid shot.- Specified by:
fireOneShotin interfacePneumaticsBase- Parameters:
index- solenoid index
-
setOneShotDuration
Description copied from interface:PneumaticsBaseSet the duration for a single solenoid shot.- Specified by:
setOneShotDurationin interfacePneumaticsBase- Parameters:
index- solenoid indexdurMs- shot duration
-
checkSolenoidChannel
Description copied from interface:PneumaticsBaseCheck if a solenoid channel is valid.- Specified by:
checkSolenoidChannelin interfacePneumaticsBase- Parameters:
channel- Channel to check- Returns:
- True if channel exists
-
checkAndReserveSolenoids
Description copied from interface:PneumaticsBaseCheck to see if the solenoids marked in the bitmask can be reserved, and if so, reserve them.- Specified by:
checkAndReserveSolenoidsin interfacePneumaticsBase- Parameters:
mask- The bitmask of solenoids to reserve. The LSB represents solenoid 0.- Returns:
- 0 if successful; mask of solenoids that couldn't be allocated otherwise
-
unreserveSolenoids
Description copied from interface:PneumaticsBaseUnreserve the solenoids marked in the bitmask.- Specified by:
unreserveSolenoidsin interfacePneumaticsBase- Parameters:
mask- The bitmask of solenoids to unreserve. The LSB represents solenoid 0.
-
makeSolenoid
Description copied from interface:PneumaticsBaseCreate a solenoid object for the specified channel.- Specified by:
makeSolenoidin interfacePneumaticsBase- Parameters:
channel- solenoid channel- Returns:
- Solenoid object
-
makeDoubleSolenoid
Description copied from interface:PneumaticsBaseCreate a double solenoid object for the specified channels.- Specified by:
makeDoubleSolenoidin interfacePneumaticsBase- Parameters:
forwardChannel- solenoid channel for forwardreverseChannel- solenoid channel for reverse- Returns:
- DoubleSolenoid object
-
makeCompressor
Description copied from interface:PneumaticsBaseCreate a compressor object.- Specified by:
makeCompressorin interfacePneumaticsBase- Returns:
- Compressor object
-
reserveCompressor
Description copied from interface:PneumaticsBaseReserve the compressor.- Specified by:
reserveCompressorin interfacePneumaticsBase- Returns:
- true if successful; false if compressor already reserved
-
unreserveCompressor
Description copied from interface:PneumaticsBaseUnreserve the compressor.- Specified by:
unreserveCompressorin interfacePneumaticsBase
-
disableCompressor
Disables the compressor. The compressor will not turn on untilenableCompressorDigital()is called.- Specified by:
disableCompressorin interfacePneumaticsBase
-
enableCompressorDigital
Description copied from interface:PneumaticsBaseEnables 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.- Specified by:
enableCompressorDigitalin interfacePneumaticsBase
-
enableCompressorAnalog
Enables the compressor in digital mode. Analog mode is unsupported by the CTRE PCM.- Specified by:
enableCompressorAnalogin interfacePneumaticsBase- Parameters:
minPressure- Unsupported.maxPressure- Unsupported.- See Also:
-
enableCompressorHybrid
Enables the compressor in digital mode. Hybrid mode is unsupported by the CTRE PCM.- Specified by:
enableCompressorHybridin interfacePneumaticsBase- Parameters:
minPressure- Unsupported.maxPressure- Unsupported.- See Also:
-
getCompressorConfigType
Description copied from interface:PneumaticsBaseReturns the active compressor configuration.- Specified by:
getCompressorConfigTypein interfacePneumaticsBase- Returns:
- The active compressor configuration.
-
getAnalogVoltage
Unsupported by the CTRE PCM.- Specified by:
getAnalogVoltagein interfacePneumaticsBase- Parameters:
channel- Unsupported.- Returns:
- 0
-
getPressure
Unsupported by the CTRE PCM.- Specified by:
getPressurein interfacePneumaticsBase- Parameters:
channel- Unsupported.- Returns:
- 0
-