Class for getting voltage, current, temperature, power and energy from the CTRE Power Distribution Panel (PDP) or REV Power Distribution Hub (PDH).
More...
#include <wpi/hardware/power/PowerDistribution.hpp>
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]
| wpi::PowerDistribution::PowerDistribution |
( |
int | busId | ) |
|
|
explicit |
Constructs a PowerDistribution object.
Detects the connected PDP/PDH using the default CAN ID (0 for CTRE and 1 for REV).
- Parameters
-
◆ PowerDistribution() [2/3]
| wpi::PowerDistribution::PowerDistribution |
( |
int | busId, |
|
|
int | module, |
|
|
ModuleType | moduleType ) |
Constructs a PowerDistribution object.
- Parameters
-
| busId | The bus ID. |
| module | The CAN ID of the PDP/PDH |
| moduleType | The type of module |
◆ PowerDistribution() [3/3]
| wpi::PowerDistribution::PowerDistribution |
( |
PowerDistribution && | | ) |
|
|
default |
◆ ~PowerDistribution()
| wpi::PowerDistribution::~PowerDistribution |
( |
| ) |
|
|
overridedefault |
◆ ClearStickyFaults()
| void wpi::PowerDistribution::ClearStickyFaults |
( |
| ) |
|
Remove all of the fault flags on the PDP/PDH.
◆ GetAllCurrents()
| std::vector< double > wpi::PowerDistribution::GetAllCurrents |
( |
| ) |
const |
Query all currents of the PDP.
- Returns
- The current of each channel in Amperes
◆ GetCurrent()
| double wpi::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 wpi::PowerDistribution::GetFaults |
( |
| ) |
const |
Returns the power distribution faults.
On a CTRE PDP, this will return an object with no faults active.
- Returns
- The power distribution faults.
◆ GetModule()
| int wpi::PowerDistribution::GetModule |
( |
| ) |
const |
Gets module number (CAN ID).
◆ GetNumChannels()
| int wpi::PowerDistribution::GetNumChannels |
( |
| ) |
const |
Gets the number of channels for this power distribution object.
- Returns
- Number of output channels (16 for PDP, 24 for PDH).
◆ GetStickyFaults()
| StickyFaults wpi::PowerDistribution::GetStickyFaults |
( |
| ) |
const |
Returns the power distribution sticky faults.
On a CTRE PDP, this will return an object with no faults active.
- Returns
- The power distribution sticky faults.
◆ GetSwitchableChannel()
| bool wpi::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 wpi::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 wpi::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 wpi::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 wpi::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 wpi::PowerDistribution::GetType |
( |
| ) |
const |
◆ GetVersion()
| Version wpi::PowerDistribution::GetVersion |
( |
| ) |
const |
◆ GetVoltage()
| double wpi::PowerDistribution::GetVoltage |
( |
| ) |
const |
Query the input voltage of the PDP/PDH.
- Returns
- The input voltage in volts
◆ InitSendable()
◆ operator=()
◆ ResetTotalEnergy()
| void wpi::PowerDistribution::ResetTotalEnergy |
( |
| ) |
|
◆ SetSwitchableChannel()
| void wpi::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
| int wpi::PowerDistribution::kDefaultModule = -1 |
|
staticconstexpr |
The documentation for this class was generated from the following file: