PlayBack

Dependencies:   TPixy-Interface

Fork of ManualControlFinal by ECE4333 - 2018 - Ahmed & Brandon

Revision:
8:a0890fa79084
Parent:
6:e7ce340fe91e
Child:
9:fe56b888985c
--- a/ui.cpp	Thu Feb 15 01:15:26 2018 +0000
+++ b/ui.cpp	Mon Feb 19 17:42:33 2018 +0000
@@ -1,3 +1,15 @@
+/******************************************************************************/
+// ECE4333
+// LAB Partner 1: Ahmed Sobhy - ID: 3594449
+// LAB Partner 2: Brandon Kingman - ID: 3470444
+// Project: Autonomous Robot Design
+// Instructor: Prof. Chris Diduch
+/******************************************************************************/
+// filename: ui.cpp
+// file content description:
+//      * Functions to display and manage the user interface on the PC terminal. 
+/******************************************************************************/
+
 #include "mbed.h"
 #include "WatchdogThread.h"
 #include "ui.h"
@@ -9,7 +21,7 @@
 
 // speed
 int setpoint = 0;
-
+float total_time_passed = 0;
 // variable to store character recieved from terminal
 char x;
 
@@ -20,6 +32,7 @@
 extern int32_t e;
 extern int32_t xState;
 extern int32_t u;
+extern int time_passed;
 
 int16_t position;
 
@@ -58,7 +71,7 @@
 
 
 /******************************************************************************
-                           User interface
+                           User interface 1
 ******************************************************************************/
 /*
 void consoleUI(void)
@@ -137,15 +150,15 @@
         // by incrementing u
         else if(x == 'w') {
             setpoint_mutex.lock();
-            if ( setpoint < 506 ) 
+            if ( setpoint < 560 ) 
             {
                 //setpoint = setpoint + SPEED_STEP;
-                setpoint = 400;
+                setpoint = 280;
             }
             setpoint_mutex.unlock();
 
             // display speed
-            bluetooth.printf("\r\n %5d", setpoint);
+            //bluetooth.printf("\r\n %5d", setpoint);
         }
 
         // if s is pressed decrease the speed
@@ -155,7 +168,7 @@
             setpoint_mutex.lock();
             if (setpoint > -560) 
             {
-                setpoint = -400;
+                setpoint = -280;
                 //setpoint = setpoint - SPEED_STEP;
             }
                 
@@ -189,9 +202,18 @@
     
     position += dPosition;
     
+    
+    
     //bluetooth.printf("\r\nPos: %d, dP: %d, dT: %d, Kp: %f, Ki: %f, vel: %d, e: %d", position, dPosition, dTime, Kp, Ki, vel, e);
     
-    bluetooth.printf("\r\ndP: %d, vel: %d, (Kp*e) Kp: %f, (Ki*xState) Ki: %f, e: %d, xState: %d, u: %d", dPosition, vel, Kp, Ki, e, xState , u);
+    //bluetooth.printf("\r\ndP: %d, vel: %d, (Kp*e) Kp: %f, (Ki*xState) Ki: %f, e: %d, xState: %d, u: %d", dPosition, vel, Kp, Ki, e, xState , u);
+    
+    
+    bluetooth.printf("\r\n %d,   ", e);
+    bluetooth.printf("%d,   ", dPosition);
+    bluetooth.printf("%d,   ", xState);
+    bluetooth.printf("%d,   ", u);
+    
     
     //bluetooth.printf("\r\ne: %d, Pos: %d, dP: %d, xState: %d, u: %d, dT: %d", e, position, dPosition, xState, u, dTime);