|
Valkyrie 2026
|
#include <valkyrie/PowerDistribution.h>
Public Types | |
| enum class | ModuleType { kCTRE_PDP , kCTRE_PDP2_0 , kRev } |
Public Member Functions | |
| PowerDistribution () | |
| PowerDistribution (int module, ModuleType moduleType) | |
| int | GetNumChannels () const |
| units::volt_t | GetVoltage () const |
| units::celsius_t | GetTemperature () const |
| units::ampere_t | GetCurrent (int channel) const |
| std::vector< units::ampere_t > | GetAllCurrents () const |
| units::ampere_t | GetTotalCurrent () const |
| units::watt_t | GetTotalPower () const |
| units::joule_t | GetTotalEnergy () const |
| constexpr ModuleType | GetType () const |
| void | InitSendable (wpi::SendableBuilder &builder) override |
Class for getting voltage, current, temperature, power and energy from the CTRE Power Distribution Panel (PDP), CTRE PDP 2.0, or REV Power Distribution Hub (PDH).
The PDP 2.0 does not communicate with the RoboRIO. As a result, the only function that returns meaningful data for the PDP 2.0 is GetVoltage(), which returns the RoboRIO detected battery voltage. All other functions that would normally query PDP telemetry return default values or perform no operation.
|
strong |
| valor::PowerDistribution::PowerDistribution | ( | ) |
Constructs a PowerDistribution object.
Detects the connected PDP/PDH using the default CAN ID (0 for CTRE PDP and 1 for REV). If battery voltage is unreasonable (< 1 volt), it is assumed to be PDP 2.0 as the PDP 2.0 has no communication with the RIO
|
inline |
Constructs a PowerDistribution object.
| module | The CAN ID of the PDP/PDH (doesn't matter for the PDP 2.0) |
| moduleType | The type of module |
| std::vector< units::ampere_t > valor::PowerDistribution::GetAllCurrents | ( | ) | const |
Query all currents of the PDP. Not supported on the PDP 2.0 and returns a vector with all zeroes.
|
inline |
Query the current of a single channel of the PDP/PDH. Not supported on the PDP 2.0 and retursn 0.
| channel | the channel to query (0-15 for PDP, 0-23 for PDH) |
| int valor::PowerDistribution::GetNumChannels | ( | ) | const |
Gets the number of channels for this power distribution object.
|
inline |
Query the temperature of the PDP.
Not supported on the Rev PDH and returns 0. Not supported on the PDP 2.0 and returns 0.
|
inline |
Query the total current of all monitored PDP/PDH channels. Not supported on the PDP 2.0 and returns 0.
|
inline |
Query the total energy drawn from the monitored PDP channels.
Not supported on the Rev PDH and returns 0. Not supported on the PDP 2.0 and returns 0.
|
inline |
Query the total power drawn from all monitored PDP channels.
Not supported on the Rev PDH and returns 0. Not supported on the PDP 2.0 and returns 0.
|
inlineconstexpr |
Gets module type.
| units::volt_t valor::PowerDistribution::GetVoltage | ( | ) | const |
Query the input voltage of the PDP/PDH. Defaults to the RIO detected battery voltage on the PDP 2.0