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

Committer:
DavidEGrayson
Date:
Mon Feb 24 00:21:05 2014 +0000
Revision:
15:4df8c50b5e91
Parent:
13:bba5b3abd13f
Child:
21:c279c6a83671
Finished experiments and change the value of dA to an experimentally determined value.;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
DavidEGrayson 12:835a4d24ae3b 1 class Reckoner
DavidEGrayson 12:835a4d24ae3b 2 {
DavidEGrayson 12:835a4d24ae3b 3 public:
DavidEGrayson 12:835a4d24ae3b 4
DavidEGrayson 12:835a4d24ae3b 5 Reckoner();
DavidEGrayson 12:835a4d24ae3b 6
DavidEGrayson 12:835a4d24ae3b 7 // Together, cos and sin form a vector with a magnitude close to 2^30 that indicates
DavidEGrayson 13:bba5b3abd13f 8 // the current position of the robot.
DavidEGrayson 12:835a4d24ae3b 9 // cos corresponds to the x component of the orientation vector.
DavidEGrayson 12:835a4d24ae3b 10 // sin corresponds to the y component of the orientation vector.
DavidEGrayson 12:835a4d24ae3b 11 int32_t cos, sin;
DavidEGrayson 12:835a4d24ae3b 12
DavidEGrayson 12:835a4d24ae3b 13 // Together, x and y are a vector that points from the starting point to the
DavidEGrayson 12:835a4d24ae3b 14 // robot's current position.
DavidEGrayson 13:bba5b3abd13f 15 // The untis are Df / (1<<14), where Df is the distance the robot moves forward
DavidEGrayson 13:bba5b3abd13f 16 // or backwards due to a single encoder tick.
DavidEGrayson 12:835a4d24ae3b 17 int32_t x, y;
DavidEGrayson 12:835a4d24ae3b 18
DavidEGrayson 12:835a4d24ae3b 19 void handleTickLeftForward();
DavidEGrayson 12:835a4d24ae3b 20 void handleTickLeftBackward();
DavidEGrayson 12:835a4d24ae3b 21 void handleTickRightForward();
DavidEGrayson 12:835a4d24ae3b 22 void handleTickRightBackward();
DavidEGrayson 12:835a4d24ae3b 23 void handleForward();
DavidEGrayson 12:835a4d24ae3b 24 void handleBackward();
DavidEGrayson 12:835a4d24ae3b 25 void handleRight();
DavidEGrayson 12:835a4d24ae3b 26 void handleLeft();
DavidEGrayson 12:835a4d24ae3b 27 };
DavidEGrayson 12:835a4d24ae3b 28
DavidEGrayson 12:835a4d24ae3b 29 extern Reckoner reckoner;