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
Diff: reckoner.cpp
- Revision:
- 21:c279c6a83671
- Parent:
- 15:4df8c50b5e91
- Child:
- 36:ccb03b734737
diff -r dbec34f0e76b -r c279c6a83671 reckoner.cpp --- a/reckoner.cpp Thu Feb 27 19:46:35 2014 +0000 +++ b/reckoner.cpp Thu Feb 27 23:20:34 2014 +0000 @@ -102,9 +102,12 @@ #define LOG_COS_TO_X_CONVERSION 16 // 30 - 14 -Reckoner reckoner; +Reckoner::Reckoner() +{ + reset(); +} -Reckoner::Reckoner() +void Reckoner::reset() { cos = 1 << LOG_UNIT_MAGNITUDE; sin = 0;