David's dead reckoning code for the LVBots competition on March 6th. Uses the mbed LPC1768, DRV8835, QTR-3RC, and two DC motors with encoders.
Dependencies: PololuEncoder Pacer mbed GeneralDebouncer
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 calibratedMinimum[LINE_SENSOR_COUNT]; 00018 uint16_t calibratedMaximum[LINE_SENSOR_COUNT]; 00019 uint16_t calibratedValues[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 };
Generated on Sun Jul 17 2022 15:45:15 by 1.7.2