Custom version for NXP cup car
Vision.h@0:ccbc44580fab, 2016-03-25 (annotated)
- Committer:
- Clarkk
- Date:
- Fri Mar 25 13:05:09 2016 +0000
- Revision:
- 0:ccbc44580fab
- Child:
- 1:68bb92736e14
Initial version of vision library
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Clarkk | 0:ccbc44580fab | 1 | #include "mbed.h" |
Clarkk | 0:ccbc44580fab | 2 | |
Clarkk | 0:ccbc44580fab | 3 | #ifndef _VISION_H |
Clarkk | 0:ccbc44580fab | 4 | #define _VISION_H |
Clarkk | 0:ccbc44580fab | 5 | |
Clarkk | 0:ccbc44580fab | 6 | struct lineScanData { |
Clarkk | 0:ccbc44580fab | 7 | uint8_t mostWhiteIndex; |
Clarkk | 0:ccbc44580fab | 8 | uint16_t maxLightValue; |
Clarkk | 0:ccbc44580fab | 9 | uint8_t rightEdgeIndex; |
Clarkk | 0:ccbc44580fab | 10 | uint8_t leftEdgeIndex; |
Clarkk | 0:ccbc44580fab | 11 | }; |
Clarkk | 0:ccbc44580fab | 12 | |
Clarkk | 0:ccbc44580fab | 13 | class Vision |
Clarkk | 0:ccbc44580fab | 14 | { |
Clarkk | 0:ccbc44580fab | 15 | public: |
Clarkk | 0:ccbc44580fab | 16 | |
Clarkk | 0:ccbc44580fab | 17 | Vision(); |
Clarkk | 0:ccbc44580fab | 18 | void processTasks(); |
Clarkk | 0:ccbc44580fab | 19 | void saveData(uint16_t* line); |
Clarkk | 0:ccbc44580fab | 20 | struct lineScanData processLine(); |
Clarkk | 0:ccbc44580fab | 21 | bool lightCompensation; |
Clarkk | 0:ccbc44580fab | 22 | struct lineScanData getRoadData(); |
Clarkk | 0:ccbc44580fab | 23 | |
Clarkk | 0:ccbc44580fab | 24 | private: |
Clarkk | 0:ccbc44580fab | 25 | |
Clarkk | 0:ccbc44580fab | 26 | uint16_t lineData[128]; |
Clarkk | 0:ccbc44580fab | 27 | bool newDataToProcess; |
Clarkk | 0:ccbc44580fab | 28 | struct lineScanData currentRoadData; |
Clarkk | 0:ccbc44580fab | 29 | void lineScanLightAdjust(); |
Clarkk | 0:ccbc44580fab | 30 | }; |
Clarkk | 0:ccbc44580fab | 31 | |
Clarkk | 0:ccbc44580fab | 32 | #endif |