Compressor

class wpilib.Compressor(*args, **kwargs)

Bases: wpiutil._wpiutil.Sendable

Class for operating a compressor connected to a pneumatics module.

The module will automatically run in closed loop mode by default whenever a Solenoid object is created. For most cases, a Compressor object does not need to be instantiated or used in a robot program. This class is only required in cases where the robot program needs a more detailed status of the compressor 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 by using the pressure switch and closed loop control. You can only turn off closed loop control, thereby stopping the compressor from operating.

Overloaded function.

  1. __init__(self: wpilib._wpilib.Compressor, module: int, moduleType: wpilib._wpilib.PneumaticsModuleType) -> None

Constructs a compressor for a specified module and type.

Parameters
  • module – The module ID to use.

  • moduleType – The module type to use.

  1. __init__(self: wpilib._wpilib.Compressor, moduleType: wpilib._wpilib.PneumaticsModuleType) -> None

Constructs a compressor for a default module and specified type.

Parameters

moduleType – The module type to use.

disable() None

Disable the compressor.

enableAnalog(minPressure: pounds_per_square_inch, maxPressure: pounds_per_square_inch) None

Enable compressor closed loop control using analog input. Note this is only for use with the REV Analog Pressure Sensor.

On CTRE PCM, this will enable digital control.

Parameters
  • minPressure – The minimum pressure in PSI to enable compressor

  • maxPressure – The maximum pressure in PSI to disable compressor

enableDigital() None

Enable compressor closed loop control using digital input.

enableHybrid(minPressure: pounds_per_square_inch, maxPressure: pounds_per_square_inch) None

Enable compressor closed loop control using hybrid input. Note this is only for use with the REV Analog Pressure Sensor.

On CTRE PCM, this will enable digital control.

Parameters
  • minPressure – The minimum pressure in PSI to enable compressor

  • maxPressure – The maximum pressure in PSI to disable compressor

enabled() bool

Check if compressor output is active.

Returns

true if the compressor is on

getAnalogVoltage() volts

Query the analog input voltage (on channel 0) (if supported).

Returns

The analog input voltage, in volts

getConfigType() wpilib._wpilib.CompressorConfigType
getCurrent() amperes

Query how much current the compressor is drawing.

Returns

The current through the compressor, in amps

getPressure() pounds_per_square_inch

Query the analog sensor pressure (on channel 0) (if supported). Note this is only for use with the REV Analog Pressure Sensor.

Returns

The analog sensor pressure, in PSI

getPressureSwitchValue() bool

Check if the pressure switch is triggered.

Returns

true if pressure is low

initSendable(builder: wpiutil._wpiutil.SendableBuilder) None
start() None
stop() None