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

Dependencies:   GeneralDebouncer Pacer PololuEncoder mbed

Fork of DeadReckoning by David Grayson

line_tracker.h

Committer:
DavidEGrayson
Date:
2014-02-28
Revision:
22:44c032e59ff5
Parent:
21:c279c6a83671

File content as of revision 22:44c032e59ff5:

#pragma once

#include "line_sensors.h"

class LineTracker
{
    public:
    LineTracker();
    
    void updateCalibration();
    
    void read();    
    bool getLineVisible();
    uint16_t getLinePosition();
    
    uint16_t rawValues[LINE_SENSOR_COUNT];
    uint16_t calibratedValues[LINE_SENSOR_COUNT];
    uint16_t calibratedMaximum[LINE_SENSOR_COUNT];
    uint16_t calibratedMinimum[LINE_SENSOR_COUNT];
    
    private:
    void readRawValues();
    void updateCalibratedValues();
    void updateLineStatus();

    uint8_t calibrationState;
    uint16_t recentValuesMax[LINE_SENSOR_COUNT];
    uint16_t recentValuesMin[LINE_SENSOR_COUNT];
    
    bool lineVisible;
    uint16_t linePosition;
};