blob: b9769ecbe9116ab8c4ab48d89869f49cf95f6d33 [file] [log] [blame]
Brian Silverman26e4e522015-12-17 01:56:40 -05001/*----------------------------------------------------------------------------*/
Brian Silverman1a675112016-02-20 20:42:49 -05002/* Copyright (c) FIRST 2014-2016. All Rights Reserved. */
Brian Silverman26e4e522015-12-17 01:56:40 -05003/* Open Source Software - may be modified and shared by FRC teams. The code */
Brian Silverman1a675112016-02-20 20:42:49 -05004/* must be accompanied by the FIRST BSD license file in the root directory of */
5/* the project. */
Brian Silverman26e4e522015-12-17 01:56:40 -05006/*----------------------------------------------------------------------------*/
7
8#pragma once
9#ifndef __WPILIB_POWER_DISTRIBUTION_PANEL_H__
10#define __WPILIB_POWER_DISTRIBUTION_PANEL_H__
11
12#include "SensorBase.h"
13#include "LiveWindow/LiveWindowSendable.h"
14
15#include <memory>
16
17/**
18 * Class for getting voltage, current, temperature, power and energy from the
19 * CAN PDP.
20 * @author Thomas Clark
21 */
22class PowerDistributionPanel : public SensorBase, public LiveWindowSendable {
23 public:
24 PowerDistributionPanel();
25 PowerDistributionPanel(uint8_t module);
26
27 double GetVoltage() const;
28 double GetTemperature() const;
29 double GetCurrent(uint8_t channel) const;
30 double GetTotalCurrent() const;
31 double GetTotalPower() const;
32 double GetTotalEnergy() const;
33 void ResetTotalEnergy();
34 void ClearStickyFaults();
35
36 void UpdateTable() override;
37 void StartLiveWindowMode() override;
38 void StopLiveWindowMode() override;
39 std::string GetSmartDashboardType() const override;
40 void InitTable(std::shared_ptr<ITable> subTable) override;
41 std::shared_ptr<ITable> GetTable() const override;
42
43 private:
44 std::shared_ptr<ITable> m_table;
45 uint8_t m_module;
46};
47
48#endif /* __WPILIB_POWER_DISTRIBUTION_PANEL_H__ */