WPILibC++ 2023.4.3-108-ge5452e3
|
Class for operating a compressor connected to a pneumatics module. More...
#include <frc/Compressor.h>
Public Member Functions | |
Compressor (int module, PneumaticsModuleType moduleType) | |
Constructs a compressor for a specified module and type. More... | |
Compressor (PneumaticsModuleType moduleType) | |
Constructs a compressor for a default module and specified type. More... | |
~Compressor () override | |
Compressor (const Compressor &)=delete | |
Compressor & | operator= (const Compressor &)=delete |
Compressor (Compressor &&)=default | |
Compressor & | operator= (Compressor &&)=default |
bool | Enabled () const |
Check if compressor output is active. More... | |
bool | IsEnabled () const |
Returns whether the compressor is active or not. More... | |
bool | GetPressureSwitchValue () const |
Returns the state of the pressure switch. More... | |
units::ampere_t | GetCurrent () const |
Get the current drawn by the compressor. More... | |
units::volt_t | GetAnalogVoltage () const |
If supported by the device, returns the analog input voltage (on channel 0). More... | |
units::pounds_per_square_inch_t | GetPressure () const |
If supported by the device, returns the pressure read by the analog pressure sensor (on channel 0). More... | |
void | Disable () |
Disable the compressor. More... | |
void | EnableDigital () |
Enables the compressor in digital mode using the digital pressure switch. More... | |
void | EnableAnalog (units::pounds_per_square_inch_t minPressure, units::pounds_per_square_inch_t maxPressure) |
If supported by the device, enables the compressor in analog mode. More... | |
void | EnableHybrid (units::pounds_per_square_inch_t minPressure, units::pounds_per_square_inch_t maxPressure) |
If supported by the device, enables the compressor in hybrid mode. More... | |
CompressorConfigType | GetConfigType () const |
Returns the active compressor configuration. More... | |
void | InitSendable (wpi::SendableBuilder &builder) override |
Initializes this Sendable object. More... | |
Public Member Functions inherited from wpi::Sendable | |
virtual | ~Sendable ()=default |
virtual void | InitSendable (SendableBuilder &builder)=0 |
Initializes this Sendable object. More... | |
Public Member Functions inherited from wpi::SendableHelper< Compressor > | |
SendableHelper (const SendableHelper &rhs)=default | |
SendableHelper (SendableHelper &&rhs) | |
SendableHelper & | operator= (const SendableHelper &rhs)=default |
SendableHelper & | operator= (SendableHelper &&rhs) |
Additional Inherited Members | |
Protected Member Functions inherited from wpi::SendableHelper< Compressor > | |
SendableHelper ()=default | |
~SendableHelper () | |
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.
frc::Compressor::Compressor | ( | int | module, |
PneumaticsModuleType | moduleType | ||
) |
Constructs a compressor for a specified module and type.
module | The module ID to use. |
moduleType | The module type to use. |
|
explicit |
Constructs a compressor for a default module and specified type.
moduleType | The module type to use. |
|
override |
|
delete |
|
default |
void frc::Compressor::Disable | ( | ) |
Disable the compressor.
void frc::Compressor::EnableAnalog | ( | units::pounds_per_square_inch_t | minPressure, |
units::pounds_per_square_inch_t | maxPressure | ||
) |
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
. This mode is only supported by the REV PH with the REV Analog Pressure Sensor connected to analog channel 0.
maxPressure
On CTRE PCM, this will enable digital control.
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. |
bool frc::Compressor::Enabled | ( | ) | const |
Check if compressor output is active.
To (re)enable the compressor use EnableDigital() or EnableAnalog(...).
void frc::Compressor::EnableDigital | ( | ) |
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.
void frc::Compressor::EnableHybrid | ( | units::pounds_per_square_inch_t | minPressure, |
units::pounds_per_square_inch_t | maxPressure | ||
) |
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 both:
The compressor will turn off when either:
On CTRE PCM, this will enable digital control.
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. |
units::volt_t frc::Compressor::GetAnalogVoltage | ( | ) | const |
If supported by the device, returns the analog input voltage (on channel 0).
This function is only supported by the REV PH. On CTRE PCM, this will return 0.
CompressorConfigType frc::Compressor::GetConfigType | ( | ) | const |
Returns the active compressor configuration.
units::ampere_t frc::Compressor::GetCurrent | ( | ) | const |
Get the current drawn by the compressor.
units::pounds_per_square_inch_t frc::Compressor::GetPressure | ( | ) | const |
If supported by the device, returns the pressure read by the analog pressure sensor (on channel 0).
This function is only supported by the REV PH with the REV Analog Pressure Sensor. On CTRE PCM, this will return 0.
bool frc::Compressor::GetPressureSwitchValue | ( | ) | const |
Returns the state of the pressure switch.
|
overridevirtual |
bool frc::Compressor::IsEnabled | ( | ) | const |
Returns whether the compressor is active or not.
|
default |
|
delete |