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

Branch:
Drift
Revision:
86:51048c1f132f
Parent:
85:f3911aab41d9
diff -r f3911aab41d9 -r 51048c1f132f StateMachine/RunningState.h
--- a/StateMachine/RunningState.h	Tue Apr 18 22:27:14 2017 +0000
+++ b/StateMachine/RunningState.h	Wed Apr 19 03:46:21 2017 +0000
@@ -1,3 +1,9 @@
+/**
+ * @file RunningState.h
+ * @brief The header file for the RunningState class.
+ * @author Jordan Brack <jabrack@mix.wvu.edu>, Haofan Zheng <hazheng@mix.wvu.edu>
+ * 
+ */
 #pragma once
 #ifndef RUNNING_STATE_H
 #define RUNNING_STATE_H
@@ -5,33 +11,71 @@
 #include <mbed.h>
 #include "States.h"
 
+/**
+ * @class RunningState
+ * @brief The class for running state. It is a child class of the States class.
+ * 
+ */
 class RunningState : public States
 {
 public:
+    /**
+    * @brief This is the constructor for the RunningState class
+    * 
+    */
     RunningState();
+    /**
+    * @brief This is the destructor for the RunningState class
+    * 
+    */
     ~RunningState();
     
+    /**
+    * @brief Draw the user interface. This function is called only once, whenever the running state becomes the current state.
+    * 
+    */
     virtual void DrawUserInterface();
     
+    /**
+    * @brief This functino will be called during every tick, only if the running state is the current state. The image processing, path selection, and driving decision will run from here.
+    * @param deltaTime The time interval between last tick and current tick.
+    * 
+    */
     virtual void Update(float deltaTime);
     
+    /**
+    * @brief Return wether or not the running state has a position callback function for the touch screen.
+    * @return 0 - not. Because the running state does not have a position callback function for the touch screen.
+    * 
+    */
     virtual uint8_t HasTouchPosFunction() const;
     
+    /**
+    * @brief Return wether or not the running state has a interrupt callback function for the touch screen.
+    * @return 1 - yes. Because the running state does have a interrupt callback function for the touch screen.
+    * 
+    */
     virtual uint8_t HasTouchIrqFunction() const;
     
-    virtual void TouchPosCallback(int16_t x, int16_t y);
-    
+    /**
+    * @brief The interrupt callback function for the touch screen.
+    * 
+    */
     virtual void TouchIrqCallback();
     
 private:
     
-    float m_speedRatio;
-    float m_lastAngle;
-    float m_lastAngleAbs;
-    float m_cornerRatio;
-    uint8_t m_lastLineFound;
-    volatile uint8_t m_shouldTerminate;
+    float m_speedRatio; /*!< @brief The percentage of the speed(power) that the motor driver need to maintain during a curve. */
+    float m_lastAngle; /*!< @brief The final calculated turn angle from last tick. */
+    float m_lastAngleAbs; /*!< @brief The final calculated turn angle from last tick, in absolute value. */
+    float m_cornerRatio; /*!< @brief The percentage of the speed(power) that the motor driver need to maintain when enter/exit a curve. */
+    //uint8_t m_lastLineFound; /*!< @brief  */
+    volatile uint8_t m_shouldTerminate; /*!< @brief Did running state received a pendding Terminating command? */
     
+    /**
+    * @brief The terminating process. Called when it is necessary to terminate the runnning state. And it will switch to the standby state.
+    * 
+    */
     void TerminateProcess();
 };