Class for getting voltage, current, temperature, power and energy from the CTRE Power Distribution Panel (PDP) or REV Power Distribution Hub (PDH).
More...
#include <frc/PowerDistribution.h>
Class for getting voltage, current, temperature, power and energy from the CTRE Power Distribution Panel (PDP) or REV Power Distribution Hub (PDH).
◆ ModuleType
Power distribution module type.
Enumerator |
---|
kCTRE | CTRE (Cross The Road Electronics) CTRE Power Distribution Panel (PDP).
|
kRev | REV Power Distribution Hub (PDH).
|
◆ PowerDistribution() [1/3]
frc::PowerDistribution::PowerDistribution |
( |
| ) |
|
Constructs a PowerDistribution object.
Detects the connected PDP/PDH using the default CAN ID (0 for CTRE and 1 for REV).
◆ PowerDistribution() [2/3]
frc::PowerDistribution::PowerDistribution |
( |
int |
module, |
|
|
ModuleType |
moduleType |
|
) |
| |
Constructs a PowerDistribution object.
- Parameters
-
module | The CAN ID of the PDP/PDH |
moduleType | The type of module |
◆ ~PowerDistribution()
frc::PowerDistribution::~PowerDistribution |
( |
| ) |
|
|
override |
◆ PowerDistribution() [3/3]
◆ ClearStickyFaults()
void frc::PowerDistribution::ClearStickyFaults |
( |
| ) |
|
Remove all of the fault flags on the PDP/PDH.
◆ GetCurrent()
double frc::PowerDistribution::GetCurrent |
( |
int |
channel | ) |
const |
Query the current of a single channel of the PDP/PDH.
- Parameters
-
channel | the channel to query (0-15 for PDP, 0-23 for PDH) |
- Returns
- The current of the channel in Amperes
◆ GetFaults()
Faults frc::PowerDistribution::GetFaults |
( |
| ) |
const |
Returns the power distribution faults.
- Returns
- The power distribution faults.
◆ GetModule()
int frc::PowerDistribution::GetModule |
( |
| ) |
const |
Gets module number (CAN ID).
◆ GetStickyFaults()
StickyFaults frc::PowerDistribution::GetStickyFaults |
( |
| ) |
const |
Returns the power distribution sticky faults.
- Returns
- The power distribution sticky faults.
◆ GetSwitchableChannel()
bool frc::PowerDistribution::GetSwitchableChannel |
( |
| ) |
const |
Gets whether the PDH switchable channel is turned on or off.
Returns false with the CTRE PDP.
- Returns
- The output state of the PDH switchable channel
◆ GetTemperature()
double frc::PowerDistribution::GetTemperature |
( |
| ) |
const |
Query the temperature of the PDP.
Not supported on the Rev PDH and returns 0.
- Returns
- The temperature in degrees Celsius
◆ GetTotalCurrent()
double frc::PowerDistribution::GetTotalCurrent |
( |
| ) |
const |
Query the total current of all monitored PDP/PDH channels.
- Returns
- The total current drawn from all channels in Amperes
◆ GetTotalEnergy()
double frc::PowerDistribution::GetTotalEnergy |
( |
| ) |
const |
Query the total energy drawn from the monitored PDP channels.
Not supported on the Rev PDH and returns 0.
- Returns
- The total energy drawn in Joules
◆ GetTotalPower()
double frc::PowerDistribution::GetTotalPower |
( |
| ) |
const |
Query the total power drawn from all monitored PDP channels.
Not supported on the Rev PDH and returns 0.
- Returns
- The total power drawn in Watts
◆ GetType()
ModuleType frc::PowerDistribution::GetType |
( |
| ) |
const |
◆ GetVersion()
Version frc::PowerDistribution::GetVersion |
( |
| ) |
const |
◆ GetVoltage()
double frc::PowerDistribution::GetVoltage |
( |
| ) |
const |
Query the input voltage of the PDP/PDH.
- Returns
- The input voltage in volts
◆ InitSendable()
Initializes this Sendable object.
- Parameters
-
Implements wpi::Sendable.
◆ operator=()
◆ ResetTotalEnergy()
void frc::PowerDistribution::ResetTotalEnergy |
( |
| ) |
|
◆ SetSwitchableChannel()
void frc::PowerDistribution::SetSwitchableChannel |
( |
bool |
enabled | ) |
|
Sets the PDH switchable channel on or off.
Does nothing with the CTRE PDP.
- Parameters
-
enabled | Whether to turn the PDH switchable channel on or off |
◆ kDefaultModule
constexpr int frc::PowerDistribution::kDefaultModule = -1 |
|
staticconstexpr |
The documentation for this class was generated from the following file: