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

Committer:
j_j205
Date:
Tue Feb 23 23:35:41 2016 +0000
Revision:
2:b281034eda86
Parent:
0:999bb8fcd0b2
Child:
3:992558a021d7
2/23/16 JJ

Who changed what in which revision?

UserRevisionLine numberNew contents of line
j_j205 0:999bb8fcd0b2 1 #ifndef SCANNER_H
j_j205 0:999bb8fcd0b2 2 #define SCANNER_H
j_j205 0:999bb8fcd0b2 3 #include "mbed.h"
j_j205 0:999bb8fcd0b2 4 #include "Gp2x.h"
j_j205 0:999bb8fcd0b2 5 #include "VL6180x.h"
j_j205 0:999bb8fcd0b2 6
j_j205 0:999bb8fcd0b2 7 class Scanner
j_j205 0:999bb8fcd0b2 8 {
j_j205 2:b281034eda86 9 public:
j_j205 2:b281034eda86 10 Scanner(Serial &pc1, PinName _servoL, PinName _servoR,
j_j205 0:999bb8fcd0b2 11 VL6180x &_shortRangeL, VL6180x &_shortRangeR, Gp2x &_longRangeL,
j_j205 2:b281034eda86 12 Gp2x &_longRangeR, float _period = 0.2);
j_j205 2:b281034eda86 13 void hunt();
j_j205 2:b281034eda86 14 void avoid();
j_j205 2:b281034eda86 15 int localize();
j_j205 2:b281034eda86 16
j_j205 0:999bb8fcd0b2 17 private:
j_j205 2:b281034eda86 18 static const int MIN_DUTY = 0;
j_j205 2:b281034eda86 19 static const int MAX_DUTY = 12;
j_j205 2:b281034eda86 20 static const int HALF_DUTY = 6;
j_j205 2:b281034eda86 21 static const float DELTA_DUTY = 4.2e-3;
j_j205 2:b281034eda86 22 float DUTY[13]; // {0.0500, 0.0542, 0.0583, 0.0625, 0.0667, 0.0708,
j_j205 2:b281034eda86 23 // 0.0750, 0.0792, 0.0833, 0.0875, 0.0917, 0.0958,
j_j205 2:b281034eda86 24 // 0.1000};
j_j205 2:b281034eda86 25 bool pitEnable;
j_j205 2:b281034eda86 26 int invertL;
j_j205 2:b281034eda86 27 int invertR;
j_j205 2:b281034eda86 28 int dutyL;
j_j205 2:b281034eda86 29 int dutyR;
j_j205 0:999bb8fcd0b2 30 Serial &pc;
j_j205 0:999bb8fcd0b2 31 PwmOut servoL;
j_j205 0:999bb8fcd0b2 32 PwmOut servoR;
j_j205 0:999bb8fcd0b2 33 VL6180x &shortRangeL;
j_j205 0:999bb8fcd0b2 34 VL6180x &shortRangeR;
j_j205 0:999bb8fcd0b2 35 Gp2x &longRangeL;
j_j205 0:999bb8fcd0b2 36 Gp2x &longRangeR;
j_j205 0:999bb8fcd0b2 37 float period;
j_j205 2:b281034eda86 38
j_j205 0:999bb8fcd0b2 39 Ticker pit; // periodic interrupt timer
j_j205 2:b281034eda86 40
j_j205 2:b281034eda86 41 void scan();
j_j205 2:b281034eda86 42
j_j205 0:999bb8fcd0b2 43 };
j_j205 0:999bb8fcd0b2 44
j_j205 0:999bb8fcd0b2 45 #endif // SCANNER_H