![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Version12.04.18
Dependencies: mbed
Fork of Micromouse_alpha_copy_copy by
Controller.h@0:a9fe4ef404bf, 2018-03-07 (annotated)
- Committer:
- ruesipat
- Date:
- Wed Mar 07 14:06:19 2018 +0000
- Revision:
- 0:a9fe4ef404bf
- Child:
- 1:d9e840c48b1e
hallo
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ruesipat | 0:a9fe4ef404bf | 1 | #ifndef CONTROLLER_H_ |
ruesipat | 0:a9fe4ef404bf | 2 | #define CONTROLLER_H_ |
ruesipat | 0:a9fe4ef404bf | 3 | #include <cstdlib> |
ruesipat | 0:a9fe4ef404bf | 4 | #include <mbed.h> |
ruesipat | 0:a9fe4ef404bf | 5 | #include "EncoderCounter.h" |
ruesipat | 0:a9fe4ef404bf | 6 | #include "LowpassFilter.h" |
ruesipat | 0:a9fe4ef404bf | 7 | |
ruesipat | 0:a9fe4ef404bf | 8 | class Controller |
ruesipat | 0:a9fe4ef404bf | 9 | { |
ruesipat | 0:a9fe4ef404bf | 10 | |
ruesipat | 0:a9fe4ef404bf | 11 | public: |
ruesipat | 0:a9fe4ef404bf | 12 | |
ruesipat | 0:a9fe4ef404bf | 13 | Controller(PwmOut& pwmLeft, PwmOut& pwmRight, |
ruesipat | 0:a9fe4ef404bf | 14 | EncoderCounter& counterLeft, EncoderCounter& counterRight); |
ruesipat | 0:a9fe4ef404bf | 15 | |
ruesipat | 0:a9fe4ef404bf | 16 | virtual ~Controller(); |
ruesipat | 0:a9fe4ef404bf | 17 | void setDesiredSpeedLeft(float desiredSpeedLeft); |
ruesipat | 0:a9fe4ef404bf | 18 | void setDesiredSpeedRight(float desiredSpeedRight); |
ruesipat | 0:a9fe4ef404bf | 19 | |
ruesipat | 0:a9fe4ef404bf | 20 | private: |
ruesipat | 0:a9fe4ef404bf | 21 | |
ruesipat | 0:a9fe4ef404bf | 22 | static const float PERIOD; |
ruesipat | 0:a9fe4ef404bf | 23 | static const float COUNTS_PER_TURN; |
ruesipat | 0:a9fe4ef404bf | 24 | static const float LOWPASS_FILTER_FREQUENCY; |
ruesipat | 0:a9fe4ef404bf | 25 | static const float KN; |
ruesipat | 0:a9fe4ef404bf | 26 | static const float KP; |
ruesipat | 0:a9fe4ef404bf | 27 | static const float MAX_VOLTAGE; |
ruesipat | 0:a9fe4ef404bf | 28 | static const float MIN_DUTY_CYCLE; |
ruesipat | 0:a9fe4ef404bf | 29 | static const float MAX_DUTY_CYCLE; |
ruesipat | 0:a9fe4ef404bf | 30 | |
ruesipat | 0:a9fe4ef404bf | 31 | PwmOut& pwmLeft; |
ruesipat | 0:a9fe4ef404bf | 32 | PwmOut& pwmRight; |
ruesipat | 0:a9fe4ef404bf | 33 | EncoderCounter& counterLeft; |
ruesipat | 0:a9fe4ef404bf | 34 | EncoderCounter& counterRight; |
ruesipat | 0:a9fe4ef404bf | 35 | short previousValueCounterLeft; |
ruesipat | 0:a9fe4ef404bf | 36 | short previousValueCounterRight; |
ruesipat | 0:a9fe4ef404bf | 37 | LowpassFilter speedLeftFilter; |
ruesipat | 0:a9fe4ef404bf | 38 | LowpassFilter speedRightFilter; |
ruesipat | 0:a9fe4ef404bf | 39 | float desiredSpeedLeft; |
ruesipat | 0:a9fe4ef404bf | 40 | float desiredSpeedRight; |
ruesipat | 0:a9fe4ef404bf | 41 | float actualSpeedLeft; |
ruesipat | 0:a9fe4ef404bf | 42 | float actualSpeedRight; |
ruesipat | 0:a9fe4ef404bf | 43 | Ticker ticker; |
ruesipat | 0:a9fe4ef404bf | 44 | |
ruesipat | 0:a9fe4ef404bf | 45 | void run(); |
ruesipat | 0:a9fe4ef404bf | 46 | |
ruesipat | 0:a9fe4ef404bf | 47 | }; |
ruesipat | 0:a9fe4ef404bf | 48 | |
ruesipat | 0:a9fe4ef404bf | 49 | #endif /* CONTROLLER_H_ */ |
ruesipat | 0:a9fe4ef404bf | 50 | |
ruesipat | 0:a9fe4ef404bf | 51 | |
ruesipat | 0:a9fe4ef404bf | 52 | |
ruesipat | 0:a9fe4ef404bf | 53 | |
ruesipat | 0:a9fe4ef404bf | 54 |