WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::PneumaticHub Class Reference

Module class for controlling a REV Robotics Pneumatic Hub. More...

#include <wpi/hardware/pneumatic/PneumaticHub.hpp>

Inheritance diagram for wpi::PneumaticHub:
wpi::PneumaticsBase

Classes

struct  Version
 Version and device data received from a REV PH. More...
struct  Faults
 Faults for a REV PH. More...
struct  StickyFaults
 Sticky faults for a REV PH. More...

Public Member Functions

 PneumaticHub (int busId)
 Constructs a PneumaticHub with the default ID (1).
 PneumaticHub (int busId, int module)
 Constructs a PneumaticHub.
 ~PneumaticHub () override=default
bool GetCompressor () const override
 Returns whether the compressor is active or not.
void DisableCompressor () override
 Disables the compressor.
void EnableCompressorDigital () override
 Enables the compressor in digital mode using the digital pressure switch.
void EnableCompressorAnalog (wpi::units::pounds_per_square_inch_t minPressure, wpi::units::pounds_per_square_inch_t maxPressure) override
 Enables the compressor in analog mode.
void EnableCompressorHybrid (wpi::units::pounds_per_square_inch_t minPressure, wpi::units::pounds_per_square_inch_t maxPressure) override
 Enables the compressor in hybrid mode.
CompressorConfigType GetCompressorConfigType () const override
 Returns the active compressor configuration.
bool GetPressureSwitch () const override
 Returns the state of the pressure switch.
wpi::units::ampere_t GetCompressorCurrent () const override
 Returns the current drawn by the compressor.
void SetSolenoids (int mask, int values) override
 Sets solenoids on a pneumatics module.
int GetSolenoids () const override
 Gets a bitmask of solenoid values.
int GetModuleNumber () const override
 Get module number for this module.
int GetSolenoidDisabledList () const override
 Get a bitmask of disabled solenoids.
void FireOneShot (int index) override
 Fire a single solenoid shot.
void SetOneShotDuration (int index, wpi::units::second_t duration) override
 Set the duration for a single solenoid shot.
bool CheckSolenoidChannel (int channel) const override
 Check if a solenoid channel is valid.
int CheckAndReserveSolenoids (int mask) override
 Check to see if the solenoids marked in the bitmask can be reserved, and if so, reserve them.
void UnreserveSolenoids (int mask) override
 Unreserve the solenoids marked in the bitmask.
bool ReserveCompressor () override
 Reserve the compressor.
void UnreserveCompressor () override
 Unreserve the compressor.
Solenoid MakeSolenoid (int channel) override
 Create a solenoid object for the specified channel.
DoubleSolenoid MakeDoubleSolenoid (int forwardChannel, int reverseChannel) override
 Create a double solenoid object for the specified channels.
Compressor MakeCompressor () override
 Create a compressor object.
void ReportUsage (std::string_view device, std::string_view data) override
 Report usage.
Version GetVersion () const
 Returns the hardware and firmware versions of this device.
Faults GetFaults () const
 Returns the faults currently active on this device.
StickyFaults GetStickyFaults () const
 Returns the sticky faults currently active on this device.
void ClearStickyFaults ()
 Clears the sticky faults.
wpi::units::volt_t GetInputVoltage () const
 Returns the current input voltage for this device.
wpi::units::volt_t Get5VRegulatedVoltage () const
 Returns the current voltage of the regulated 5v supply.
wpi::units::ampere_t GetSolenoidsTotalCurrent () const
 Returns the total current drawn by all solenoids.
wpi::units::volt_t GetSolenoidsVoltage () const
 Returns the current voltage of the solenoid power supply.
wpi::units::volt_t GetAnalogVoltage (int channel) const override
 Returns the raw voltage of the specified analog input channel.
wpi::units::pounds_per_square_inch_t GetPressure (int channel) const override
 Returns the pressure read by an analog pressure sensor on the specified analog input channel.
Public Member Functions inherited from wpi::PneumaticsBase
virtual ~PneumaticsBase ()=default

Friends

class DataStore
class PneumaticsBase

Additional Inherited Members

Static Public Member Functions inherited from wpi::PneumaticsBase
static std::shared_ptr< PneumaticsBaseGetForType (int busId, int module, PneumaticsModuleType moduleType)
 For internal use to get a module for a specific type.
static int GetDefaultForType (PneumaticsModuleType moduleType)
 For internal use to get the default for a specific type.

Detailed Description

Module class for controlling a REV Robotics Pneumatic Hub.

Constructor & Destructor Documentation

◆ PneumaticHub() [1/2]

wpi::PneumaticHub::PneumaticHub ( int busId)
explicit

