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

Solenoid class for running high voltage Digital Output on a pneumatics module. More...

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

Inheritance diagram for wpi::Solenoid:
wpi::util::Sendable wpi::util::SendableHelper< Solenoid >

Public Member Functions

 Solenoid (int busId, int module, PneumaticsModuleType moduleType, int channel)
 Constructs a solenoid for a specified module and type.
 Solenoid (int busId, PneumaticsModuleType moduleType, int channel)
 Constructs a solenoid for a default module and specified type.
 ~Solenoid () override
 Solenoid (Solenoid &&)=default
Solenoidoperator= (Solenoid &&)=default
void Set (bool on)
 Set the value of a solenoid.
bool Get () const
 Read the current value of the solenoid.
void Toggle ()
 Toggle the value of the solenoid.
int GetChannel () const
 Get the channel this solenoid is connected to.
bool IsDisabled () const
 Check if solenoid is Disabled.
void SetPulseDuration (wpi::units::second_t duration)
 Set the pulse duration in the pneumatics module.
void StartPulse ()
 Trigger the pneumatics module to generate a pulse of the duration set in setPulseDuration.
void InitSendable (wpi::util::SendableBuilder &builder) override
 Initializes this Sendable object.
Public Member Functions inherited from wpi::util::Sendable
virtual constexpr ~Sendable ()=default
Public Member Functions inherited from wpi::util::SendableHelper< Solenoid >
constexpr SendableHelper (const SendableHelper &rhs)=default
constexpr SendableHelperoperator= (const SendableHelper &rhs)=default

Additional Inherited Members

Protected Member Functions inherited from wpi::util::SendableHelper< Solenoid >
constexpr ~SendableHelper ()

Detailed Description

Solenoid class for running high voltage Digital Output on a pneumatics module.

The Solenoid class is typically used for pneumatics solenoids, but could be used for any device within the current spec of the module.

Constructor & Destructor Documentation

◆ Solenoid() [1/3]

wpi::Solenoid::Solenoid ( int busId,
int module,
PneumaticsModuleType moduleType,
int channel )

Constructs a solenoid for a specified module and type.

Parameters
busIdThe bus ID.
moduleThe module ID to use.
moduleTypeThe module type to use.
channelThe channel the solenoid is on.

◆ Solenoid() [2/3]

wpi::Solenoid::Solenoid ( int busId,
PneumaticsModuleType moduleType,
int channel )

Constructs a solenoid for a default module and specified type.

Parameters
busIdThe bus ID.
moduleTypeThe module type to use.
channelThe channel the solenoid is on.

◆ ~Solenoid()

wpi::Solenoid::~Solenoid ( )
override

◆ Solenoid() [3/3]

wpi::Solenoid::Solenoid ( Solenoid && )
default

Member Function Documentation

◆ Get()

bool wpi::Solenoid::Get ( ) const

Read the current value of the solenoid.

Returns
The current value of the solenoid.

◆ GetChannel()

int wpi::Solenoid::GetChannel ( ) const

Get the channel this solenoid is connected to.

◆ InitSendable()

void wpi::Solenoid::InitSendable ( wpi::util::SendableBuilder & builder)
overridevirtual

Initializes this Sendable object.

Parameters
buildersendable builder

Implements wpi::util::Sendable.

◆ IsDisabled()

bool wpi::Solenoid::IsDisabled ( ) const

Check if solenoid is Disabled.

If a solenoid is shorted, it is added to the DisabledList and disabled until power cycle, or until faults are cleared.

See also
ClearAllPCMStickyFaults()
Returns
If solenoid is disabled due to short.

◆ operator=()

Solenoid & wpi::Solenoid::operator= ( Solenoid && )
default

◆ Set()

void wpi::Solenoid::Set ( bool on)

Set the value of a solenoid.

Parameters
onTurn the solenoid output off or on.

◆ SetPulseDuration()

void wpi::Solenoid::SetPulseDuration ( wpi::units::second_t duration)

Set the pulse duration in the pneumatics module.

This is used in conjunction with the startPulse method to allow the pneumatics module to control the timing of a pulse.

On the PCM, the timing can be controlled in 0.01 second increments, with a maximum of 2.55 seconds. On the PH, the timing can be controlled in 0.001 second increments, with a maximum of 65.534 seconds.

Parameters
durationThe duration of the pulse.
See also
startPulse()

◆ StartPulse()

void wpi::Solenoid::StartPulse ( )

Trigger the pneumatics module to generate a pulse of the duration set in setPulseDuration.

See also
setPulseDuration()

◆ Toggle()

void wpi::Solenoid::Toggle ( )

Toggle the value of the solenoid.

If the solenoid is set to on, it'll be turned off. If the solenoid is set to off, it'll be turned on.


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