Scanner code will include the following: obstacle avoidance, hunting for victims, and localization checks.

Revision:
1:2714d60284ef
Parent:
0:999bb8fcd0b2
--- a/scanner.h	Wed Feb 17 16:47:55 2016 +0000
+++ b/scanner.h	Tue Feb 23 23:30:43 2016 +0000
@@ -9,12 +9,24 @@
 public: 
     Scanner(Serial &pc1, PinName _servoL, PinName _servoR, 
     VL6180x &_shortRangeL, VL6180x &_shortRangeR, Gp2x &_longRangeL,
-    Gp2x &_longRangeR, float _period);
-    int hunt();
-    int avoid();
+    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;
@@ -24,7 +36,7 @@
     Gp2x &longRangeR;
     float period;
     
-    Ticker pit; // periodic interrupt timer
+    Ticker pit; // periodic interrupt timer   
     
     void scan();