1 | /* |
---|
2 | * esc.h |
---|
3 | * |
---|
4 | * Created on: Jul 26, 2012 |
---|
5 | * Author: Berk Calli, Wouter Caarls |
---|
6 | * Organization: Delft Biorobotics Lab., Delft University of Technology |
---|
7 | * Contact info: b.calli@tudelft.nl, web: www.dbl.tudelft.nl |
---|
8 | * |
---|
9 | * Superclass for extremum seeking control algorithms |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef ESC_H_ |
---|
13 | #define ESC_H_ |
---|
14 | #include <vector> |
---|
15 | #include <string> |
---|
16 | #define PI 3.141592654 |
---|
17 | |
---|
18 | /// Superclass for extremum seeking control algorithms. |
---|
19 | class ESC |
---|
20 | { |
---|
21 | public: |
---|
22 | /// Controller input type |
---|
23 | enum inputType |
---|
24 | { |
---|
25 | inputStateValue, ///< State-value input. |
---|
26 | inputValue ///< Value input. |
---|
27 | }; |
---|
28 | |
---|
29 | /// Controller output type. |
---|
30 | enum outputType |
---|
31 | { |
---|
32 | outputVelocity, ///< Velocity reference output. |
---|
33 | outputPosition ///< Position reference output. |
---|
34 | }; |
---|
35 | |
---|
36 | public: |
---|
37 | virtual ~ESC() { } |
---|
38 | |
---|
39 | /// Get internal monitor variable names. |
---|
40 | virtual std::vector<std::string> monitorNames() { return std::vector<std::string>(); } |
---|
41 | |
---|
42 | /// Get internal monitor variables. |
---|
43 | virtual std::vector<double> monitor() { return std::vector<double>(); } |
---|
44 | |
---|
45 | /// Get controller input type. |
---|
46 | virtual inputType getInputType() = 0; |
---|
47 | |
---|
48 | /// Get controller output type. |
---|
49 | virtual outputType getOutputType() = 0; |
---|
50 | |
---|
51 | /// Control step function for value-input control algorithms. |
---|
52 | virtual std::vector<double> step(std::vector<double> state, double obj_val) |
---|
53 | { |
---|
54 | return step(obj_val); |
---|
55 | } |
---|
56 | |
---|
57 | /// Control step function for state-input control algorithms. |
---|
58 | virtual std::vector<double> step(double obj_val) |
---|
59 | { |
---|
60 | return std::vector<double>(); |
---|
61 | } |
---|
62 | |
---|
63 | /// Reset control algorithm to initial conditions. |
---|
64 | virtual void reset() = 0; |
---|
65 | |
---|
66 | /// Reset control algorithm to initial conditions. |
---|
67 | virtual bool isStoppingConditionsMet(){ |
---|
68 | return false; |
---|
69 | } |
---|
70 | }; |
---|
71 | |
---|
72 | #endif /* ESC_H_ */ |
---|