WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
AnalogPotentiometer.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2016. 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 #include "AnalogInput.h"
9 #include "interfaces/Potentiometer.h"
10 #include "LiveWindow/LiveWindowSendable.h"
11 
12 #include <memory>
13 
24  public:
43  explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
44  double offset = 0.0);
45 
46  explicit AnalogPotentiometer(AnalogInput *input, double fullRange = 1.0,
47  double offset = 0.0);
48 
49  explicit AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
50  double fullRange = 1.0, double offset = 0.0);
51 
52  virtual ~AnalogPotentiometer() = default;
53 
59  virtual double Get() const override;
60 
66  virtual double PIDGet() override;
67 
68  /*
69  * Live Window code, only does anything if live window is activated.
70  */
71  virtual std::string GetSmartDashboardType() const override;
72  virtual void InitTable(std::shared_ptr<ITable> subtable) override;
73  virtual void UpdateTable() override;
74  virtual std::shared_ptr<ITable> GetTable() const override;
75 
80  virtual void StartLiveWindowMode() override {}
81 
86  virtual void StopLiveWindowMode() override {}
87 
88  private:
89  std::shared_ptr<AnalogInput> m_analog_input;
90  double m_fullRange, m_offset;
91  std::shared_ptr<ITable> m_table;
92 };
Live Window Sendable is a special type of object sendable to the live window.
Definition: LiveWindowSendable.h:18
virtual std::string GetSmartDashboardType() const override
Definition: AnalogPotentiometer.cpp:76
virtual void StopLiveWindowMode() override
AnalogPotentiometers don't have to do anything special when exiting the LiveWindow.
Definition: AnalogPotentiometer.h:86
virtual double Get() const override
Get the current reading of the potentiomer.
Definition: AnalogPotentiometer.cpp:60
virtual void InitTable(std::shared_ptr< ITable > subtable) override
Live Window code, only does anything if live window is activated.
Definition: AnalogPotentiometer.cpp:83
Class for reading analog potentiometers.
Definition: AnalogPotentiometer.h:23
Interface for potentiometers.
Definition: Potentiometer.h:16
AnalogPotentiometer(int channel, double fullRange=1.0, double offset=0.0)
AnalogPotentiometer constructor.
Definition: AnalogPotentiometer.cpp:20
Analog input class.
Definition: AnalogInput.h:32
virtual double PIDGet() override
Implement the PIDSource interface.
Definition: AnalogPotentiometer.cpp:71
virtual void StartLiveWindowMode() override
AnalogPotentiometers don't have to do anything special when entering the LiveWindow.
Definition: AnalogPotentiometer.h:80
virtual void UpdateTable() override
Update the table for this sendable object with the latest values.
Definition: AnalogPotentiometer.cpp:88
virtual std::shared_ptr< ITable > GetTable() const override
Definition: AnalogPotentiometer.cpp:94