WPILibC++ 2023.4.3-108-ge5452e3
frc::sim::PowerDistributionSim Class Reference

Class to control a simulated Power Distribution Panel (PowerDistribution). More...

#include <frc/simulation/PowerDistributionSim.h>

Public Member Functions

 PowerDistributionSim (int module=0)
 Constructs from a PowerDistribution module number (CAN ID). More...
 
 PowerDistributionSim (const PowerDistribution &pdp)
 Constructs from a PowerDistribution object. More...
 
std::unique_ptr< CallbackStoreRegisterInitializedCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run when the PowerDistribution is initialized. More...
 
bool GetInitialized () const
 Check whether the PowerDistribution has been initialized. More...
 
void SetInitialized (bool initialized)
 Define whether the PowerDistribution has been initialized. More...
 
std::unique_ptr< CallbackStoreRegisterTemperatureCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the PowerDistribution temperature changes. More...
 
double GetTemperature () const
 Check the temperature of the PowerDistribution. More...
 
void SetTemperature (double temperature)
 Define the PowerDistribution temperature. More...
 
std::unique_ptr< CallbackStoreRegisterVoltageCallback (NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the PowerDistribution voltage changes. More...
 
double GetVoltage () const
 Check the PowerDistribution voltage. More...
 
void SetVoltage (double voltage)
 Set the PowerDistribution voltage. More...
 
std::unique_ptr< CallbackStoreRegisterCurrentCallback (int channel, NotifyCallback callback, bool initialNotify)
 Register a callback to be run whenever the current of a specific channel changes. More...
 
double GetCurrent (int channel) const
 Read the current in one of the PowerDistribution channels. More...
 
void SetCurrent (int channel, double current)
 Change the current in the given channel. More...
 
void GetAllCurrents (double *currents, int length) const
 Read the current of all of the PowerDistribution channels. More...
 
void SetAllCurrents (const double *currents, int length)
 Change the current in all of the PowerDistribution channels. More...
 
void ResetData ()
 Reset all PowerDistribution simulation data. More...
 

Detailed Description

Class to control a simulated Power Distribution Panel (PowerDistribution).

Constructor & Destructor Documentation

◆ PowerDistributionSim() [1/2]

frc::sim::PowerDistributionSim::PowerDistributionSim ( int  module = 0)
explicit

Constructs from a PowerDistribution module number (CAN ID).

Parameters
modulemodule number

◆ PowerDistributionSim() [2/2]

frc::sim::PowerDistributionSim::PowerDistributionSim ( const PowerDistribution pdp)
explicit

Constructs from a PowerDistribution object.

Parameters
pdpPowerDistribution to simulate

Member Function Documentation

◆ GetAllCurrents()

void frc::sim::PowerDistributionSim::GetAllCurrents ( double *  currents,
int  length 
) const

Read the current of all of the PowerDistribution channels.

Parameters
currentsoutput array; set to the current in each channel. The array must be big enough to hold all the PowerDistribution channels
lengthlength of output array

◆ GetCurrent()

double frc::sim::PowerDistributionSim::GetCurrent ( int  channel) const

Read the current in one of the PowerDistribution channels.

Parameters
channelthe channel to check
Returns
the current in the given channel

◆ GetInitialized()

bool frc::sim::PowerDistributionSim::GetInitialized ( ) const

Check whether the PowerDistribution has been initialized.

Returns
true if initialized

◆ GetTemperature()

double frc::sim::PowerDistributionSim::GetTemperature ( ) const

Check the temperature of the PowerDistribution.

Returns
the PowerDistribution temperature

◆ GetVoltage()

double frc::sim::PowerDistributionSim::GetVoltage ( ) const

Check the PowerDistribution voltage.

Returns
the PowerDistribution voltage.

◆ RegisterCurrentCallback()

std::unique_ptr< CallbackStore > frc::sim::PowerDistributionSim::RegisterCurrentCallback ( int  channel,
NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the current of a specific channel changes.

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

◆ RegisterInitializedCallback()

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

Register a callback to be run when the PowerDistribution is initialized.

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

◆ RegisterTemperatureCallback()

std::unique_ptr< CallbackStore > frc::sim::PowerDistributionSim::RegisterTemperatureCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the PowerDistribution temperature changes.

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

◆ RegisterVoltageCallback()

std::unique_ptr< CallbackStore > frc::sim::PowerDistributionSim::RegisterVoltageCallback ( NotifyCallback  callback,
bool  initialNotify 
)

Register a callback to be run whenever the PowerDistribution voltage changes.

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

◆ ResetData()

void frc::sim::PowerDistributionSim::ResetData ( )

Reset all PowerDistribution simulation data.

◆ SetAllCurrents()

void frc::sim::PowerDistributionSim::SetAllCurrents ( const double *  currents,
int  length 
)

Change the current in all of the PowerDistribution channels.

Parameters
currentsarray containing the current values for each channel. The array must be big enough to hold all the PowerDistribution channels
lengthlength of array

◆ SetCurrent()

void frc::sim::PowerDistributionSim::SetCurrent ( int  channel,
double  current 
)

Change the current in the given channel.

Parameters
channelthe channel to edit
currentthe new current for the channel

◆ SetInitialized()

void frc::sim::PowerDistributionSim::SetInitialized ( bool  initialized)

Define whether the PowerDistribution has been initialized.

Parameters
initializedwhether this object is initialized

◆ SetTemperature()

void frc::sim::PowerDistributionSim::SetTemperature ( double  temperature)

Define the PowerDistribution temperature.

Parameters
temperaturethe new PowerDistribution temperature

◆ SetVoltage()

void frc::sim::PowerDistributionSim::SetVoltage ( double  voltage)

Set the PowerDistribution voltage.

Parameters
voltagethe new PowerDistribution voltage

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