WPILibC++  unspecified
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 "AnalogInput.h"
13 #include "SensorBase.h"
14 #include "interfaces/Potentiometer.h"
15 
16 namespace frc {
17 
25  public:
44  explicit AnalogPotentiometer(int channel, double fullRange = 1.0,
45  double offset = 0.0);
46 
47  explicit AnalogPotentiometer(AnalogInput* input, double fullRange = 1.0,
48  double offset = 0.0);
49 
50  explicit AnalogPotentiometer(std::shared_ptr<AnalogInput> input,
51  double fullRange = 1.0, double offset = 0.0);
52 
53  ~AnalogPotentiometer() override = default;
54 
60  double Get() const override;
61 
67  double PIDGet() override;
68 
69  void InitSendable(SendableBuilder& builder) override;
70 
71  private:
72  std::shared_ptr<AnalogInput> m_analog_input;
73  double m_fullRange, m_offset;
74 };
75 
76 } // namespace frc
AnalogPotentiometer(int channel, double fullRange=1.0, double offset=0.0)
AnalogPotentiometer constructor.
Definition: AnalogPotentiometer.cpp:25
Definition: RobotController.cpp:14
double PIDGet() override
Implement the PIDSource interface.
Definition: AnalogPotentiometer.cpp:80
Base class for all sensors.
Definition: SensorBase.h:25
void InitSendable(SendableBuilder &builder) override
Live Window code, only does anything if live window is activated.
Definition: AnalogPotentiometer.cpp:85
double Get() const override
Get the current reading of the potentiomer.
Definition: AnalogPotentiometer.cpp:69
Class for reading analog potentiometers.
Definition: AnalogPotentiometer.h:24
Interface for potentiometers.
Definition: Potentiometer.h:17
Definition: SendableBuilder.h:23
Analog input class.
Definition: AnalogInput.h:31