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:
37:23000a47ed2b
Child:
40:6fa672be85ec
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/logger.cpp	Thu Mar 06 05:11:46 2014 +0000
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "logger.h"
+#include "main.h"
+#include "pc_serial.h"
+
+Logger::Logger()
+{
+    entryIndex = 0;   
+}
+
+bool Logger::isFull()
+{
+    return entryIndex >= LOGGER_SIZE;
+}
+
+void Logger::log()
+{
+    if (isFull())
+    {
+        return;   
+    }
+    
+    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;
+}
+
+void Logger::dump()
+{
+    pc.printf("Log dump start\r\n");
+    for(int32_t i = 0; i < entryIndex; i++)
+    {
+        LogEntry * entry = &entries[i];
+        pc.printf("%d,%d\r\n", entry->x, entry->y);
+    }
+    pc.printf("Log dump end\r\n");
+}
\ No newline at end of file