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
main.cpp@100:ffbeefc9e218, 2017-04-20 (annotated)
- Committer:
- hazheng
- Date:
- Thu Apr 20 21:04:10 2017 +0000
- Revision:
- 100:ffbeefc9e218
- Parent:
- 87:15fcf7891bf9
Better version of Intersection detection.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 3:c8867972ffc7 | 1 | #include "mbed.h" |
hazheng | 5:577b582e4fe9 | 2 | |
hazheng | 63:d9a81b3d69f5 | 3 | //#define SW_DEBUG |
hazheng | 56:7d3395ae022d | 4 | #include "SWCommon.h" |
hazheng | 56:7d3395ae022d | 5 | #include "GlobalVariable.h" |
hazheng | 83:b2c7c6f76575 | 6 | #include "PinAssignment.h" |
hazheng | 56:7d3395ae022d | 7 | |
Bobymicjohn | 8:92f6baeea027 | 8 | #include "Motor.h" |
Bobymicjohn | 11:676ea42afd56 | 9 | #include "Servo.h" |
hazheng | 29:f87d8790f57d | 10 | |
hazheng | 29:f87d8790f57d | 11 | #include "ArduCAM.h" |
hazheng | 40:be98219930e4 | 12 | #include "ArduUTFT.h" |
hazheng | 79:bdbac82c979b | 13 | #include "ArduTouch.h" |
Bobymicjohn | 10:fedb5786a109 | 14 | |
hazheng | 80:c85cb93713b3 | 15 | #include "StateManager.h" |
hazheng | 80:c85cb93713b3 | 16 | |
Bobymicjohn | 8:92f6baeea027 | 17 | |
hazheng | 28:271fc8445e89 | 18 | SPI g_spi_port(PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCK); |
hazheng | 5:577b582e4fe9 | 19 | |
hazheng | 3:c8867972ffc7 | 20 | int main(void) { |
hazheng | 16:66c7a09e71ee | 21 | |
hazheng | 48:f76b5e252444 | 22 | g_spi_port.frequency(5000000); |
Bobymicjohn | 10:fedb5786a109 | 23 | |
hazheng | 46:a5eb9bd3bb55 | 24 | motor_init(); |
hazheng | 83:b2c7c6f76575 | 25 | |
hazheng | 45:501b7909139a | 26 | servo_init(); |
hazheng | 16:66c7a09e71ee | 27 | |
hazheng | 83:b2c7c6f76575 | 28 | wait(1.0f); |
hazheng | 40:be98219930e4 | 29 | |
hazheng | 40:be98219930e4 | 30 | ardu_utft_init(); |
hazheng | 29:f87d8790f57d | 31 | |
hazheng | 41:7b21c5e3599e | 32 | ardu_cam_init(); |
hazheng | 41:7b21c5e3599e | 33 | |
hazheng | 79:bdbac82c979b | 34 | ardu_touch_init(); |
hazheng | 79:bdbac82c979b | 35 | |
hazheng | 46:a5eb9bd3bb55 | 36 | servo_set_angle(0.0f); |
hazheng | 80:c85cb93713b3 | 37 | |
hazheng | 82:992ba6f31e24 | 38 | state_manager_switch_state(STANDBY_STATE); |
hazheng | 80:c85cb93713b3 | 39 | |
hazheng | 5:577b582e4fe9 | 40 | while (1) |
hazheng | 5:577b582e4fe9 | 41 | { |
hazheng | 80:c85cb93713b3 | 42 | state_manager_update(0.0f); |
hazheng | 68:b15cab740371 | 43 | } |
hazheng | 68:b15cab740371 | 44 | } |