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: turn_sensor.cpp
- Revision:
- 48:597738b77f77
- Parent:
- 47:9773dc14c834
--- a/turn_sensor.cpp Wed Jul 31 07:14:09 2019 +0000 +++ b/turn_sensor.cpp Tue Aug 13 21:21:17 2019 +0000 @@ -52,14 +52,16 @@ if (rate > 0) { - // Counter-clockwise scale factor calculated from log_190730_2.csv. - const double scale = 1.012394298; + // Counter-clockwise scale factors from + // log_190730_2.csv and log_190801_4.csv. + const double scale = 1.012394298 * 0.998207092; angleUnsigned += (int64_t)d * (int32_t)(14680064 * scale) / 17578125; } else { - // Clockwise scale factor calculated from log_190730_3.csv. - const double scale = 0.992376154; + // Clockwise scale factor calculated from + // log_190730_3.csv and then log_190801_3.csv. + const double scale = 0.992376154 * 0.999892525; angleUnsigned += (int64_t)d * (int32_t)(14680064 * scale) / 17578125; } }