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
StateMachine/StateManager.h@100:ffbeefc9e218, 2017-04-20 (annotated)
- Committer:
- hazheng
- Date:
- Thu Apr 20 21:04:10 2017 +0000
- Revision:
- 100:ffbeefc9e218
- Parent:
- 95:676d829a0e3f
Better version of Intersection detection.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 84:2c22d01e8ae9 | 1 | /** |
hazheng | 84:2c22d01e8ae9 | 2 | * @file StateManager.h |
hazheng | 84:2c22d01e8ae9 | 3 | * @brief The header file for the state manager. |
hazheng | 84:2c22d01e8ae9 | 4 | * @author Jordan Brack <jabrack@mix.wvu.edu>, Haofan Zheng <hazheng@mix.wvu.edu> |
hazheng | 84:2c22d01e8ae9 | 5 | * |
hazheng | 84:2c22d01e8ae9 | 6 | */ |
hazheng | 80:c85cb93713b3 | 7 | #pragma once |
hazheng | 80:c85cb93713b3 | 8 | #ifndef STATE_MANAGER_H |
hazheng | 80:c85cb93713b3 | 9 | #define STATE_MANAGER_H |
hazheng | 80:c85cb93713b3 | 10 | |
hazheng | 80:c85cb93713b3 | 11 | #include <mbed.h> |
hazheng | 80:c85cb93713b3 | 12 | |
hazheng | 80:c85cb93713b3 | 13 | class States; |
hazheng | 80:c85cb93713b3 | 14 | |
hazheng | 95:676d829a0e3f | 15 | #define STANDBY_STATE 0 /*!< @brief Standby State. ENUM for different states. It is used as input for state_manager_switch_state. */ |
hazheng | 95:676d829a0e3f | 16 | #define RUNNING_STATE 1 /*!< @brief Running State. ENUM for different states. It is used as input for state_manager_switch_state. */ |
hazheng | 95:676d829a0e3f | 17 | #define TESTING_STATE 2 /*!< @brief Testing State. ENUM for different states. It is used as input for state_manager_switch_state. */ |
hazheng | 80:c85cb93713b3 | 18 | |
hazheng | 84:2c22d01e8ae9 | 19 | /** |
hazheng | 84:2c22d01e8ae9 | 20 | * @brief This function will be called on each tick in order to tick the current state. |
hazheng | 84:2c22d01e8ae9 | 21 | * @param deltaTime The time interval between last tick and current tick. |
hazheng | 84:2c22d01e8ae9 | 22 | */ |
hazheng | 80:c85cb93713b3 | 23 | void state_manager_update(float deltaTime); |
hazheng | 80:c85cb93713b3 | 24 | |
hazheng | 84:2c22d01e8ae9 | 25 | /** |
hazheng | 84:2c22d01e8ae9 | 26 | * @brief Switch the current state to a specific state. If the input is not valid, it will be switched to NULL state, which will do nothing. |
hazheng | 95:676d829a0e3f | 27 | * @param state The defined number that representing different states. Please refer to the definition above. |
hazheng | 84:2c22d01e8ae9 | 28 | */ |
hazheng | 82:992ba6f31e24 | 29 | void state_manager_switch_state(uint8_t state); |
hazheng | 82:992ba6f31e24 | 30 | |
hazheng | 80:c85cb93713b3 | 31 | #endif //STATE_MANAGER_H |