3-26-2015 DSV
Fork of scanner by
Diff: scanner.h
- Revision:
- 2:b281034eda86
- Parent:
- 0:999bb8fcd0b2
- Child:
- 3:992558a021d7
diff -r 999bb8fcd0b2 -r b281034eda86 scanner.h --- a/scanner.h Wed Feb 17 16:47:55 2016 +0000 +++ b/scanner.h Tue Feb 23 23:35:41 2016 +0000 @@ -6,15 +6,27 @@ class Scanner { -public: - Scanner(Serial &pc1, PinName _servoL, PinName _servoR, +public: + Scanner(Serial &pc1, PinName _servoL, PinName _servoR, VL6180x &_shortRangeL, VL6180x &_shortRangeR, Gp2x &_longRangeL, - Gp2x &_longRangeR, float _period); - int hunt(); - int avoid(); - int localize(); - + Gp2x &_longRangeR, float _period = 0.2); + void hunt(); + void avoid(); + int localize(); + private: + static const int MIN_DUTY = 0; + static const int MAX_DUTY = 12; + static const int HALF_DUTY = 6; + static const float DELTA_DUTY = 4.2e-3; + float DUTY[13]; // {0.0500, 0.0542, 0.0583, 0.0625, 0.0667, 0.0708, + // 0.0750, 0.0792, 0.0833, 0.0875, 0.0917, 0.0958, + // 0.1000}; + bool pitEnable; + int invertL; + int invertR; + int dutyL; + int dutyR; Serial &pc; PwmOut servoL; PwmOut servoR; @@ -23,11 +35,11 @@ Gp2x &longRangeL; Gp2x &longRangeR; float period; - + Ticker pit; // periodic interrupt timer - - void scan(); - + + void scan(); + }; #endif // SCANNER_H \ No newline at end of file