ManualControl

Dependencies:   TPixy-Interface

Fork of MbedOS_Robot_Team by ECE4333 - 2018 - Ahmed & Brandon

Files at this revision

API Documentation at this revision

Comitter:
asobhy
Date:
Sat Feb 10 19:35:21 2018 +0000
Parent:
4:417e475239c7
Child:
7:73fd05fe556a
Commit message:
02/10/2018

Changed in this revision

PiControlThread.cpp Show annotated file Show diff for this revision Revisions of this file
ui.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/PiControlThread.cpp	Fri Feb 09 18:37:11 2018 +0000
+++ b/PiControlThread.cpp	Sat Feb 10 19:35:21 2018 +0000
@@ -39,7 +39,8 @@
 {
     DE0_init();                  // initialize FPGA
     motorDriver_init();          // initialize motorDriver
-    PiController_init(2.2,0.01); // initialize the PI Controller gains and initialize variables
+    //                Kp,Ki
+    PiController_init(1,0.4); // initialize the PI Controller gains and initialize variables
     
     PiControlId = osThreadCreate(osThread(PiControlThread), NULL);
 
--- a/ui.cpp	Fri Feb 09 18:37:11 2018 +0000
+++ b/ui.cpp	Sat Feb 10 19:35:21 2018 +0000
@@ -166,19 +166,19 @@
         }
         else if (x=='i')
         {
-            Ki = Ki + 0.001;
+            Ki = Ki + 0.01;
         }
         else if (x=='k')
         {
-            Ki = Ki - 0.001;
+            Ki = Ki - 0.01;
         }
         else if (x=='o')
         {
-            Kp = Kp + 0.01;
+            Kp = Kp + 0.1;
         }
         else if (x=='l')
         {
-            Kp = Kp - 0.01;    
+            Kp = Kp - 0.1;    
         }
         
         // error wrong input
@@ -191,7 +191,7 @@
     
     //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: %f, Ki: %f, e: %d, xState: %d", dPosition, vel, Kp, Ki, e, xState);
+    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\ne: %d, Pos: %d, dP: %d, xState: %d, u: %d, dT: %d", e, position, dPosition, xState, u, dTime);