Brick
Loading...
Searching...
No Matches
feedforward.h
Go to the documentation of this file.
1/**
2 * @file feedforward.h
3 * @brief A pure virual class to function as an interface for all feedforward control systems
4 *
5 * This is designed as an interface for any control systems to use so long as they have:
6 * An output of any type
7 * A reference state of any type
8 */
9
10#pragma once
11
12/**
13 * @brief pure virtual class for generic feedforward control systems.
14 *
15 * @param T the data type for states
16 * @param U the data type for output
17 */
18template <typename T, typename U>
20 public:
21 /// Resets the internal state of the control system
22 virtual void reset() = 0;
23 /**
24 * @brief Updates the control loop output
25 *
26 * @param reference the current reference state for the system
27 * @return the controller output
28 */
29 virtual U calculate(const T& reference) = 0;
30
31 /// Gets the last saved output value
32 U get_output() { return output_; }
33
34 /// Gets the currently stored reference state
35 T get_reference() { return reference_; }
36
37 U output_min_;
38 U output_max_;
39
40 protected:
41 T reference_;
42
43 U output_;
44};
pure virtual class for generic feedforward control systems.
Definition feedforward.h:19
virtual void reset()=0
Resets the internal state of the control system.
virtual U calculate(const T &reference)=0
Updates the control loop output.
T get_reference()
Gets the currently stored reference state.
Definition feedforward.h:35
U get_output()
Gets the last saved output value.
Definition feedforward.h:32