PneumaticsBase
- class wpilib.PneumaticsBase
Bases:
pybind11_object
Base class for pneumatics devices.
- checkAndReserveSolenoids(mask: int) int
Check to see if the solenoids marked in the bitmask can be reserved, and if so, reserve them.
- 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
- 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: wpimath.units.pounds_per_square_inch, maxPressure: wpimath.units.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: wpimath.units.pounds_per_square_inch, maxPressure: wpimath.units.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) wpimath.units.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() wpimath.units.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) wpimath.units.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 indicating disabled solenoids. The LSB represents solenoid 0.
- getSolenoids() int
Gets a bitmask of solenoid values.
- Returns:
Bitmask containing the state of the solenoids. The LSB represents solenoid 0.
- makeCompressor() wpilib._wpilib.Compressor
Create a compressor object.
- Returns:
Compressor object
- makeDoubleSolenoid(forwardChannel: int, reverseChannel: int) wpilib._wpilib.DoubleSolenoid
Create a double solenoid object for the specified channels.
- Parameters:
forwardChannel – solenoid channel for forward
reverseChannel – solenoid channel for reverse
- Returns:
DoubleSolenoid object
- makeSolenoid(channel: int) wpilib._wpilib.Solenoid
Create a solenoid object for the specified channel.
- Parameters:
channel – solenoid channel
- Returns:
Solenoid object
- reserveCompressor() bool
Reserve the compressor.
- Returns:
true if successful; false if compressor already reserved
- setOneShotDuration(index: int, duration: wpimath.units.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 – 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.
- unreserveCompressor() None
Unreserve the compressor.
- unreserveSolenoids(mask: int) None
Unreserve the solenoids marked in the bitmask.
- Parameters:
mask – The bitmask of solenoids to unreserve. The LSB represents solenoid 0.