David's line following code from the LVBots competition, 2015.

Dependencies:   GeneralDebouncer Pacer PololuEncoder mbed

Fork of DeadReckoning by David Grayson

Committer:
DavidEGrayson
Date:
Thu Apr 16 22:00:15 2015 +0000
Revision:
57:99bec7fab454
Parent:
22:44c032e59ff5
Doubled the encoder counts for indicating the end of the course because we might have to start a little bit back from the finish line.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DavidEGrayson 21:c279c6a83671 1 #pragma once
DavidEGrayson 21:c279c6a83671 2
DavidEGrayson 21:c279c6a83671 3 #include "line_sensors.h"
DavidEGrayson 21:c279c6a83671 4
DavidEGrayson 21:c279c6a83671 5 class LineTracker
DavidEGrayson 21:c279c6a83671 6 {
DavidEGrayson 21:c279c6a83671 7 public:
DavidEGrayson 21:c279c6a83671 8 LineTracker();
DavidEGrayson 21:c279c6a83671 9
DavidEGrayson 21:c279c6a83671 10 void updateCalibration();
DavidEGrayson 21:c279c6a83671 11
DavidEGrayson 21:c279c6a83671 12 void read();
DavidEGrayson 21:c279c6a83671 13 bool getLineVisible();
DavidEGrayson 21:c279c6a83671 14 uint16_t getLinePosition();
DavidEGrayson 21:c279c6a83671 15
DavidEGrayson 21:c279c6a83671 16 uint16_t rawValues[LINE_SENSOR_COUNT];
DavidEGrayson 21:c279c6a83671 17 uint16_t calibratedValues[LINE_SENSOR_COUNT];
DavidEGrayson 21:c279c6a83671 18 uint16_t calibratedMaximum[LINE_SENSOR_COUNT];
DavidEGrayson 21:c279c6a83671 19 uint16_t calibratedMinimum[LINE_SENSOR_COUNT];
DavidEGrayson 21:c279c6a83671 20
DavidEGrayson 21:c279c6a83671 21 private:
DavidEGrayson 21:c279c6a83671 22 void readRawValues();
DavidEGrayson 21:c279c6a83671 23 void updateCalibratedValues();
DavidEGrayson 21:c279c6a83671 24 void updateLineStatus();
DavidEGrayson 22:44c032e59ff5 25
DavidEGrayson 22:44c032e59ff5 26 uint8_t calibrationState;
DavidEGrayson 22:44c032e59ff5 27 uint16_t recentValuesMax[LINE_SENSOR_COUNT];
DavidEGrayson 22:44c032e59ff5 28 uint16_t recentValuesMin[LINE_SENSOR_COUNT];
DavidEGrayson 21:c279c6a83671 29
DavidEGrayson 21:c279c6a83671 30 bool lineVisible;
DavidEGrayson 21:c279c6a83671 31 uint16_t linePosition;
DavidEGrayson 21:c279c6a83671 32 };