SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
RemovedSources/Camera.h.txt@100:ffbeefc9e218, 2017-04-20 (annotated)
- Committer:
- hazheng
- Date:
- Thu Apr 20 21:04:10 2017 +0000
- Revision:
- 100:ffbeefc9e218
- Parent:
- 36:7e747e19f660
Better version of Intersection detection.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 3:c8867972ffc7 | 1 | #pragma once |
hazheng | 3:c8867972ffc7 | 2 | #include "mbed.h" |
hazheng | 3:c8867972ffc7 | 3 | #include <vector> |
hazheng | 3:c8867972ffc7 | 4 | |
hazheng | 13:7dcb1642ef99 | 5 | #include "OV7725RegBuf.h" |
hazheng | 13:7dcb1642ef99 | 6 | |
hazheng | 26:5814404856e2 | 7 | #define CAMERA_PIXEL_WIDTH 160 |
hazheng | 26:5814404856e2 | 8 | #define CAMERA_PIXEL_HEIGHT 120 |
hazheng | 27:c68f711e5b67 | 9 | #define PICTURE_ARRAY_SIZE ((CAMERA_PIXEL_WIDTH / 8) * CAMERA_PIXEL_HEIGHT) |
hazheng | 3:c8867972ffc7 | 10 | |
hazheng | 13:7dcb1642ef99 | 11 | namespace SW |
hazheng | 13:7dcb1642ef99 | 12 | { |
hazheng | 13:7dcb1642ef99 | 13 | class Core; |
hazheng | 13:7dcb1642ef99 | 14 | } |
hazheng | 13:7dcb1642ef99 | 15 | |
hazheng | 3:c8867972ffc7 | 16 | class Camera |
hazheng | 3:c8867972ffc7 | 17 | { |
hazheng | 3:c8867972ffc7 | 18 | public: |
hazheng | 3:c8867972ffc7 | 19 | |
hazheng | 13:7dcb1642ef99 | 20 | Camera(SW::Core & core); |
hazheng | 3:c8867972ffc7 | 21 | |
hazheng | 3:c8867972ffc7 | 22 | ~Camera(); |
hazheng | 3:c8867972ffc7 | 23 | |
hazheng | 26:5814404856e2 | 24 | void Update(float deltaTime); |
hazheng | 26:5814404856e2 | 25 | |
hazheng | 3:c8867972ffc7 | 26 | bool HasPicture() const; |
hazheng | 3:c8867972ffc7 | 27 | |
hazheng | 3:c8867972ffc7 | 28 | const unsigned char * GetPicture() const; |
hazheng | 3:c8867972ffc7 | 29 | |
hazheng | 26:5814404856e2 | 30 | void StartReceivingPic(); |
hazheng | 26:5814404856e2 | 31 | |
hazheng | 26:5814404856e2 | 32 | void StopReceivingPic(); |
hazheng | 26:5814404856e2 | 33 | |
hazheng | 3:c8867972ffc7 | 34 | private: |
hazheng | 3:c8867972ffc7 | 35 | |
hazheng | 13:7dcb1642ef99 | 36 | Camera(); |
hazheng | 13:7dcb1642ef99 | 37 | |
hazheng | 13:7dcb1642ef99 | 38 | SW::Core & m_core; |
hazheng | 13:7dcb1642ef99 | 39 | |
hazheng | 3:c8867972ffc7 | 40 | InterruptIn m_pClock; |
hazheng | 3:c8867972ffc7 | 41 | |
hazheng | 3:c8867972ffc7 | 42 | InterruptIn m_href; |
hazheng | 3:c8867972ffc7 | 43 | |
hazheng | 3:c8867972ffc7 | 44 | InterruptIn m_vsnyc; |
hazheng | 3:c8867972ffc7 | 45 | |
hazheng | 25:6f63053cee81 | 46 | OV7725RegBuf * m_regBuf; |
hazheng | 26:5814404856e2 | 47 | |
hazheng | 26:5814404856e2 | 48 | float m_debugOutputTimer; |
hazheng | 3:c8867972ffc7 | 49 | }; |