Clark Lin / Mbed 2 deprecated BX-car

Dependencies:   mbed

Fork of BX-car by kao yi

Files at this revision

API Documentation at this revision

Comitter:
physicsgood
Date:
Mon Jun 30 02:26:43 2014 +0000
Parent:
13:0f0d341d6d61
Child:
15:3fa780990a6a
Commit message:
QQQ

Changed in this revision

controller.h Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/controller.h	Mon Jun 30 02:10:38 2014 +0000
+++ b/controller.h	Mon Jun 30 02:26:43 2014 +0000
@@ -84,6 +84,9 @@
     float Kc_;
     float tauR_;
     float tauD_;
+    float Kp;
+    float Ki;
+    float Kd;
  
     //Raw tuning parameters.
     float pParam_;
--- a/main.cpp	Mon Jun 30 02:10:38 2014 +0000
+++ b/main.cpp	Mon Jun 30 02:26:43 2014 +0000
@@ -51,7 +51,7 @@
      double b_r_c;
      double PID_v;
      
-     //double Kp = 0.00078, Ki = 0.0000, Kd = 0.0000;;
+     //double Kp = 0.00078, Ki = 0.0000, Kd = 0.0000;
      double integral = 0, derivative = 0, error = 0, last_error = 0, turn = 0;
      
      while(1){
@@ -145,8 +145,9 @@
        
        
                b_r_c=(double)cam.black_centerR();
-
+         pc.printf("b_r_c:  %lf\r\n",b_r_c);
          PID_v=cam_to_M_ctrlr.compute(200,b_r_c,20.0);//set_angle()
+         pc.printf("angle:  %f\r\n",PID_v);
          //pc.printf("%f %d %d speed :%f  bk_center %f PID:%f \r\n",cam_to_M_ctrlr.de_v,cam.de_v,cam.de_v2,motor,b_r_c,PID_v);
             //b_r_c range 0~128
             /*error = 20 - b_r_c;