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

Committer:
DavidEGrayson
Date:
Tue Aug 13 21:21:17 2019 +0000
Revision:
48:597738b77f77
Parent:
40:6fa672be85ec
Changes from before the contest, I think.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DavidEGrayson 37:23000a47ed2b 1 #pragma once
DavidEGrayson 37:23000a47ed2b 2
DavidEGrayson 37:23000a47ed2b 3 #include <stdint.h>
DavidEGrayson 37:23000a47ed2b 4
DavidEGrayson 48:597738b77f77 5 #define LOGGER_SIZE 3000
DavidEGrayson 37:23000a47ed2b 6
DavidEGrayson 37:23000a47ed2b 7 struct LogEntry
DavidEGrayson 37:23000a47ed2b 8 {
DavidEGrayson 40:6fa672be85ec 9 int16_t turnAngle;
DavidEGrayson 37:23000a47ed2b 10 int16_t x;
DavidEGrayson 37:23000a47ed2b 11 int16_t y;
DavidEGrayson 37:23000a47ed2b 12 };
DavidEGrayson 37:23000a47ed2b 13
DavidEGrayson 37:23000a47ed2b 14 class Logger
DavidEGrayson 37:23000a47ed2b 15 {
DavidEGrayson 37:23000a47ed2b 16 public:
DavidEGrayson 37:23000a47ed2b 17 Logger();
DavidEGrayson 40:6fa672be85ec 18 void log(struct LogEntry *);
DavidEGrayson 37:23000a47ed2b 19 void dump();
DavidEGrayson 37:23000a47ed2b 20 bool isFull();
DavidEGrayson 40:6fa672be85ec 21 int32_t getSize() { return entryIndex; }
DavidEGrayson 37:23000a47ed2b 22
DavidEGrayson 37:23000a47ed2b 23 LogEntry entries[LOGGER_SIZE];
DavidEGrayson 37:23000a47ed2b 24
DavidEGrayson 37:23000a47ed2b 25 // The index of the next entry to write to.
DavidEGrayson 40:6fa672be85ec 26 uint32_t entryIndex;
DavidEGrayson 37:23000a47ed2b 27 };