David's line following code from the LVBots competition, 2015.
Dependencies: GeneralDebouncer Pacer PololuEncoder mbed
Fork of DeadReckoning by
Diff: main.cpp
- Revision:
- 22:44c032e59ff5
- Parent:
- 21:c279c6a83671
- Child:
- 23:aae5cbe3b924
diff -r c279c6a83671 -r 44c032e59ff5 main.cpp --- a/main.cpp Thu Feb 27 23:20:34 2014 +0000 +++ b/main.cpp Fri Feb 28 00:16:49 2014 +0000 @@ -43,6 +43,7 @@ //testButtons(); //testDriveHome(); //testFinalSettleIn(); + testCalibrate(); // Real routines for the contest. setLeds(1, 0, 0, 0); @@ -167,17 +168,17 @@ int32_t reduction = reckoner.sin / (1<<15) * straightDriveStrength / (1 << 15); if (reduction > 0) { - speedRight = reduceSpeed(speedRight, -reduction); + speedRight = reduceSpeed(speedRight, reduction); } else { - speedLeft = reduceSpeed(speedLeft, reduction); + speedLeft = reduceSpeed(speedLeft, -reduction); } motorsSpeedSet(speedLeft, speedRight); if (goodCalibration) { - if(goodCalibrationTimer.read_us() >= 300000) + if(goodCalibrationTimer.read_ms() >= 300) { // The calibration was good and we traveled for a bit of time after that, // so we must be a bit over the line.