Scanner code will include the following: obstacle avoidance, hunting for victims, and localization checks.
Diff: scanner.h
- Revision:
- 6:5e24ff86b743
- Parent:
- 4:6a8d80954323
diff -r 4d5601a9dffe -r 5e24ff86b743 scanner.h --- a/scanner.h Tue Mar 22 18:11:36 2016 +0000 +++ b/scanner.h Fri Mar 25 19:51:11 2016 +0000 @@ -14,14 +14,17 @@ void huntMode(); void avoidMode(); void localize(); + void localizeRight(); + void localizeLeft(); float getDistLeft() {return distLeft;} float getDistRight() {return distRight;} - float getDistForward() {return distForward;} + float getDistForwardL() {return distForwardL;} + float getDistForwardR() {return distForwardR;} private: static const int MIN_DUTY = 0; - static const int MAX_DUTY = 12; - static const int HALF_DUTY = 6; + static const int MAX_DUTY = 6; + static const int HALF_DUTY = 3; 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, @@ -33,7 +36,8 @@ int dutyR; float distLeft; float distRight; - float distForward; + float distForwardL; + float distForwardR; Serial &pc; PwmOut servoL; PwmOut servoR; @@ -44,7 +48,8 @@ float period; bool obstacle; bool huntFlag; - bool avoidFlag; + bool avoidFlag; + bool objectFound; Ticker scanPit; // periodic interrupt timer