WPILibC++ 2024.3.2
frc::sim::CTREPCMSim Class Reference

Class to control a simulated Pneumatic Control Module (PCM). More...

#include <frc/simulation/CTREPCMSim.h>

Inheritance diagram for frc::sim::CTREPCMSim:
frc::sim::PneumaticsBaseSim

Public Member Functions

 CTREPCMSim ()
 Constructs with the default PCM module number (CAN ID). More...
 
 CTREPCMSim (int module)
 Constructs from a PCM module number (CAN ID). More...
 
 CTREPCMSim (const PneumaticsBase &pneumatics)
 
 ~CTREPCMSim () override=default
 
std::unique_ptr< CallbackStoreRegisterInitializedCallback (NotifyCallback callback, bool initialNotify) override
 Register a callback to be run when the PCM/PH is initialized. More...
 
bool GetInitialized () const override
 Check whether the PCM/PH has been initialized. More...
 
void SetInitialized (bool initialized) override
 Define whether the PCM/PH has been initialized. More...
 
std::unique_ptr< CallbackStoreRegisterSolenoidOutputCallback (int channel, NotifyCallback callback, bool initialNotify) override
 Register a callback to be run when the solenoid output on a channel changes. More...
 
bool GetSolenoidOutput (int channel) const override
 Check the solenoid output on a specific channel. More...
 
void SetSolenoidOutput (int channel, bool solenoidOutput) override
 Change the solenoid output on a specific channel. More...
 
std::unique_ptr< CallbackStoreRegisterCompressorOnCallback (NotifyCallback callback, bool initialNotify) override
 Register a callback to be run when the compressor activates. More...
 
bool GetCompressorOn () const override
 Check if the compressor is on. More...
 
void SetCompressorOn (bool compressorOn) override
 Set whether the compressor is active. More...
 
std::unique_ptr< CallbackStoreRegisterClosedLoopEnabledCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the closed loop state changes. More...
 
bool GetClosedLoopEnabled () const
 Check whether the closed loop compressor control is active. More...
 
void SetClosedLoopEnabled (bool closedLoopEnabled)
 Turn on/off the closed loop control of the compressor. More...
 
std::unique_ptr< CallbackStoreRegisterPressureSwitchCallback (NotifyCallback callback, bool initialNotify) override
 Register a callback to be run whenever the pressure switch value changes. More...
 
bool GetPressureSwitch () const override
 Check the value of the pressure switch. More...
 
void SetPressureSwitch (bool pressureSwitch) override
 Set the value of the pressure switch. More...
 
std::unique_ptr< CallbackStoreRegisterCompressorCurrentCallback (NotifyCallback callback, bool initialNotify) override
 Register a callback to be run whenever the compressor current changes. More...
 
double GetCompressorCurrent () const override
 Read the compressor current. More...
 
void SetCompressorCurrent (double compressorCurrent) override
 Set the compressor current. More...
 
uint8_t GetAllSolenoidOutputs () const override
 Get the current value of all solenoid outputs. More...
 
void SetAllSolenoidOutputs (uint8_t outputs) override
 Change all of the solenoid outputs. More...
 
void ResetData () override
 Reset all simulation data for this object. More...
 
- Public Member Functions inherited from frc::sim::PneumaticsBaseSim
virtual ~PneumaticsBaseSim ()=default
 
virtual bool GetInitialized () const =0
 Check whether the PCM/PH has been initialized. More...
 
virtual void SetInitialized (bool initialized)=0
 Define whether the PCM/PH has been initialized. More...
 
virtual std::unique_ptr< CallbackStoreRegisterInitializedCallback (NotifyCallback callback, bool initialNotify)=0
 Register a callback to be run when the PCM/PH is initialized. More...
 
virtual bool GetCompressorOn () const =0
 Check if the compressor is on. More...
 
virtual void SetCompressorOn (bool compressorOn)=0
 Set whether the compressor is active. More...
 
virtual std::unique_ptr< CallbackStoreRegisterCompressorOnCallback (NotifyCallback callback, bool initialNotify)=0
 Register a callback to be run when the compressor activates. More...
 
virtual bool GetSolenoidOutput (int channel) const =0
 Check the solenoid output on a specific channel. More...
 
virtual void SetSolenoidOutput (int channel, bool solenoidOutput)=0
 Change the solenoid output on a specific channel. More...
 
virtual std::unique_ptr< CallbackStoreRegisterSolenoidOutputCallback (int channel, NotifyCallback callback, bool initialNotify)=0
 Register a callback to be run when the solenoid output on a channel changes. More...
 
virtual bool GetPressureSwitch () const =0
 Check the value of the pressure switch. More...
 
