WPILibC++  unspecified
PowerDistributionPanel.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2014-2017 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 <memory>
11 #include <string>
12 
13 #include "LiveWindow/LiveWindowSendable.h"
14 #include "SensorBase.h"
15 #include "networktables/NetworkTableEntry.h"
16 
17 namespace frc {
18 
24  public:
26  explicit PowerDistributionPanel(int module);
27 
28  double GetVoltage() const;
29  double GetTemperature() const;
30  double GetCurrent(int channel) const;
31  double GetTotalCurrent() const;
32  double GetTotalPower() const;
33  double GetTotalEnergy() const;
34  void ResetTotalEnergy();
35  void ClearStickyFaults();
36 
37  void UpdateTable() override;
38  void StartLiveWindowMode() override;
39  void StopLiveWindowMode() override;
40  std::string GetSmartDashboardType() const override;
41  void InitTable(std::shared_ptr<nt::NetworkTable> subTable) override;
42 
43  private:
44  nt::NetworkTableEntry m_chanEntry[16];
45  nt::NetworkTableEntry m_voltageEntry;
46  nt::NetworkTableEntry m_totalCurrentEntry;
47  int m_module;
48 };
49 
50 } // namespace frc
double GetVoltage() const
Query the input voltage of the PDP.
Definition: PowerDistributionPanel.cpp:42
Definition: Timer.cpp:18
double GetCurrent(int channel) const
Query the current of a single channel of the PDP.
Definition: PowerDistributionPanel.cpp:76
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:17
Base class for all sensors.
Definition: SensorBase.h:20
double GetTemperature() const
Query the temperature of the PDP.
Definition: PowerDistributionPanel.cpp:59
void ResetTotalEnergy()
Reset the total energy drawn from the PDP.
Definition: PowerDistributionPanel.cpp:151
void ClearStickyFaults()
Remove all of the fault flags on the PDP.
Definition: PowerDistributionPanel.cpp:164
std::string GetSmartDashboardType() const override
Definition: PowerDistributionPanel.cpp:186
void StopLiveWindowMode() override
Stop having this sendable object automatically respond to value changes.
Definition: PowerDistributionPanel.cpp:184
double GetTotalPower() const
Query the total power drawn from the monitored PDP channels.
Definition: PowerDistributionPanel.cpp:117
double GetTotalCurrent() const
Query the total current of all monitored PDP channels (0-15).
Definition: PowerDistributionPanel.cpp:100
NetworkTables Entry.
Definition: NetworkTableEntry.h:30
void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: PowerDistributionPanel.cpp:174
Class for getting voltage, current, temperature, power and energy from the CAN PDP.
Definition: PowerDistributionPanel.h:23
void StartLiveWindowMode() override
Start having this sendable object automatically respond to value changes reflect the value on the tab...
Definition: PowerDistributionPanel.cpp:182
double GetTotalEnergy() const
Query the total energy drawn from the monitored PDP channels.
Definition: PowerDistributionPanel.cpp:134
void InitTable(std::shared_ptr< nt::NetworkTable > subTable) override
Initializes a table for this sendable object.
Definition: PowerDistributionPanel.cpp:190