Constructs a PneumaticHub with the default ID (1).

Parameters
busIdThe bus ID.

◆ PneumaticHub() [2/2]

wpi::PneumaticHub::PneumaticHub ( int busId,
int module )

Constructs a PneumaticHub.

Parameters
busIdThe bus ID.
modulemodule number to construct

◆ ~PneumaticHub()

wpi::PneumaticHub::~PneumaticHub ( )
overridedefault

Member Function Documentation

◆ CheckAndReserveSolenoids()

int wpi::PneumaticHub::CheckAndReserveSolenoids ( int mask)
overridevirtual

Check to see if the solenoids marked in the bitmask can be reserved, and if so, reserve them.

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

Implements wpi::PneumaticsBase.

◆ CheckSolenoidChannel()

bool wpi::PneumaticHub::CheckSolenoidChannel ( int channel) const
overridevirtual

Check if a solenoid channel is valid.

Parameters
channelChannel to check
Returns
True if channel exists

Implements wpi::PneumaticsBase.

◆ ClearStickyFaults()

void wpi::PneumaticHub::ClearStickyFaults ( )

Clears the sticky faults.

◆ DisableCompressor()

void wpi::PneumaticHub::DisableCompressor ( )
overridevirtual

Disables the compressor.

The compressor will not turn on until EnableCompressorDigital(), EnableCompressorAnalog(), or EnableCompressorHybrid() are called.

Implements wpi::PneumaticsBase.

◆ EnableCompressorAnalog()

void wpi::PneumaticHub::EnableCompressorAnalog ( wpi::units::pounds_per_square_inch_t minPressure,
wpi::units::pounds_per_square_inch_t maxPressure )
overridevirtual

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.

Parameters
minPressureThe minimum pressure. The compressor will turn on when the pressure drops below this value. Range 0 - 120 PSI.
maxPressureThe maximum pressure. The compressor will turn off when the pressure reaches this value. Range 0 - 120 PSI. Must be larger then minPressure.

Implements wpi::PneumaticsBase.

◆ EnableCompressorDigital()

void wpi::PneumaticHub::EnableCompressorDigital ( )
overridevirtual

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.

Implements wpi::PneumaticsBase.

◆ EnableCompressorHybrid()

void wpi::PneumaticHub::EnableCompressorHybrid ( wpi::units::pounds_per_square_inch_t minPressure,
wpi::units::pounds_per_square_inch_t maxPressure )
overridevirtual

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.

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.
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. Range 0 - 120 PSI.
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. Range 0 - 120 PSI. Must be larger then minPressure.

Implements wpi::PneumaticsBase.

◆ FireOneShot()

void wpi::PneumaticHub::FireOneShot ( int index)
overridevirtual

Fire a single solenoid shot.

Parameters
indexsolenoid index

Implements wpi::PneumaticsBase.

◆ Get5VRegulatedVoltage()

wpi::units::volt_t wpi::PneumaticHub::Get5VRegulatedVoltage ( ) const

Returns the current voltage of the regulated 5v supply.

Returns
The current voltage of the 5v supply.

◆ GetAnalogVoltage()

wpi::units::volt_t wpi::PneumaticHub::GetAnalogVoltage ( int channel) const
overridevirtual

Returns the raw voltage of the specified analog input channel.

Parameters
channelThe analog input channel to read voltage from.
Returns
The voltage of the specified analog input channel.

Implements wpi::PneumaticsBase.

◆ GetCompressor()

bool wpi::PneumaticHub::GetCompressor ( ) const
overridevirtual

Returns whether the compressor is active or not.

Returns
True if the compressor is on - otherwise false.

Implements wpi::PneumaticsBase.

◆ GetCompressorConfigType()

CompressorConfigType wpi::PneumaticHub::GetCompressorConfigType ( ) const
overridevirtual

Returns the active compressor configuration.

Returns
The active compressor configuration.

Implements wpi::PneumaticsBase.

◆ GetCompressorCurrent()

wpi::units::ampere_t wpi::PneumaticHub::GetCompressorCurrent ( ) const
overridevirtual

Returns the current drawn by the compressor.

Returns
The current drawn by the compressor.

Implements wpi::PneumaticsBase.

◆ GetFaults()

Faults wpi::PneumaticHub::GetFaults ( ) const

Returns the faults currently active on this device.

Returns
The faults.

◆ GetInputVoltage()

wpi::units::volt_t wpi::PneumaticHub::GetInputVoltage ( ) const

Returns the current input voltage for this device.

Returns
The input voltage.

◆ GetModuleNumber()

int wpi::PneumaticHub::GetModuleNumber ( ) const
overridevirtual