virtual void SetPressureSwitch (bool pressureSwitch)=0
 Set the value of the pressure switch. More...
 
virtual std::unique_ptr< CallbackStoreRegisterPressureSwitchCallback (NotifyCallback callback, bool initialNotify)=0
 Register a callback to be run whenever the pressure switch value changes. More...
 
virtual double GetCompressorCurrent () const =0
 Read the compressor current. More...
 
virtual void SetCompressorCurrent (double compressorCurrent)=0
 Set the compressor current. More...
 
virtual std::unique_ptr< CallbackStoreRegisterCompressorCurrentCallback (NotifyCallback callback, bool initialNotify)=0
 Register a callback to be run whenever the compressor current changes. More...
 
virtual uint8_t GetAllSolenoidOutputs () const =0
 Get the current value of all solenoid outputs. More...
 
virtual void SetAllSolenoidOutputs (uint8_t outputs)=0
 Change all of the solenoid outputs. More...
 
virtual void ResetData ()=0
 Reset all simulation data for this object. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from frc::sim::PneumaticsBaseSim
static std::shared_ptr< PneumaticsBaseSimGetForType (int module, PneumaticsModuleType type)
 
- Protected Member Functions inherited from frc::sim::PneumaticsBaseSim
 PneumaticsBaseSim (const int index)
 Constructs a PneumaticsBaseSim with the given index. More...
 
 PneumaticsBaseSim (const PneumaticsBase &module)
 Constructs a PneumaticsBaseSim for the given module. More...
 
- Protected Attributes inherited from frc::sim::PneumaticsBaseSim
const int m_index
 PneumaticsBase index. More...
 

Detailed Description

Class to control a simulated Pneumatic Control Module (PCM).

Constructor & Destructor Documentation

◆ CTREPCMSim() [1/3]

frc::sim::CTREPCMSim::CTREPCMSim ( )

Constructs with the default PCM module number (CAN ID).

◆ CTREPCMSim() [2/3]

frc::sim::CTREPCMSim::CTREPCMSim ( int  module)
explicit

Constructs from a PCM module number (CAN ID).

Parameters
modulemodule number

◆ CTREPCMSim() [3/3]

frc::sim::CTREPCMSim::CTREPCMSim ( const PneumaticsBase pneumatics)
explicit

◆ ~CTREPCMSim()

frc::sim::CTREPCMSim::~CTREPCMSim ( )
overridedefault

Member Function Documentation

◆ GetAllSolenoidOutputs()

uint8_t frc::sim::CTREPCMSim::GetAllSolenoidOutputs ( ) const
overridevirtual

Get the current value of all solenoid outputs.

Returns
the solenoid outputs (1 bit per output)

Implements frc::sim::PneumaticsBaseSim.

◆ GetClosedLoopEnabled()

bool frc::sim::CTREPCMSim::GetClosedLoopEnabled ( ) const

Check whether the closed loop compressor control is active.

Returns
true if active

◆ GetCompressorCurrent()

double frc::sim::CTREPCMSim::GetCompressorCurrent ( ) const
overridevirtual

Read the compressor current.

Returns
the current of the compressor connected to this module

Implements frc::sim::PneumaticsBaseSim.

◆ GetCompressorOn()

bool frc::sim::CTREPCMSim::GetCompressorOn ( ) const
overridevirtual

Check if the compressor is on.

Returns
true if the compressor is active

Implements frc::sim::PneumaticsBaseSim.

◆ GetInitialized()

bool frc::sim::CTREPCMSim::GetInitialized ( ) const
overridevirtual

Check whether the PCM/PH has been initialized.

Returns
true if initialized

Implements frc::sim::PneumaticsBaseSim.

◆ GetPressureSwitch()

bool frc::sim::CTREPCMSim::GetPressureSwitch ( ) const
overridevirtual

Check the value of the pressure switch.

Returns
the pressure switch value

Implements frc::sim::PneumaticsBaseSim.

◆ GetSolenoidOutput()

bool frc::sim::CTREPCMSim::GetSolenoidOutput ( int  channel) const
overridevirtual

Check the solenoid output on a specific channel.

Parameters
channelthe channel to check
Returns
the solenoid output

Implements frc::sim::PneumaticsBaseSim.

◆ RegisterClosedLoopEnabledCallback()

std::unique_ptr< CallbackStore > frc::sim::CTREPCMSim::RegisterClosedLoopEnabledCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the closed loop state changes.

Parameters
callbackthe callback
initialNotifywhether the callback should be called with the initial value
Returns
the CallbackStore object associated with this callback

◆ RegisterCompressorCurrentCallback()

std::unique_ptr< CallbackStore > frc::sim::CTREPCMSim::RegisterCompressorCurrentCallback ( NotifyCallback  callback,
bool  initialNotify 
)
overridevirtual

