WPILibC++ 2024.3.2
frc::PneumaticsBase Class Referenceabstract

Base class for pneumatics devices. More...

#include <frc/PneumaticsBase.h>

Inheritance diagram for frc::PneumaticsBase:
frc::PneumaticHub frc::PneumaticsControlModule

Public Member Functions

virtual ~PneumaticsBase ()=default
 
virtual bool GetCompressor () const =0
 Returns whether the compressor is active or not. More...
 
virtual bool GetPressureSwitch () const =0
 Returns the state of the pressure switch. More...
 
virtual units::ampere_t GetCompressorCurrent () const =0
 Returns the current drawn by the compressor. More...
 
virtual void DisableCompressor ()=0
 Disables the compressor. More...
 
virtual void EnableCompressorDigital ()=0
 Enables the compressor in digital mode using the digital pressure switch. More...
 
virtual void EnableCompressorAnalog (units::pounds_per_square_inch_t minPressure, units::pounds_per_square_inch_t maxPressure)=0
 If supported by the device, enables the compressor in analog mode. More...
 
virtual void EnableCompressorHybrid (units::pounds_per_square_inch_t minPressure, units::pounds_per_square_inch_t maxPressure)=0
 If supported by the device, enables the compressor in hybrid mode. More...
 
virtual CompressorConfigType GetCompressorConfigType () const =0
 Returns the active compressor configuration. More...
 
virtual void SetSolenoids (int mask, int values)=0
 Sets solenoids on a pneumatics module. More...
 
virtual int GetSolenoids () const =0
 Gets a bitmask of solenoid values. More...
 
virtual int GetModuleNumber () const =0
 Get module number for this module. More...
 
virtual int GetSolenoidDisabledList () const =0
 Get a bitmask of disabled solenoids. More...
 
virtual void FireOneShot (int index)=0
 Fire a single solenoid shot. More...
 
virtual void SetOneShotDuration (int index, units::second_t duration)=0
 Set the duration for a single solenoid shot. More...
 
virtual bool CheckSolenoidChannel (int channel) const =0
 Check if a solenoid channel is valid. More...
 
virtual int CheckAndReserveSolenoids (int mask)=0
 Check to see if the masked solenoids can be reserved, and if not reserve them. More...
 
virtual void UnreserveSolenoids (int mask)=0
 Unreserve the masked solenoids. More...
 
virtual bool ReserveCompressor ()=0
 Reserve the compressor. More...
 
virtual void UnreserveCompressor ()=0
 Unreserve the compressor. More...
 
virtual units::volt_t GetAnalogVoltage (int channel) const =0
 If supported by the device, returns the raw voltage of the specified analog input channel. More...
 
virtual units::pounds_per_square_inch_t GetPressure (int channel) const =0
 If supported by the device, returns the pressure read by an analog pressure sensor on the specified analog input channel. More...
 
virtual Solenoid MakeSolenoid (int channel)=0
 Create a solenoid object for the specified channel. More...
 
virtual DoubleSolenoid MakeDoubleSolenoid (int forwardChannel, int reverseChannel)=0
 Create a double solenoid object for the specified channels. More...
 
virtual Compressor MakeCompressor ()=0
 Create a compressor object. More...
 

Static Public Member Functions

static std::shared_ptr< PneumaticsBaseGetForType (int module, PneumaticsModuleType moduleType)
 For internal use to get a module for a specific type. More...
 
static int GetDefaultForType (PneumaticsModuleType moduleType)
 For internal use to get the default for a specific type. More...
 

Detailed Description

Base class for pneumatics devices.

Constructor & Destructor Documentation

◆ ~PneumaticsBase()

virtual frc::PneumaticsBase::~PneumaticsBase ( )
virtualdefault

Member Function Documentation

◆ CheckAndReserveSolenoids()

virtual int frc::PneumaticsBase::CheckAndReserveSolenoids ( int  mask)
pure virtual

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

Parameters
maskThe bitmask of solenoids to reserve
Returns
0 if successful; mask of solenoids that couldn't be allocated otherwise

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ CheckSolenoidChannel()

virtual bool frc::PneumaticsBase::CheckSolenoidChannel ( int  channel) const
pure virtual

Check if a solenoid channel is valid.

Parameters
channelChannel to check
Returns
True if channel exists

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ DisableCompressor()

virtual void frc::PneumaticsBase::DisableCompressor ( )
pure virtual

Disables the compressor.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ EnableCompressorAnalog()

virtual void frc::PneumaticsBase::EnableCompressorAnalog ( units::pounds_per_square_inch_t  minPressure,
units::pounds_per_square_inch_t  maxPressure 
)
pure virtual

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
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
minPressureThe minimum pressure. The compressor will turn on when the pressure drops below this value.
maxPressureThe maximum pressure. The compressor will turn off when the pressure reaches this value.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ EnableCompressorDigital()

