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

Revision:
40:6fa672be85ec
Parent:
37:23000a47ed2b
--- a/logger.cpp	Thu Jul 25 02:11:25 2019 +0000
+++ b/logger.cpp	Thu Jul 25 02:53:34 2019 +0000
@@ -1,7 +1,6 @@
 #pragma once
 
 #include "logger.h"
-#include "main.h"
 #include "pc_serial.h"
 
 Logger::Logger()
@@ -14,7 +13,7 @@
     return entryIndex >= LOGGER_SIZE;
 }
 
-void Logger::log()
+void Logger::log(struct LogEntry * newEntry)
 {
     if (isFull())
     {
@@ -23,11 +22,7 @@
     
     LogEntry * entry = &entries[entryIndex];
     entryIndex++;
-    
-    //entry->cos = reckoner.cos >> 16;
-    //entry->sin = reckoner.sin >> 16;
-    entry->x = reckoner.x >> 16;
-    entry->y = reckoner.y >> 16;
+    *entry = *newEntry;    
 }
 
 void Logger::dump()
@@ -36,7 +31,7 @@
     for(int32_t i = 0; i < entryIndex; i++)
     {
         LogEntry * entry = &entries[i];
-        pc.printf("%d,%d\r\n", entry->x, entry->y);
+        pc.printf("%d,%d,%d\r\n", entry->turnAngle, entry->x, entry->y);
     }
     pc.printf("Log dump end\r\n");
 }
\ No newline at end of file