running car

Dependencies:   mbed mbed-rtos

Fork of Boboobooo by kao yi

Revision:
10:03d5aa2511c4
Parent:
9:33b99cb45e99
Child:
11:418e39749f48
diff -r 33b99cb45e99 -r 03d5aa2511c4 main.cpp
--- a/main.cpp	Tue Jun 24 10:06:54 2014 +0000
+++ b/main.cpp	Thu Jun 26 09:15:35 2014 +0000
@@ -26,7 +26,7 @@
 BX_pot pot1('1');
 
                                  // 90/30=3
-PID cam_to_M_ctrlr(10.0,118.0,0.06,0.11,(0.104/30),0.0,0.0,10);
+PID cam_to_M_ctrlr(10.0,118.0,0.059,0.105,0.105-0.059,0.00,0.02,10);
 
 DigitalOut task_pin(PTD1);
 TSISensor tsi;
@@ -137,15 +137,20 @@
        
        
        
-               b_r_c=(double)cam.black_centerR();
+         b_r_c=(double)cam.black_centerR();
 
-         PID_v=cam_to_M_ctrlr.compute(b_r_c,15.0);
-         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);
+         PID_v=cam_to_M_ctrlr.compute(b_r_c,64.0);
+         
          
          
+         #ifdef Debug_cam_uart
+        
+         pc.printf("cam %d %d      k:%f  i:%f  d:%f  speed :%f  bk_center %f PID:%f \r\n",cam.de_v,cam.de_v2,cam_to_M_ctrlr.de_kp,cam_to_M_ctrlr.de_ip,cam_to_M_ctrlr.de_dp,motor,b_r_c,PID_v);
+         
+         #endif
         servo.set_angle(PID_v);
         
-        
+      
        
      
       #ifdef task_ma_time