WPILibC++  2020.3.2
Filter.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2015-2019 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 <wpi/deprecated.h>
13 
14 #include "frc/PIDSource.h"
15 
16 namespace frc {
17 
21 class Filter : public PIDSource {
22  public:
23  WPI_DEPRECATED("This class is no longer used.")
24  explicit Filter(PIDSource& source);
25  WPI_DEPRECATED("This class is no longer used.")
26  explicit Filter(std::shared_ptr<PIDSource> source);
27  virtual ~Filter() = default;
28 
29  Filter(Filter&&) = default;
30  Filter& operator=(Filter&&) = default;
31 
32  // PIDSource interface
33  void SetPIDSourceType(PIDSourceType pidSource) override;
34  PIDSourceType GetPIDSourceType() const override;
35  double PIDGet() override = 0;
36 
43  virtual double Get() const = 0;
44 
48  virtual void Reset() = 0;
49 
50  protected:
56  double PIDGetSource();
57 
58  private:
59  std::shared_ptr<PIDSource> m_source;
60 };
61 
62 } // namespace frc
frc::PIDSource
PIDSource interface is a generic sensor source for the PID class.
Definition: PIDSource.h:20
frc::Filter::PIDGetSource
double PIDGetSource()
Calls PIDGet() of source.
frc::Filter::Get
virtual double Get() const =0
Returns the current filter estimate without also inserting new data as PIDGet() would do.
frc::Filter::Reset
virtual void Reset()=0
Reset the filter state.
frc
A class that enforces constraints on the differential drive kinematics.
Definition: SPIAccelerometerSim.h:16
frc::Filter
Interface for filters.
Definition: Filter.h:21
frc::Filter::SetPIDSourceType
void SetPIDSourceType(PIDSourceType pidSource) override
Set which parameter you are using as a process control variable.