virtual void frc::PneumaticsBase::EnableCompressorDigital ( )
pure virtual

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.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ EnableCompressorHybrid()

virtual void frc::PneumaticsBase::EnableCompressorHybrid ( units::pounds_per_square_inch_t  minPressure,
units::pounds_per_square_inch_t  maxPressure 
)
pure virtual

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 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 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
minPressureThe 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.
maxPressureThe 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.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ FireOneShot()

virtual void frc::PneumaticsBase::FireOneShot ( int  index)
pure virtual

Fire a single solenoid shot.

Parameters
indexsolenoid index

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetAnalogVoltage()

virtual units::volt_t frc::PneumaticsBase::GetAnalogVoltage ( int  channel) const
pure virtual

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
channelThe analog input channel to read voltage from.
Returns
The voltage of the specified analog input channel.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetCompressor()

virtual bool frc::PneumaticsBase::GetCompressor ( ) const
pure virtual

Returns whether the compressor is active or not.

Returns
True if the compressor is on - otherwise false.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetCompressorConfigType()

virtual CompressorConfigType frc::PneumaticsBase::GetCompressorConfigType ( ) const
pure virtual

Returns the active compressor configuration.

Returns
The active compressor configuration.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetCompressorCurrent()

virtual units::ampere_t frc::PneumaticsBase::GetCompressorCurrent ( ) const
pure virtual

Returns the current drawn by the compressor.

Returns
The current drawn by the compressor.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetDefaultForType()

static int frc::PneumaticsBase::GetDefaultForType ( PneumaticsModuleType  moduleType)
static

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

Parameters
moduleTypemodule type
Returns
module default

◆ GetForType()

static std::shared_ptr< PneumaticsBase > frc::PneumaticsBase::GetForType ( int  module,
PneumaticsModuleType  moduleType 
)
static

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

Parameters
modulemodule number
moduleTypemodule type
Returns
module

◆ GetModuleNumber()

virtual int frc::PneumaticsBase::GetModuleNumber ( ) const
pure virtual

Get module number for this module.

Returns
module number

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetPressure()

virtual units::pounds_per_square_inch_t frc::PneumaticsBase::GetPressure ( int  channel) const
pure virtual

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
channelThe analog input channel to read pressure from.
Returns
The pressure read by an analog pressure sensor on the specified analog input channel.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetPressureSwitch()

virtual bool frc::PneumaticsBase::GetPressureSwitch ( ) const
pure virtual

Returns the state of the pressure switch.

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

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetSolenoidDisabledList()

virtual int frc::PneumaticsBase::GetSolenoidDisabledList ( ) const
pure virtual

Get a bitmask of disabled solenoids.

Returns
bitmask of disabled solenoids

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ GetSolenoids()

virtual int frc::PneumaticsBase::GetSolenoids ( ) const
pure virtual

Gets a bitmask of solenoid values.

Returns
solenoid values

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ MakeCompressor()

virtual Compressor frc::PneumaticsBase::MakeCompressor ( )
pure virtual

Create a compressor object.

Returns
Compressor object

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ MakeDoubleSolenoid()

virtual DoubleSolenoid frc::PneumaticsBase::MakeDoubleSolenoid ( int  forwardChannel,
int  reverseChannel 
)
pure virtual

Create a double solenoid object for the specified channels.

Parameters
forwardChannelsolenoid channel for forward
reverseChannelsolenoid channel for reverse
Returns
DoubleSolenoid object

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ MakeSolenoid()

virtual Solenoid frc::PneumaticsBase::MakeSolenoid ( int  channel)
pure virtual

Create a solenoid object for the specified channel.

Parameters
channelsolenoid channel
Returns
Solenoid object

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ ReserveCompressor()

virtual bool frc::PneumaticsBase::ReserveCompressor ( )
pure virtual

Reserve the compressor.

Returns
true if successful; false if compressor already reserved

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ SetOneShotDuration()

virtual void frc::PneumaticsBase::SetOneShotDuration ( int  index,
units::second_t  duration 
)
pure virtual

Set the duration for a single solenoid shot.

Parameters
indexsolenoid index
durationshot duration

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ SetSolenoids()

virtual void frc::PneumaticsBase::SetSolenoids ( int  mask,
int  values 
)
pure virtual

Sets solenoids on a pneumatics module.

Parameters
maskbitmask to set
valuessolenoid values

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ UnreserveCompressor()

virtual void frc::PneumaticsBase::UnreserveCompressor ( )
pure virtual

Unreserve the compressor.

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.

◆ UnreserveSolenoids()

virtual void frc::PneumaticsBase::UnreserveSolenoids ( int  mask)
pure virtual

Unreserve the masked solenoids.

Parameters
maskThe bitmask of solenoids to unreserve

Implemented in frc::PneumaticHub, and frc::PneumaticsControlModule.


The documentation for this class was generated from the following file: