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

Dependencies:   GeneralDebouncer Pacer PololuEncoder mbed

Fork of DeadReckoning by David Grayson

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers line_tracker.h Source File

line_tracker.h

00001 #pragma once
00002 
00003 #include "line_sensors.h"
00004 
00005 class LineTracker
00006 {
00007     public:
00008     LineTracker();
00009     
00010     void updateCalibration();
00011     
00012     void read();    
00013     bool getLineVisible();
00014     uint16_t getLinePosition();
00015     
00016     uint16_t rawValues[LINE_SENSOR_COUNT];
00017     uint16_t calibratedValues[LINE_SENSOR_COUNT];
00018     uint16_t calibratedMaximum[LINE_SENSOR_COUNT];
00019     uint16_t calibratedMinimum[LINE_SENSOR_COUNT];
00020     
00021     private:
00022     void readRawValues();
00023     void updateCalibratedValues();
00024     void updateLineStatus();
00025 
00026     uint8_t calibrationState;
00027     uint16_t recentValuesMax[LINE_SENSOR_COUNT];
00028     uint16_t recentValuesMin[LINE_SENSOR_COUNT];
00029     
00030     bool lineVisible;
00031     uint16_t linePosition;
00032 };