| [5] | 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 |
|---|
| [13] | 17 | |
|---|
| 18 | /// Superclass for extremum seeking control algorithms. |
|---|
| [5] | 19 | class ESC |
|---|
| 20 | { |
|---|
| [13] | 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 | |
|---|
| [5] | 36 | public: |
|---|
| [13] | 37 | virtual ~ESC() { } |
|---|
| [5] | 38 | |
|---|
| [13] | 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>(); } |
|---|
| [5] | 44 | |
|---|
| [13] | 45 | /// Get controller input type. |
|---|
| 46 | virtual inputType getInputType() = 0; |
|---|
| 47 | |
|---|
| 48 | /// Get controller output type. |
|---|
| 49 | virtual outputType getOutputType() = 0; |
|---|
| [5] | 50 | |
|---|
| [13] | 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 | } |
|---|
| [5] | 56 | |
|---|
| [13] | 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 | } |
|---|
| [5] | 62 | |
|---|
| [13] | 63 | /// Reset control algorithm to initial conditions. |
|---|
| 64 | virtual void reset() = 0; |
|---|
| [5] | 65 | }; |
|---|
| 66 | |
|---|
| 67 | #endif /* ESC_H_ */ |
|---|