Compressor¶
- class wpilib.Compressor(pcmId=None)[source]¶
Bases: wpilib.SensorBase
Operates the PCM (Pneumatics compressor module)
The PCM automatically will run in close-loop mode by default whenever a Solenoid object is created. For most cases the Compressor object does not need to be instantiated or used in a robot program.
This class is only required in cases where more detailed status or to enable/disable closed loop control. Note: you cannot operate the compressor directly from this class as doing so would circumvent the safety provided in using the pressure switch and closed loop control. You can only turn off closed loop control, thereby stopping the compressor from operating.
Create an instance of the Compressor
Parameters: pcmID – The PCM CAN device ID. Most robots that use PCM will have a single module. Use this for supporting a second module other than the default. - enabled()[source]¶
Get the enabled status of the compressor.
Returns: True if the compressor is on Return type: bool
- getClosedLoopControl()[source]¶
Gets the current operating mode of the PCM.
Returns: True if compressor is operating on closed-loop mode, otherwise return False. Return type: bool
- getCompressorCurrent()[source]¶
Get the current being used by the compressor.
Returns: Current consumed in amps for the compressor motor Return type: float
- getCompressorCurrentTooHighFault()[source]¶
Returns: True if PCM is in fault state : Compressor Drive is disabled due to compressor current being too high
- getCompressorCurrentTooHighStickyFault()[source]¶
Returns: True if PCM sticky fault is set : Compressor Drive is disabled due to compressor current being too high
- getCompressorNotConnectedFault()[source]¶
Returns: True if PCM is in fault state : Compressor does not appear to be wired, i.e. compressor is not drawing enough current.
- getCompressorNotConnectedStickyFault()[source]¶
Returns: True if PCM sticky fault is set : Compressor does not appear to be wired, i.e. compressor is not drawing enough current.
- getCompressorShortedFault()[source]¶
Returns: True if PCM is in fault state : Compressor Output appears to be shorted
- getCompressorShortedStickyFault()[source]¶
Returns: True if PCM sticky fault is set : Compressor Output appears to be shorted
- getPressureSwitchValue()[source]¶
Get the current pressure switch value.
Returns: True if the pressure is low by reading the pressure switch that is plugged into the PCM Return type: bool
- setClosedLoopControl(on)[source]¶
Set the PCM in closed loop control mode.
Parameters: on (bool) – If True sets the compressor to be in closed loop control mode otherwise normal operation of the compressor is disabled.