Get module number for this module.

Returns
module number

Implements wpi::PneumaticsBase.

◆ GetPressure()

wpi::units::pounds_per_square_inch_t wpi::PneumaticHub::GetPressure ( int channel) const
overridevirtual

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

Parameters
channelThe analog input channel to read pressure from.
Returns
The pressure read by an analog pressure sensor on the specified analog input channel.

Implements wpi::PneumaticsBase.

◆ GetPressureSwitch()

bool wpi::PneumaticHub::GetPressureSwitch ( ) const
overridevirtual

Returns the state of the pressure switch.

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

Implements wpi::PneumaticsBase.

◆ GetSolenoidDisabledList()

int wpi::PneumaticHub::GetSolenoidDisabledList ( ) const
overridevirtual

Get a bitmask of disabled solenoids.

Returns
Bitmask indicating disabled solenoids. The LSB represents solenoid 0.

Implements wpi::PneumaticsBase.

◆ GetSolenoids()

int wpi::PneumaticHub::GetSolenoids ( ) const
overridevirtual

Gets a bitmask of solenoid values.

Returns
Bitmask containing the state of the solenoids. The LSB represents solenoid 0.

Implements wpi::PneumaticsBase.

◆ GetSolenoidsTotalCurrent()

wpi::units::ampere_t wpi::PneumaticHub::GetSolenoidsTotalCurrent ( ) const

Returns the total current drawn by all solenoids.

Returns
Total current drawn by all solenoids.

◆ GetSolenoidsVoltage()

wpi::units::volt_t wpi::PneumaticHub::GetSolenoidsVoltage ( ) const

Returns the current voltage of the solenoid power supply.

Returns
The current voltage of the solenoid power supply.

◆ GetStickyFaults()

StickyFaults wpi::PneumaticHub::GetStickyFaults ( ) const

Returns the sticky faults currently active on this device.

Returns
The sticky faults.

◆ GetVersion()

Version wpi::PneumaticHub::GetVersion ( ) const

Returns the hardware and firmware versions of this device.

Returns
The hardware and firmware versions.

◆ MakeCompressor()

Compressor wpi::PneumaticHub::MakeCompressor ( )
overridevirtual

Create a compressor object.

Returns
Compressor object

Implements wpi::PneumaticsBase.

◆ MakeDoubleSolenoid()

DoubleSolenoid wpi::PneumaticHub::MakeDoubleSolenoid ( int forwardChannel,
int reverseChannel )
overridevirtual

Create a double solenoid object for the specified channels.

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

Implements wpi::PneumaticsBase.

◆ MakeSolenoid()

Solenoid wpi::PneumaticHub::MakeSolenoid ( int channel)
overridevirtual

Create a solenoid object for the specified channel.

Parameters
channelsolenoid channel
Returns
Solenoid object

Implements wpi::PneumaticsBase.

◆ ReportUsage()

void wpi::PneumaticHub::ReportUsage ( std::string_view device,
std::string_view data )
overridevirtual

Report usage.

Parameters
devicedevice and channel as appropriate
dataarbitrary usage data

Implements wpi::PneumaticsBase.

◆ ReserveCompressor()

bool wpi::PneumaticHub::ReserveCompressor ( )
overridevirtual

Reserve the compressor.

Returns
true if successful; false if compressor already reserved

Implements wpi::PneumaticsBase.

◆ SetOneShotDuration()

void wpi::PneumaticHub::SetOneShotDuration ( int index,
wpi::units::second_t duration )
overridevirtual

Set the duration for a single solenoid shot.

Parameters
indexsolenoid index
durationshot duration

Implements wpi::PneumaticsBase.

◆ SetSolenoids()

void wpi::PneumaticHub::SetSolenoids ( int mask,
int values )
overridevirtual

Sets solenoids on a pneumatics module.

Parameters
maskBitmask indicating which solenoids to set. The LSB represents solenoid 0.
valuesBitmask indicating the desired states of the solenoids. The LSB represents solenoid 0.

Implements wpi::PneumaticsBase.

◆ UnreserveCompressor()

void wpi::PneumaticHub::UnreserveCompressor ( )
overridevirtual

Unreserve the compressor.

Implements wpi::PneumaticsBase.

◆ UnreserveSolenoids()

void wpi::PneumaticHub::UnreserveSolenoids ( int mask)
overridevirtual

Unreserve the solenoids marked in the bitmask.

Parameters
maskThe bitmask of solenoids to unreserve. The LSB represents solenoid 0.

Implements wpi::PneumaticsBase.

◆ DataStore

friend class DataStore
friend

◆ PneumaticsBase

friend class PneumaticsBase
friend

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