PneumaticsBase

class wpilib.PneumaticsBase

Bases: pybind11_object

checkAndReserveSolenoids(mask: int) int

Check to see if the masked solenoids can be reserved, and if not reserve them.

Parameters:

mask – The bitmask of solenoids to reserve

Returns:

0 if successful; mask of solenoids that couldn’t be allocated otherwise

checkSolenoidChannel(channel: int) bool

Check if a solenoid channel is valid.

Parameters:

channel – Channel to check

Returns:

True if channel exists

disableCompressor() None

Disables the compressor.

enableCompressorAnalog(minPressure: pounds_per_square_inch, maxPressure: pounds_per_square_inch) None

If supported by the device, enables the compressor in analog mode. This mode uses an analog pressure sensor connected to analog channel 0 to cycle the compressor. The compressor will turn on when the pressure drops below minPressure and will turn off when the pressure reaches {@code maxPressure}. This mode is only supported by the REV PH with the REV Analog Pressure Sensor connected to analog channel 0.

On CTRE PCM, this will enable digital control.

Parameters:
  • minPressure – The minimum pressure. The compressor will turn on when the pressure drops below this value.

  • maxPressure – The maximum pressure. The compressor will turn off when the pressure reaches this value.

enableCompressorDigital() None

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.

enableCompressorHybrid(minPressure: pounds_per_square_inch, maxPressure: pounds_per_square_inch) None

If supported by the device, enables the compressor in hybrid mode. This mode uses both a digital pressure switch and an analog pressure sensor connected to analog channel 0 to cycle the compressor. This mode is only supported by the REV PH with the REV Analog Pressure Sensor connected to analog channel 0.

The compressor will turn on when a both:

  • The digital pressure switch indicates the system is not full AND

  • The analog pressure sensor indicates that the pressure in the system

is below the specified minimum pressure.

The compressor will turn off when a either:

  • The digital pressure switch is disconnected or indicates that the system

is full OR - The pressure detected by the analog sensor is greater than the specified maximum pressure.

On CTRE PCM, this will enable digital control.

Parameters:
  • minPressure – The minimum pressure. The compressor will turn on when the pressure drops below this value and the pressure switch indicates that the system is not full.

  • maxPressure – The maximum pressure. The compressor will turn off when the pressure reaches this value or the pressure switch is disconnected or indicates that the system is full.

fireOneShot(index: int) None

Fire a single solenoid shot.

Parameters:

index – solenoid index

getAnalogVoltage(channel: int) volts

If supported by the device, returns the raw voltage of the specified analog input channel.

This function is only supported by the REV PH. On CTRE PCM, this will return 0.

Parameters:

channel – The analog input channel to read voltage from.

Returns:

The voltage of the specified analog input channel.

getCompressor() bool

Returns whether the compressor is active or not.

Returns:

True if the compressor is on - otherwise false.

getCompressorConfigType() wpilib._wpilib.CompressorConfigType

Returns the active compressor configuration.

Returns:

The active compressor configuration.

getCompressorCurrent() amperes

Returns the current drawn by the compressor.

Returns:

The current drawn by the compressor.

static getDefaultForType(moduleType: wpilib._wpilib.PneumaticsModuleType) int

For internal use to get the default for a specific type.

Parameters:

moduleType – module type

Returns:

module default

static getForType(module: int, moduleType: wpilib._wpilib.PneumaticsModuleType) wpilib._wpilib.PneumaticsBase

For internal use to get a module for a specific type.

Parameters:
  • module – module number

  • moduleType – module type

Returns:

module

getModuleNumber() int

Get module number for this module.

Returns:

module number

getPressure(channel: int) pounds_per_square_inch

If supported by the device, returns the pressure read by an analog pressure sensor on the specified analog input channel.

This function is only supported by the REV PH. On CTRE PCM, this will return 0.

Parameters:

channel – The analog input channel to read pressure from.

Returns:

The pressure read by an analog pressure sensor on the specified analog input channel.

getPressureSwitch() bool

Returns the state of the pressure switch.

Returns:

True if pressure switch indicates that the system is full, otherwise false.

getSolenoidDisabledList() int

Get a bitmask of disabled solenoids.

Returns:

bitmask of disabled solenoids

getSolenoids() int

Gets a bitmask of solenoid values.

Returns:

values

makeCompressor() wpilib._wpilib.Compressor
makeDoubleSolenoid(forwardChannel: int, reverseChannel: int) wpilib._wpilib.DoubleSolenoid
makeSolenoid(channel: int) wpilib._wpilib.Solenoid
reserveCompressor() bool
setOneShotDuration(index: int, duration: seconds) None

Set the duration for a single solenoid shot.

Parameters:
  • index – solenoid index

  • duration – shot duration

setSolenoids(mask: int, values: int) None

Sets solenoids on a pneumatics module.

Parameters:
  • mask – mask

  • values – values

unreserveCompressor() None
unreserveSolenoids(mask: int) None

Unreserve the masked solenoids.

Parameters:

mask – The bitmask of solenoids to unreserve