David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
line_tracker.h@21:c279c6a83671, 2014-02-27 (annotated)
- Committer:
- DavidEGrayson
- Date:
- Thu Feb 27 23:20:34 2014 +0000
- Revision:
- 21:c279c6a83671
- Child:
- 22:44c032e59ff5
Wrote a whole bunch of code that could theoretically allow the robot to compete, but it has not been tested at all yet.
Who changed what in which revision?
User | Revision | Line number | New 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 | 21:c279c6a83671 | 25 | |
DavidEGrayson | 21:c279c6a83671 | 26 | bool lineVisible; |
DavidEGrayson | 21:c279c6a83671 | 27 | uint16_t linePosition; |
DavidEGrayson | 21:c279c6a83671 | 28 | }; |