WPILibC++  2020.3.2-60-g3011ebe
PowerDistributionPanel.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2014-2019 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <hal/Types.h>
11 
12 #include "frc/ErrorBase.h"
13 #include "frc/smartdashboard/Sendable.h"
14 #include "frc/smartdashboard/SendableHelper.h"
15 
16 namespace frc {
17 
18 class SendableBuilder;
19 
25  public Sendable,
26  public SendableHelper<PowerDistributionPanel> {
27  public:
29  explicit PowerDistributionPanel(int module);
30 
32  PowerDistributionPanel& operator=(PowerDistributionPanel&&) = default;
33 
39  double GetVoltage() const;
40 
46  double GetTemperature() const;
47 
53  double GetCurrent(int channel) const;
54 
60  double GetTotalCurrent() const;
61 
67  double GetTotalPower() const;
68 
74  double GetTotalEnergy() const;
75 
81  void ResetTotalEnergy();
82 
86  void ClearStickyFaults();
87 
88  void InitSendable(SendableBuilder& builder) override;
89 
90  private:
91  hal::Handle<HAL_PDPHandle> m_handle;
92 };
93 
94 } // namespace frc
frc::PowerDistributionPanel::GetTotalCurrent
double GetTotalCurrent() const
Query the total current of all monitored PDP channels (0-15).
frc::PowerDistributionPanel::ResetTotalEnergy
void ResetTotalEnergy()
Reset the total energy drawn from the PDP.
frc::PowerDistributionPanel::GetTotalPower
double GetTotalPower() const
Query the total power drawn from the monitored PDP channels.
frc::PowerDistributionPanel::GetVoltage
double GetVoltage() const
Query the input voltage of the PDP.
frc::PowerDistributionPanel
Class for getting voltage, current, temperature, power and energy from the CAN PDP.
Definition: PowerDistributionPanel.h:24
frc::ErrorBase
Base class for most objects.
Definition: ErrorBase.h:104
frc::PowerDistributionPanel::GetTemperature
double GetTemperature() const
Query the temperature of the PDP.
frc::PowerDistributionPanel::ClearStickyFaults
void ClearStickyFaults()
Remove all of the fault flags on the PDP.
frc::PowerDistributionPanel::GetCurrent
double GetCurrent(int channel) const
Query the current of a single channel of the PDP.
frc::Sendable
Interface for Sendable objects.
Definition: Sendable.h:17
frc::PowerDistributionPanel::InitSendable
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
frc
A class that enforces constraints on the differential drive kinematics.
Definition: PDPSim.h:16
frc::SendableHelper
A helper class for use with objects that add themselves to SendableRegistry.
Definition: SendableHelper.h:28
frc::PowerDistributionPanel::GetTotalEnergy
double GetTotalEnergy() const
Query the total energy drawn from the monitored PDP channels.
frc::SendableBuilder
Definition: SendableBuilder.h:23