[hal] Rename PowerDistributionPanel to PowerDistribution (#3466)

Makes HAL more generic for the PDP, to enable the Rev PDH in the future.
This commit is contained in:
Thad House
2021-08-04 20:31:17 -07:00
committed by GitHub
parent 2014115bca
commit 1ac73a247e
50 changed files with 1612 additions and 1177 deletions

View File

@@ -14,26 +14,25 @@ namespace frc {
* Class for getting voltage, current, temperature, power and energy from the
* CAN PDP.
*/
class PowerDistributionPanel
: public wpi::Sendable,
public wpi::SendableHelper<PowerDistributionPanel> {
class PowerDistribution : public wpi::Sendable,
public wpi::SendableHelper<PowerDistribution> {
public:
/**
* Constructs a PowerDistributionPanel.
* Constructs a PowerDistribution.
*
* Uses the default CAN ID (0).
*/
PowerDistributionPanel();
PowerDistribution();
/**
* Constructs a PowerDistributionPanel.
* Constructs a PowerDistribution.
*
* @param module The CAN ID of the PDP
*/
explicit PowerDistributionPanel(int module);
explicit PowerDistribution(int module);
PowerDistributionPanel(PowerDistributionPanel&&) = default;
PowerDistributionPanel& operator=(PowerDistributionPanel&&) = default;
PowerDistribution(PowerDistribution&&) = default;
PowerDistribution& operator=(PowerDistribution&&) = default;
/**
* Query the input voltage of the PDP.
@@ -80,7 +79,7 @@ class PowerDistributionPanel
/**
* Reset the total energy drawn from the PDP.
*
* @see PowerDistributionPanel#GetTotalEnergy
* @see PowerDistribution#GetTotalEnergy
*/
void ResetTotalEnergy();

View File

@@ -160,8 +160,8 @@ enum class BuiltInWidgets {
*/
kVoltageView,
/**
* Displays a PowerDistributionPanel. <br>Supported types: <ul> <li>
* PowerDistributionPanel</li>
* Displays a PowerDistribution. <br>Supported types: <ul> <li>
* PowerDistribution</li>
* </ul>
* <br>Custom properties:
* <table>
@@ -170,7 +170,7 @@ enum class BuiltInWidgets {
* <td>Whether or not to display the voltage and current draw</td></tr>
* </table>
*/
kPowerDistributionPanel,
kPowerDistribution,
/**
* Displays a SendableChooser with a dropdown combo box with a list of
* options.

View File

@@ -10,31 +10,31 @@
namespace frc {
class PowerDistributionPanel;
class PowerDistribution;
namespace sim {
/**
* Class to control a simulated Power Distribution Panel (PDP).
* Class to control a simulated Power Distribution Panel (PowerDistribution).
*/
class PDPSim {
class PowerDistributionSim {
public:
/**
* Constructs from a PDP module number (CAN ID).
* Constructs from a PowerDistribution module number (CAN ID).
*
* @param module module number
*/
explicit PDPSim(int module = 0);
explicit PowerDistributionSim(int module = 0);
/**
* Constructs from a PowerDistributionPanel object.
* Constructs from a PowerDistribution object.
*
* @param pdp PowerDistributionPanel to simulate
* @param pdp PowerDistribution to simulate
*/
explicit PDPSim(const PowerDistributionPanel& pdp);
explicit PowerDistributionSim(const PowerDistribution& pdp);
/**
* Register a callback to be run when the PDP is initialized.
* Register a callback to be run when the PowerDistribution is initialized.
*
* @param callback the callback
* @param initialNotify whether to run the callback with the initial state
@@ -44,21 +44,22 @@ class PDPSim {
NotifyCallback callback, bool initialNotify);
/**
* Check whether the PDP has been initialized.
* Check whether the PowerDistribution has been initialized.
*
* @return true if initialized
*/
bool GetInitialized() const;
/**
* Define whether the PDP has been initialized.
* Define whether the PowerDistribution has been initialized.
*
* @param initialized whether this object is initialized
*/
void SetInitialized(bool initialized);
/**
* Register a callback to be run whenever the PDP temperature changes.
* Register a callback to be run whenever the PowerDistribution temperature
* changes.
*
* @param callback the callback
* @param initialNotify whether to call the callback with the initial state
@@ -68,21 +69,22 @@ class PDPSim {
NotifyCallback callback, bool initialNotify);
/**
* Check the temperature of the PDP.
* Check the temperature of the PowerDistribution.
*
* @return the PDP temperature
* @return the PowerDistribution temperature
*/
double GetTemperature() const;
/**
* Define the PDP temperature.
* Define the PowerDistribution temperature.
*
* @param temperature the new PDP temperature
* @param temperature the new PowerDistribution temperature
*/
void SetTemperature(double temperature);
/**
* Register a callback to be run whenever the PDP voltage changes.
* Register a callback to be run whenever the PowerDistribution voltage
* changes.
*
* @param callback the callback
* @param initialNotify whether to call the callback with the initial state
@@ -92,16 +94,16 @@ class PDPSim {
NotifyCallback callback, bool initialNotify);
/**
* Check the PDP voltage.
* Check the PowerDistribution voltage.
*
* @return the PDP voltage.
* @return the PowerDistribution voltage.
*/
double GetVoltage() const;
/**
* Set the PDP voltage.
* Set the PowerDistribution voltage.
*
* @param voltage the new PDP voltage
* @param voltage the new PowerDistribution voltage
*/
void SetVoltage(double voltage);
@@ -118,7 +120,7 @@ class PDPSim {
int channel, NotifyCallback callback, bool initialNotify);
/**
* Read the current in one of the PDP channels.
* Read the current in one of the PowerDistribution channels.
*
* @param channel the channel to check
* @return the current in the given channel
@@ -134,23 +136,25 @@ class PDPSim {
void SetCurrent(int channel, double current);
/**
* Read the current of all of the PDP channels.
* Read the current of all of the PowerDistribution channels.
*
* @param currents output array; set to the current in each channel. The
* array must be big enough to hold all the PDP channels
* array must be big enough to hold all the PowerDistribution
* channels
*/
void GetAllCurrents(double* currents) const;
/**
* Change the current in all of the PDP channels.
* Change the current in all of the PowerDistribution channels.
*
* @param currents array containing the current values for each channel. The
* array must be big enough to hold all the PDP channels
* array must be big enough to hold all the PowerDistribution
* channels
*/
void SetAllCurrents(const double* currents);
/**
* Reset all PDP simulation data.
* Reset all PowerDistribution simulation data.
*/
void ResetData();