WPILibC++  2019.4.1-5-gaab4c49
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
AnalogPotentiometer.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2016-2018 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 
12 #include "frc/AnalogInput.h"
13 #include "frc/ErrorBase.h"
14 #include "frc/interfaces/Potentiometer.h"
15 #include "frc/smartdashboard/SendableBase.h"
16 
17 namespace frc {
18 
26  public SendableBase,
27  public Potentiometer {
28  public:
48  explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
49  double offset = 0.0);
50 
70  explicit AnalogPotentiometer(AnalogInput* input, double fullRange = 1.0,
71  double offset = 0.0);
72 
92  explicit AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
93  double fullRange = 1.0, double offset = 0.0);
94 
95  ~AnalogPotentiometer() override = default;
96 
98  AnalogPotentiometer& operator=(AnalogPotentiometer&&) = default;
99 
106  double Get() const override;
107 
113  double PIDGet() override;
114 
115  void InitSendable(SendableBuilder& builder) override;
116 
117  private:
118  std::shared_ptr<AnalogInput> m_analog_input;
119  double m_fullRange, m_offset;
120 };
121 
122 } // namespace frc
WPILib FRC namespace.
Definition: SPIAccelerometerSim.h:18
AnalogPotentiometer(int channel, double fullRange=1.0, double offset=0.0)
Construct an Analog Potentiometer object from a channel number.
Class for reading analog potentiometers.
Definition: AnalogPotentiometer.h:25
Base class for most objects.
Definition: ErrorBase.h:74
Definition: SendableBase.h:19
Interface for potentiometers.
Definition: Potentiometer.h:17
void InitSendable(SendableBuilder &builder) override
Initializes this Sendable object.
Definition: SendableBuilder.h:23
double PIDGet() override
Implement the PIDSource interface.
double Get() const override
Get the current reading of the potentiomer.
Analog input class.
Definition: AnalogInput.h:32