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 #include "PIDSource.h"
12 
16 class Filter : public PIDSource {
17  public:
18  Filter(std::shared_ptr<PIDSource> source);
19  virtual ~Filter() = default;
20 
21  // PIDSource interface
22  virtual void SetPIDSourceType(PIDSourceType pidSource) override;
23  PIDSourceType GetPIDSourceType() const;
24  virtual double PIDGet() override = 0;
25 
32  virtual double Get() const = 0;
33 
37  virtual void Reset() = 0;
38 
39  protected:
45  double PIDGetSource();
46 
47  private:
48  std::shared_ptr<PIDSource> m_source;
49 };
virtual void SetPIDSourceType(PIDSourceType pidSource) override
Set which parameter you are using as a process control variable.
Definition: Filter.cpp:14
Interface for filters.
Definition: Filter.h:16
double PIDGetSource()
Calls PIDGet() of source.
Definition: Filter.cpp:22
PIDSource interface is a generic sensor source for the PID class.
Definition: PIDSource.h:18
virtual void Reset()=0
Reset the filter state.
virtual double Get() const =0
Returns the current filter estimate without also inserting new data as PIDGet() would do...