David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
logger.cpp
- Committer:
- DavidEGrayson
- Date:
- 2015-04-15
- Revision:
- 47:cb5c1504c24d
- Parent:
- 46:f11cb4f93aac
- Child:
- 48:c84b7b3ab0e8
File content as of revision 47:cb5c1504c24d:
#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->turnAngle = 0; 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,%d\r\n", entry->turnAngle, entry->x, entry->y); } pc.printf("Log dump end\r\n"); }