Package edu.wpi.first.wpilibj
Class PneumaticsControlModule
java.lang.Object
edu.wpi.first.wpilibj.PneumaticsControlModule
- All Implemented Interfaces:
PneumaticsBase
,AutoCloseable
public class PneumaticsControlModule extends Object implements PneumaticsBase
Module class for controlling a Cross The Road Electronics Pneumatics Control Module.
-
Constructor Summary
Constructors Constructor Description PneumaticsControlModule()
Constructs a PneumaticsControlModule with the default ID (0).PneumaticsControlModule(int module)
Constructs a PneumaticsControlModule. -
Method Summary
Modifier and Type Method Description int
checkAndReserveSolenoids(int mask)
Check to see if the masked solenoids can be reserved, and if not reserve them.boolean
checkSolenoidChannel(int channel)
Check if a solenoid channel is valid.void
clearAllStickyFaults()
Clears all sticky faults on this device.void
close()
void
disableCompressor()
Disables the compressor.void
enableCompressorAnalog(double minPressure, double maxPressure)
Enables the compressor in digital mode.void
enableCompressorDigital()
Enables the compressor in digital mode using the digital pressure switch.void
enableCompressorHybrid(double minPressure, double maxPressure)
Enables the compressor in digital mode.void
fireOneShot(int index)
Fire a single solenoid shot.double
getAnalogVoltage(int channel)
Unsupported by the CTRE PCM.boolean
getCompressor()
Returns whether the compressor is active or not.CompressorConfigType
getCompressorConfigType()
Returns the active compressor configuration.double
getCompressorCurrent()
Returns the current drawn by the compressor in amps.boolean
getCompressorCurrentTooHighFault()
Return whether the compressor current is currently too high.boolean
getCompressorCurrentTooHighStickyFault()
Returns whether the compressor current has been too high since sticky faults were last cleared.boolean
getCompressorNotConnectedFault()
Returns whether the compressor is currently disconnected.boolean
getCompressorNotConnectedStickyFault()
Returns whether the compressor has been disconnected since sticky faults were last cleared.boolean
getCompressorShortedFault()
Returns whether the compressor is currently shorted.boolean
getCompressorShortedStickyFault()
Returns whether the compressor has been shorted since sticky faults were last cleared.int
getModuleNumber()
Get module number for this module.double
getPressure(int channel)
Unsupported by the CTRE PCM.boolean
getPressureSwitch()
Returns the state of the pressure switch.int
getSolenoidDisabledList()
Get a bitmask of disabled solenoids.int
getSolenoids()
Gets a bitmask of solenoid values.boolean
getSolenoidVoltageFault()
Returns whether the solenoid is currently reporting a voltage fault.boolean
getSolenoidVoltageStickyFault()
Returns whether the solenoid has reported a voltage fault since sticky faults were last cleared.Compressor
makeCompressor()
Create a compressor object.DoubleSolenoid
makeDoubleSolenoid(int forwardChannel, int reverseChannel)
Create a double solenoid object for the specified channels.Solenoid
makeSolenoid(int channel)
Create a solenoid object for the specified channel.boolean
reserveCompressor()
Reserve the compressor.void
setOneShotDuration(int index, int durMs)
Set the duration for a single solenoid shot.void
setSolenoids(int mask, int values)
Sets solenoids on a pneumatics module.void
unreserveCompressor()
Unreserve the compressor.void
unreserveSolenoids(int mask)
Unreserve the masked solenoids.
-
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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfacePneumaticsBase
-
getCompressor
Description copied from interface:PneumaticsBase
Returns whether the compressor is active or not.- Specified by:
getCompressor
in interfacePneumaticsBase
- Returns:
- True if the compressor is on - otherwise false.
-
getPressureSwitch
Description copied from interface:PneumaticsBase
Returns the state of the pressure switch.- Specified by:
getPressureSwitch
in interfacePneumaticsBase
- Returns:
- True if pressure switch indicates that the system is not full, otherwise false.
-
getCompressorCurrent
Description copied from interface:PneumaticsBase
Returns the current drawn by the compressor in amps.- Specified by:
getCompressorCurrent
in 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()
-
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:
getCompressorCurrentTooHighFault()
-
getCompressorShortedFault
Returns whether the compressor is currently shorted.- Returns:
- True if the compressor is currently shorted, otherwise false.
- See Also:
getCompressorShortedStickyFault()
-
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:
getCompressorShortedFault()
-
getCompressorNotConnectedFault
Returns whether the compressor is currently disconnected.- Returns:
- True if compressor is currently disconnected, otherwise false.
- See Also:
getCompressorNotConnectedStickyFault()
-
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:
getCompressorNotConnectedFault()
-
setSolenoids
Description copied from interface:PneumaticsBase
Sets solenoids on a pneumatics module.- Specified by:
setSolenoids
in interfacePneumaticsBase
- Parameters:
mask
- maskvalues
- values
-
getSolenoids
Description copied from interface:PneumaticsBase
Gets a bitmask of solenoid values.- Specified by:
getSolenoids
in interfacePneumaticsBase
- Returns:
- values
-
getModuleNumber
Description copied from interface:PneumaticsBase
Get module number for this module.- Specified by:
getModuleNumber
in interfacePneumaticsBase
- Returns:
- module number
-
getSolenoidDisabledList
Description copied from interface:PneumaticsBase
Get a bitmask of disabled solenoids.- Specified by:
getSolenoidDisabledList
in interfacePneumaticsBase
- Returns:
- bitmask of disabled solenoids
-
getSolenoidVoltageFault
Returns whether the solenoid is currently reporting a voltage fault.- Returns:
- True if solenoid is reporting a fault, otherwise false.
- See Also:
getSolenoidVoltageStickyFault()
-
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:
getSolenoidVoltageFault()
-
clearAllStickyFaults
Clears all sticky faults on this device. -
fireOneShot
Description copied from interface:PneumaticsBase
Fire a single solenoid shot.- Specified by:
fireOneShot
in interfacePneumaticsBase
- Parameters:
index
- solenoid index
-
setOneShotDuration
Description copied from interface:PneumaticsBase
Set the duration for a single solenoid shot.- Specified by:
setOneShotDuration
in interfacePneumaticsBase
- Parameters:
index
- solenoid indexdurMs
- shot duration
-
checkSolenoidChannel
Description copied from interface:PneumaticsBase
Check if a solenoid channel is valid.- Specified by:
checkSolenoidChannel
in interfacePneumaticsBase
- Parameters:
channel
- Channel to check- Returns:
- True if channel exists
-
checkAndReserveSolenoids
Description copied from interface:PneumaticsBase
Check to see if the masked solenoids can be reserved, and if not reserve them.- Specified by:
checkAndReserveSolenoids
in interfacePneumaticsBase
- Parameters:
mask
- The bitmask of solenoids to reserve- Returns:
- 0 if successful; mask of solenoids that couldn't be allocated otherwise
-
unreserveSolenoids
Description copied from interface:PneumaticsBase
Unreserve the masked solenoids.- Specified by:
unreserveSolenoids
in interfacePneumaticsBase
- Parameters:
mask
- The bitmask of solenoids to unreserve
-
makeSolenoid
Description copied from interface:PneumaticsBase
Create a solenoid object for the specified channel.- Specified by:
makeSolenoid
in interfacePneumaticsBase
- Parameters:
channel
- solenoid channel- Returns:
- Solenoid object
-
makeDoubleSolenoid
Description copied from interface:PneumaticsBase
Create a double solenoid object for the specified channels.- Specified by:
makeDoubleSolenoid
in interfacePneumaticsBase
- Parameters:
forwardChannel
- solenoid channel for forwardreverseChannel
- solenoid channel for reverse- Returns:
- DoubleSolenoid object
-
makeCompressor
Description copied from interface:PneumaticsBase
Create a compressor object.- Specified by:
makeCompressor
in interfacePneumaticsBase
- Returns:
- Compressor object
-
reserveCompressor
Description copied from interface:PneumaticsBase
Reserve the compressor.- Specified by:
reserveCompressor
in interfacePneumaticsBase
- Returns:
- true if successful; false if compressor already reserved
-
unreserveCompressor
Description copied from interface:PneumaticsBase
Unreserve the compressor.- Specified by:
unreserveCompressor
in interfacePneumaticsBase
-
disableCompressor
Disables the compressor. The compressor will not turn on untilenableCompressorDigital()
is called.- Specified by:
disableCompressor
in interfacePneumaticsBase
-
enableCompressorDigital
Description copied from interface:PneumaticsBase
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.- Specified by:
enableCompressorDigital
in interfacePneumaticsBase
-
enableCompressorAnalog
Enables the compressor in digital mode. Analog mode is unsupported by the CTRE PCM.- Specified by:
enableCompressorAnalog
in interfacePneumaticsBase
- Parameters:
minPressure
- Unsupported.maxPressure
- Unsupported.- See Also:
enableCompressorDigital()
-
enableCompressorHybrid
Enables the compressor in digital mode. Hybrid mode is unsupported by the CTRE PCM.- Specified by:
enableCompressorHybrid
in interfacePneumaticsBase
- Parameters:
minPressure
- Unsupported.maxPressure
- Unsupported.- See Also:
enableCompressorDigital()
-
getCompressorConfigType
Description copied from interface:PneumaticsBase
Returns the active compressor configuration.- Specified by:
getCompressorConfigType
in interfacePneumaticsBase
- Returns:
- The active compressor configuration.
-
getAnalogVoltage
Unsupported by the CTRE PCM.- Specified by:
getAnalogVoltage
in interfacePneumaticsBase
- Parameters:
channel
- Unsupported.- Returns:
- 0
-
getPressure
Unsupported by the CTRE PCM.- Specified by:
getPressure
in interfacePneumaticsBase
- Parameters:
channel
- Unsupported.- Returns:
- 0
-