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 haofan Zheng

Committer:
hazheng
Date:
Thu Apr 20 21:04:10 2017 +0000
Revision:
100:ffbeefc9e218
Parent:
84:2c22d01e8ae9
Better version of Intersection detection.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
hazheng 84:2c22d01e8ae9 1 /**
hazheng 84:2c22d01e8ae9 2 * @file States.h
hazheng 84:2c22d01e8ae9 3 * @brief The header file for the States class.
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 84:2c22d01e8ae9 7
hazheng 80:c85cb93713b3 8 #pragma once
hazheng 80:c85cb93713b3 9 #ifndef STATES_H
hazheng 80:c85cb93713b3 10 #define STATES_H
hazheng 80:c85cb93713b3 11
hazheng 80:c85cb93713b3 12 #include <mbed.h>
hazheng 84:2c22d01e8ae9 13 /**
hazheng 84:2c22d01e8ae9 14 * @class States
hazheng 84:2c22d01e8ae9 15 * @brief The abstract class for different states. This class should not be used directly.
hazheng 84:2c22d01e8ae9 16 *
hazheng 84:2c22d01e8ae9 17 */
hazheng 80:c85cb93713b3 18 class States
hazheng 80:c85cb93713b3 19 {
hazheng 80:c85cb93713b3 20 public:
hazheng 84:2c22d01e8ae9 21 /**
hazheng 84:2c22d01e8ae9 22 * @brief This is the constructor for the States class
hazheng 84:2c22d01e8ae9 23 *
hazheng 84:2c22d01e8ae9 24 */
hazheng 80:c85cb93713b3 25 States(){}
hazheng 84:2c22d01e8ae9 26 /**
hazheng 84:2c22d01e8ae9 27 * @brief This is the destructor for the States class
hazheng 84:2c22d01e8ae9 28 *
hazheng 84:2c22d01e8ae9 29 */
hazheng 80:c85cb93713b3 30 ~States(){}
hazheng 80:c85cb93713b3 31
hazheng 84:2c22d01e8ae9 32 /**
hazheng 84:2c22d01e8ae9 33 * @brief This function will be called once, when this instance becoming the current state.
hazheng 84:2c22d01e8ae9 34 *
hazheng 84:2c22d01e8ae9 35 */
hazheng 80:c85cb93713b3 36 virtual void DrawUserInterface(){}
hazheng 80:c85cb93713b3 37
hazheng 84:2c22d01e8ae9 38 /**
hazheng 84:2c22d01e8ae9 39 * @brief This functino will be called during every tick, only if this instance is the current state.
hazheng 84:2c22d01e8ae9 40 * @param deltaTime The time interval between last tick and current tick.
hazheng 84:2c22d01e8ae9 41 *
hazheng 84:2c22d01e8ae9 42 */
hazheng 80:c85cb93713b3 43 virtual void Update(float deltaTime){}
hazheng 80:c85cb93713b3 44
hazheng 84:2c22d01e8ae9 45 /**
hazheng 84:2c22d01e8ae9 46 * @brief Return wether or not this State has a position callback function for the touch screen.
hazheng 84:2c22d01e8ae9 47 * @return 0 for not, 1 for yes.
hazheng 84:2c22d01e8ae9 48 *
hazheng 84:2c22d01e8ae9 49 */
hazheng 80:c85cb93713b3 50 virtual uint8_t HasTouchPosFunction() const{return 0;}
hazheng 80:c85cb93713b3 51
hazheng 84:2c22d01e8ae9 52 /**
hazheng 84:2c22d01e8ae9 53 * @brief Return wether or not this State has a interrupt callback function for the touch screen.
hazheng 84:2c22d01e8ae9 54 * @return 0 for not, 1 for yes.
hazheng 84:2c22d01e8ae9 55 *
hazheng 84:2c22d01e8ae9 56 */
hazheng 80:c85cb93713b3 57 virtual uint8_t HasTouchIrqFunction() const{return 0;}
hazheng 80:c85cb93713b3 58
hazheng 84:2c22d01e8ae9 59 /**
hazheng 84:2c22d01e8ae9 60 * @brief This is the position callback function for the touch screen.
hazheng 84:2c22d01e8ae9 61 * @param x The position on x axis.
hazheng 84:2c22d01e8ae9 62 * @param y The position on y axis.
hazheng 84:2c22d01e8ae9 63 *
hazheng 84:2c22d01e8ae9 64 */
hazheng 80:c85cb93713b3 65 virtual void TouchPosCallback(int16_t x, int16_t y){}
hazheng 80:c85cb93713b3 66
hazheng 84:2c22d01e8ae9 67 /**
hazheng 84:2c22d01e8ae9 68 * @brief This is the interrupt callback function for the touch screen.
hazheng 84:2c22d01e8ae9 69 *
hazheng 84:2c22d01e8ae9 70 */
hazheng 80:c85cb93713b3 71 virtual void TouchIrqCallback(){}
hazheng 80:c85cb93713b3 72 };
hazheng 80:c85cb93713b3 73
hazheng 80:c85cb93713b3 74 #endif //STATES_H