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
logger.cpp
- Committer:
- DavidEGrayson
- Date:
- 2014-03-06
- Revision:
- 37:23000a47ed2b
- Child:
- 40:6fa672be85ec
File content as of revision 37:23000a47ed2b:
#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"); }