WPILibC++  unspecified
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Pages
Filter.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) FIRST 2015-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 #pragma once
9 
10 #include <memory>
11 
12 #include "PIDSource.h"
13 
14 namespace frc {
15 
19 class Filter : public PIDSource {
20  public:
21  explicit Filter(std::shared_ptr<PIDSource> source);
22  virtual ~Filter() = default;
23 
24  // PIDSource interface
25  void SetPIDSourceType(PIDSourceType pidSource) override;
26  PIDSourceType GetPIDSourceType() const;
27  double PIDGet() override = 0;
28 
35  virtual double Get() const = 0;
36 
40  virtual void Reset() = 0;
41 
42  protected:
48  double PIDGetSource();
49 
50  private:
51  std::shared_ptr<PIDSource> m_source;
52 };
53 
54 } // namespace frc
PIDSource interface is a generic sensor source for the PID class.
Definition: PIDSource.h:19
virtual double Get() const =0
Returns the current filter estimate without also inserting new data as PIDGet() would do...
double PIDGetSource()
Calls PIDGet() of source.
Definition: Filter.cpp:22
void SetPIDSourceType(PIDSourceType pidSource) override
Set which parameter you are using as a process control variable.
Definition: Filter.cpp:14
virtual void Reset()=0
Reset the filter state.
Interface for filters.
Definition: Filter.h:19