Register a callback to be run whenever the compressor current changes.

Parameters
callbackthe callback
initialNotifywhether to call the callback with the initial state
Returns
the CallbackStore object associated with this callback

Implements frc::sim::PneumaticsBaseSim.

◆ RegisterCompressorOnCallback()

std::unique_ptr< CallbackStore > frc::sim::CTREPCMSim::RegisterCompressorOnCallback ( NotifyCallback  callback,
bool  initialNotify 
)
overridevirtual

Register a callback to be run when the compressor activates.

Parameters
callbackthe callback
initialNotifywhether to run the callback with the initial state
Returns
the CallbackStore object associated with this callback. Save a reference to this object; it being deconstructed cancels the callback.

Implements frc::sim::PneumaticsBaseSim.

◆ RegisterInitializedCallback()

std::unique_ptr< CallbackStore > frc::sim::CTREPCMSim::RegisterInitializedCallback ( NotifyCallback  callback,
bool  initialNotify 
)
overridevirtual

Register a callback to be run when the PCM/PH is initialized.

Parameters
callbackthe callback
initialNotifywhether to run the callback with the initial state
Returns
the CallbackStore object associated with this callback. Save a reference to this object; it being deconstructed cancels the callback.

Implements frc::sim::PneumaticsBaseSim.

◆ RegisterPressureSwitchCallback()

std::unique_ptr< CallbackStore > frc::sim::CTREPCMSim::RegisterPressureSwitchCallback ( NotifyCallback  callback,
bool  initialNotify 
)
overridevirtual

Register a callback to be run whenever the pressure switch value changes.

Parameters
callbackthe callback
initialNotifywhether the callback should be called with the initial value
Returns
the CallbackStore object associated with this callback

Implements frc::sim::PneumaticsBaseSim.

◆ RegisterSolenoidOutputCallback()

std::unique_ptr< CallbackStore > frc::sim::CTREPCMSim::RegisterSolenoidOutputCallback ( int  channel,
NotifyCallback  callback,
bool  initialNotify 
)
overridevirtual

Register a callback to be run when the solenoid output on a channel changes.

Parameters
channelthe channel to monitor
callbackthe callback
initialNotifyshould the callback be run with the initial value
Returns
the CallbackStore object associated with this callback. Save a reference to this object; it being deconstructed cancels the callback.

Implements frc::sim::PneumaticsBaseSim.

◆ ResetData()

void frc::sim::CTREPCMSim::ResetData ( )
overridevirtual

Reset all simulation data for this object.

Implements frc::sim::PneumaticsBaseSim.

◆ SetAllSolenoidOutputs()

void frc::sim::CTREPCMSim::SetAllSolenoidOutputs ( uint8_t  outputs)
overridevirtual

Change all of the solenoid outputs.

Parameters
outputsthe new solenoid outputs (1 bit per output)

Implements frc::sim::PneumaticsBaseSim.

◆ SetClosedLoopEnabled()

void frc::sim::CTREPCMSim::SetClosedLoopEnabled ( bool  closedLoopEnabled)

Turn on/off the closed loop control of the compressor.

Parameters
closedLoopEnabledwhether the control loop is active

◆ SetCompressorCurrent()

void frc::sim::CTREPCMSim::SetCompressorCurrent ( double  compressorCurrent)
overridevirtual

Set the compressor current.

Parameters
compressorCurrentthe new compressor current

Implements frc::sim::PneumaticsBaseSim.

◆ SetCompressorOn()

void frc::sim::CTREPCMSim::SetCompressorOn ( bool  compressorOn)
overridevirtual

Set whether the compressor is active.

Parameters
compressorOnthe new value

Implements frc::sim::PneumaticsBaseSim.

◆ SetInitialized()

void frc::sim::CTREPCMSim::SetInitialized ( bool  initialized)
overridevirtual

Define whether the PCM/PH has been initialized.

Parameters
initializedtrue for initialized

Implements frc::sim::PneumaticsBaseSim.

◆ SetPressureSwitch()

void frc::sim::CTREPCMSim::SetPressureSwitch ( bool  pressureSwitch)
overridevirtual

Set the value of the pressure switch.

Parameters
pressureSwitchthe new value

Implements frc::sim::PneumaticsBaseSim.

◆ SetSolenoidOutput()

void frc::sim::CTREPCMSim::SetSolenoidOutput ( int  channel,
bool  solenoidOutput 
)
overridevirtual

Change the solenoid output on a specific channel.

Parameters
channelthe channel to check
solenoidOutputthe new solenoid output

Implements frc::sim::PneumaticsBaseSim.


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