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
Parent:
36:ccb03b734737
Child:
43:0e985a58f174
--- a/reckoner.cpp	Thu Mar 06 02:39:07 2014 +0000
+++ b/reckoner.cpp	Thu Mar 06 05:11:46 2014 +0000
@@ -153,7 +153,9 @@
 
 void Reckoner::handleRight()
 {
-    handleTurnRadians(-DA);
+    // DA = 4790484
+    // 0.2% boost
+    handleTurnRadians(-4800065);
 }
 
 void Reckoner::handleLeft()
@@ -165,6 +167,8 @@
 {
     int32_t dc = -((int64_t)sin * radians) >> LOG_UNIT_MAGNITUDE;
     int32_t ds = ((int64_t)cos * radians) >> LOG_UNIT_MAGNITUDE;
+    dc = -((int64_t)(sin+ds/2) * radians) >> LOG_UNIT_MAGNITUDE;
+    ds = ((int64_t)(cos+dc/2) * radians) >> LOG_UNIT_MAGNITUDE;
     cos += dc;
     sin += ds;
 }
\ No newline at end of file