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
main.h@42:96671b71aac5, 2019-07-27 (annotated)
- Committer:
- DavidEGrayson
- Date:
- Sat Jul 27 20:58:46 2019 +0000
- Revision:
- 42:96671b71aac5
- Parent:
- 37:23000a47ed2b
- Child:
- 43:0e985a58f174
Calibrate L3G using a buffer of 1000 zero-rate readings. Measured a drift of -1.850 degrees over 3 minutes (-0.01 degree per second).
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DavidEGrayson | 21:c279c6a83671 | 1 | #pragma once |
DavidEGrayson | 21:c279c6a83671 | 2 | |
DavidEGrayson | 21:c279c6a83671 | 3 | #include "reckoner.h" |
DavidEGrayson | 21:c279c6a83671 | 4 | #include "line_tracker.h" |
DavidEGrayson | 37:23000a47ed2b | 5 | #include "logger.h" |
DavidEGrayson | 42:96671b71aac5 | 6 | #include "turn_sensor.h" |
DavidEGrayson | 21:c279c6a83671 | 7 | |
DavidEGrayson | 42:96671b71aac5 | 8 | void loadLineCalibration(); |
DavidEGrayson | 42:96671b71aac5 | 9 | void doGyroCalibration(); |
DavidEGrayson | 28:4374035df5e0 | 10 | |
DavidEGrayson | 21:c279c6a83671 | 11 | void waitForSignalToStart(); |
DavidEGrayson | 28:4374035df5e0 | 12 | void findLineAndCalibrate(); void findLine(); // two alternatives |
DavidEGrayson | 21:c279c6a83671 | 13 | void turnRightToFindLine(); |
DavidEGrayson | 21:c279c6a83671 | 14 | void followLineToEnd(); |
DavidEGrayson | 21:c279c6a83671 | 15 | void driveHomeAlmost(); |
DavidEGrayson | 21:c279c6a83671 | 16 | void finalSettleIn(); |
DavidEGrayson | 37:23000a47ed2b | 17 | void __attribute__((noreturn)) loggerReportLoop(); |
DavidEGrayson | 21:c279c6a83671 | 18 | |
DavidEGrayson | 28:4374035df5e0 | 19 | void updateMotorsToFollowLine(); |
DavidEGrayson | 21:c279c6a83671 | 20 | void updateReckonerFromEncoders(); |
DavidEGrayson | 33:58a0ab6e9ad2 | 21 | void setLeds(bool v1, bool v2, bool v3, bool v4); |
DavidEGrayson | 21:c279c6a83671 | 22 | float determinant(); |
DavidEGrayson | 21:c279c6a83671 | 23 | float dotProduct(); |
DavidEGrayson | 33:58a0ab6e9ad2 | 24 | float magnitude(); |
DavidEGrayson | 37:23000a47ed2b | 25 | void loggerService(); |
DavidEGrayson | 21:c279c6a83671 | 26 | |
DavidEGrayson | 21:c279c6a83671 | 27 | extern Reckoner reckoner; |
DavidEGrayson | 21:c279c6a83671 | 28 | extern LineTracker lineTracker; |
DavidEGrayson | 42:96671b71aac5 | 29 | extern TurnSensor turnSensor; |
DavidEGrayson | 42:96671b71aac5 | 30 | extern Logger logger; |