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/StandbyState.h@100:ffbeefc9e218, 2017-04-20 (annotated)
- Committer:
- hazheng
- Date:
- Thu Apr 20 21:04:10 2017 +0000
- Revision:
- 100:ffbeefc9e218
- Parent:
- 97:0ed9ede9a995
Better version of Intersection detection.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
hazheng | 86:51048c1f132f | 1 | /** |
hazheng | 86:51048c1f132f | 2 | * @file StandbyState.h |
hazheng | 86:51048c1f132f | 3 | * @brief The header file for the StandbyState class. |
hazheng | 86:51048c1f132f | 4 | * @author Jordan Brack <jabrack@mix.wvu.edu>, Haofan Zheng <hazheng@mix.wvu.edu> |
hazheng | 86:51048c1f132f | 5 | * |
hazheng | 86:51048c1f132f | 6 | */ |
hazheng | 80:c85cb93713b3 | 7 | #pragma once |
hazheng | 80:c85cb93713b3 | 8 | #ifndef STANDBY_STATE_H |
hazheng | 80:c85cb93713b3 | 9 | #define STANDBY_STATE_H |
hazheng | 80:c85cb93713b3 | 10 | |
hazheng | 80:c85cb93713b3 | 11 | #include <mbed.h> |
hazheng | 80:c85cb93713b3 | 12 | #include "States.h" |
hazheng | 80:c85cb93713b3 | 13 | |
hazheng | 86:51048c1f132f | 14 | /** |
hazheng | 86:51048c1f132f | 15 | * @class StandbyState |
hazheng | 86:51048c1f132f | 16 | * @brief The class for standby state. It is a child class of the States class. |
hazheng | 86:51048c1f132f | 17 | * |
hazheng | 86:51048c1f132f | 18 | */ |
hazheng | 80:c85cb93713b3 | 19 | class StandbyState : public States |
hazheng | 80:c85cb93713b3 | 20 | { |
hazheng | 80:c85cb93713b3 | 21 | public: |
hazheng | 86:51048c1f132f | 22 | /** |
hazheng | 86:51048c1f132f | 23 | * @brief This is the constructor for the StandbyState class |
hazheng | 86:51048c1f132f | 24 | * |
hazheng | 86:51048c1f132f | 25 | */ |
hazheng | 80:c85cb93713b3 | 26 | StandbyState(); |
hazheng | 86:51048c1f132f | 27 | /** |
hazheng | 86:51048c1f132f | 28 | * @brief This is the destructor for the StandbyState class |
hazheng | 86:51048c1f132f | 29 | * |
hazheng | 86:51048c1f132f | 30 | */ |
hazheng | 80:c85cb93713b3 | 31 | ~StandbyState(); |
hazheng | 80:c85cb93713b3 | 32 | |
hazheng | 86:51048c1f132f | 33 | /** |
hazheng | 86:51048c1f132f | 34 | * @brief Draw the user interface. This function is called only once, whenever the standby state becomes the current state. |
hazheng | 86:51048c1f132f | 35 | * |
hazheng | 86:51048c1f132f | 36 | */ |
hazheng | 80:c85cb93713b3 | 37 | virtual void DrawUserInterface(); |
hazheng | 80:c85cb93713b3 | 38 | |
hazheng | 86:51048c1f132f | 39 | /** |
hazheng | 86:51048c1f132f | 40 | * @brief This functino will be called during every tick, only if the standby state is the current state. |
hazheng | 86:51048c1f132f | 41 | * @param deltaTime The time interval between last tick and current tick. |
hazheng | 86:51048c1f132f | 42 | * |
hazheng | 86:51048c1f132f | 43 | */ |
hazheng | 80:c85cb93713b3 | 44 | virtual void Update(float deltaTime); |
hazheng | 80:c85cb93713b3 | 45 | |
hazheng | 86:51048c1f132f | 46 | /** |
hazheng | 86:51048c1f132f | 47 | * @brief Return wether or not the standby state has a position callback function for the touch screen. |
hazheng | 86:51048c1f132f | 48 | * @return 1 - yes. |
hazheng | 86:51048c1f132f | 49 | * |
hazheng | 86:51048c1f132f | 50 | */ |
hazheng | 80:c85cb93713b3 | 51 | virtual uint8_t HasTouchPosFunction() const; |
hazheng | 80:c85cb93713b3 | 52 | |
hazheng | 86:51048c1f132f | 53 | /** |
hazheng | 86:51048c1f132f | 54 | * @brief Return wether or not the standby state has a interrupt callback function for the touch screen. |
hazheng | 86:51048c1f132f | 55 | * @return 0 - yes. |
hazheng | 86:51048c1f132f | 56 | * |
hazheng | 86:51048c1f132f | 57 | */ |
hazheng | 80:c85cb93713b3 | 58 | virtual uint8_t HasTouchIrqFunction() const; |
hazheng | 80:c85cb93713b3 | 59 | |
hazheng | 86:51048c1f132f | 60 | /** |
hazheng | 86:51048c1f132f | 61 | * @brief The position callback function for the touch screen. Based on the touch position, the corresponding functionality will be executed. |
hazheng | 86:51048c1f132f | 62 | * |
hazheng | 86:51048c1f132f | 63 | */ |
hazheng | 80:c85cb93713b3 | 64 | virtual void TouchPosCallback(int16_t x, int16_t y); |
hazheng | 80:c85cb93713b3 | 65 | |
Bobymicjohn | 97:0ed9ede9a995 | 66 | private: |
Bobymicjohn | 97:0ed9ede9a995 | 67 | volatile int8_t m_nextState; /*!< @brief Pendding next state command. */ |
hazheng | 80:c85cb93713b3 | 68 | }; |
hazheng | 80:c85cb93713b3 | 69 | |
hazheng | 80:c85cb93713b3 | 70 | #endif //STANDBY_STATE_H |