Robot's heading hold program using PID of input from sensor and output to motors
headingHold.h@0:2396598427bf, 2017-12-07 (annotated)
- Committer:
- WAT34
- Date:
- Thu Dec 07 00:54:11 2017 +0900
- Revision:
- 0:2396598427bf
initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
WAT34 | 0:2396598427bf | 1 | #ifndef HEADING_HOLD_H |
WAT34 | 0:2396598427bf | 2 | #define HEADING_HOLD_H |
WAT34 | 0:2396598427bf | 3 | #include "mbed.h" |
WAT34 | 0:2396598427bf | 4 | #include "PID.h" |
WAT34 | 0:2396598427bf | 5 | |
WAT34 | 0:2396598427bf | 6 | class headingHold { |
WAT34 | 0:2396598427bf | 7 | private: |
WAT34 | 0:2396598427bf | 8 | bool holding; |
WAT34 | 0:2396598427bf | 9 | float currentHeading; |
WAT34 | 0:2396598427bf | 10 | float targetHeading; |
WAT34 | 0:2396598427bf | 11 | PID headingPID; |
WAT34 | 0:2396598427bf | 12 | |
WAT34 | 0:2396598427bf | 13 | public: |
WAT34 | 0:2396598427bf | 14 | headingHold (double p,double i,double d); |
WAT34 | 0:2396598427bf | 15 | bool setHeadingHold(const bool& hold); |
WAT34 | 0:2396598427bf | 16 | bool setCurrentHeading(const double& heading); |
WAT34 | 0:2396598427bf | 17 | bool setTargetHeading(const double& target); |
WAT34 | 0:2396598427bf | 18 | double getOutput(); |
WAT34 | 0:2396598427bf | 19 | |
WAT34 | 0:2396598427bf | 20 | }; |
WAT34 | 0:2396598427bf | 21 | |
WAT34 | 0:2396598427bf | 22 | |
WAT34 | 0:2396598427bf | 23 | #endif /* end of include guard: HEADING_HOLD_H */ |