[wpilib] Improve PowerDistribution docs (NFC) (#3925)

Add docs for switchable channel.
Use PDP/PDH appropriately and clarify differences.
Fix typos.
This commit is contained in:
sciencewhiz
2022-01-20 23:33:01 -08:00
committed by GitHub
parent 841174f302
commit debbd5ff4b
2 changed files with 61 additions and 38 deletions

View File

@@ -12,7 +12,7 @@ namespace frc {
/**
* Class for getting voltage, current, temperature, power and energy from the
* CAN PDP.
* CTRE Power Distribution Panel (PDP) or REV Power Distribution Hub (PDH).
*/
class PowerDistribution : public wpi::Sendable,
public wpi::SendableHelper<PowerDistribution> {
@@ -21,16 +21,17 @@ class PowerDistribution : public wpi::Sendable,
enum class ModuleType { kCTRE = 1, kRev = 2 };
/**
* Constructs a PowerDistribution.
* Constructs a PowerDistribution object.
*
* Uses the default CAN ID (0 for CTRE and 1 for REV).
* Detects the connected PDP/PDH using the default CAN ID (0 for CTRE and 1
* for REV).
*/
PowerDistribution();
/**
* Constructs a PowerDistribution.
* Constructs a PowerDistribution object.
*
* @param module The CAN ID of the PDP
* @param module The CAN ID of the PDP/PDH
* @param moduleType The type of module
*/
PowerDistribution(int module, ModuleType moduleType);
@@ -40,56 +41,57 @@ class PowerDistribution : public wpi::Sendable,
PowerDistribution& operator=(PowerDistribution&&) = default;
/**
* Query the input voltage of the PDP.
* Query the input voltage of the PDP/PDH.
*
* @return The voltage of the PDP in volts
* @return The input voltage in volts
*/
double GetVoltage() const;
/**
* Query the temperature of the PDP.
* Query the temperature of the PDP/PDH.
*
* @return The temperature of the PDP in degrees Celsius
* @return The temperature in degrees Celsius
*/
double GetTemperature() const;
/**
* Query the current of a single channel of the PDP.
* Query the current of a single channel of the PDP/PDH.
*
* @return The current of one of the PDP channels (channels 0-15) in Amperes
* @param channel the channel to query (0-15 for PDP, 0-23 for PDH)
* @return The current of the channel in Amperes
*/
double GetCurrent(int channel) const;
/**
* Query the total current of all monitored PDP channels (0-15).
* Query the total current of all monitored PDP/PDH channels.
*
* @return The the total current drawn from the PDP channels in Amperes
* @return The total current drawn from all channels in Amperes
*/
double GetTotalCurrent() const;
/**
* Query the total power drawn from the monitored PDP channels.
* Query the total power drawn from all monitored PDP/PDH channels.
*
* @return The the total power drawn from the PDP channels in Watts
* @return The total power drawn in Watts
*/
double GetTotalPower() const;
/**
* Query the total energy drawn from the monitored PDP channels.
* Query the total energy drawn from the monitored PDP/PDH channels.
*
* @return The the total energy drawn from the PDP channels in Joules
* @return The total energy drawn in Joules
*/
double GetTotalEnergy() const;
/**
* Reset the total energy drawn from the PDP.
* Reset the total energy drawn from the PDP/PDH.
*
* @see PowerDistribution#GetTotalEnergy
*/
void ResetTotalEnergy();
/**
* Remove all of the fault flags on the PDP.
* Remove all of the fault flags on the PDP/PDH.
*/
void ClearStickyFaults();
@@ -98,8 +100,19 @@ class PowerDistribution : public wpi::Sendable,
*/
int GetModule() const;
/**
* Gets whether the PDH switchable channel is turned on or off. Returns false
* with the CTRE PDP.
*
* @return The output state of the PDH switchable channel
*/
bool GetSwitchableChannel() const;
/**
* Sets the PDH switchable channel on or off. Does nothing with the CTRE PDP.
*
* @param enabled Whether to turn the PDH switchable channel on or off
*/
void SetSwitchableChannel(bool enabled);
struct Version {