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
ConstructorDescriptionConstructs a PneumaticsControlModule with the default ID (0).PneumaticsControlModule
(int module) Constructs a PneumaticsControlModule. -
Method Summary
Modifier and TypeMethodDescriptionint
checkAndReserveSolenoids
(int mask) Check to see if the solenoids marked in the bitmask can be reserved, and if so, reserve them.boolean
checkSolenoidChannel
(int channel) Check if a solenoid channel is valid.void
Clears all sticky faults on this device.void
close()
void
Disables the compressor.void
enableCompressorAnalog
(double minPressure, double maxPressure) Enables the compressor in digital mode.void
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
Returns whether the compressor is active or not.Returns the active compressor configuration.double
Returns the current drawn by the compressor in amps.boolean
Return whether the compressor current is currently too high.boolean
Returns whether the compressor current has been too high since sticky faults were last cleared.boolean
Returns whether the compressor is currently disconnected.boolean
Returns whether the compressor has been disconnected since sticky faults were last cleared.boolean
Returns whether the compressor is currently shorted.boolean
Returns whether the compressor has been shorted since sticky faults were last cleared.int
Get module number for this module.double
getPressure
(int channel) Unsupported by the CTRE PCM.boolean
Returns the state of the pressure switch.int
Get a bitmask of disabled solenoids.int
Gets a bitmask of solenoid values.boolean
Returns whether the solenoid is currently reporting a voltage fault.boolean
Returns 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.boolean
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
Unreserve the compressor.void
unreserveSolenoids
(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:
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
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:PneumaticsBase
Sets solenoids on a pneumatics module.- Specified by:
setSolenoids
in 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:PneumaticsBase
Gets a bitmask of solenoid values.- Specified by:
getSolenoids
in interfacePneumaticsBase
- Returns:
- Bitmask containing the state of the solenoids. The LSB represents solenoid 0.
-
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 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: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 solenoids marked in the bitmask can be reserved, and if so, reserve them.- Specified by:
checkAndReserveSolenoids
in 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:PneumaticsBase
Unreserve the solenoids marked in the bitmask.- Specified by:
unreserveSolenoids
in interfacePneumaticsBase
- Parameters:
mask
- The bitmask of solenoids to unreserve. The LSB represents solenoid 0.
-
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:
-
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:
-
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
-