good

Dependencies:   mbed

Fork of BX-car by Clark Lin

Revision:
9:33b99cb45e99
Parent:
8:8e49e21d80a2
Child:
10:d2401a243e8d
diff -r 8e49e21d80a2 -r 33b99cb45e99 main.cpp
--- a/main.cpp	Sun Jun 22 15:29:20 2014 +0000
+++ b/main.cpp	Tue Jun 24 10:06:54 2014 +0000
@@ -11,6 +11,7 @@
 #define motor_on 
 #define Pcontroller
 #define task_ma_time
+#include "TSISensor.h"
 
 Serial pc(USBTX, USBRX);
 
@@ -24,16 +25,23 @@
 
 BX_pot pot1('1');
 
-                // 90/30=3
-PID cam_to_M_ctrlr(3.0,0.0,0.0,10);
+                                 // 90/30=3
+PID cam_to_M_ctrlr(10.0,118.0,0.06,0.11,(0.104/30),0.0,0.0,10);
 
 DigitalOut task_pin(PTD1);
-
+TSISensor tsi;
 int main() {
     
-     
+    
+       pc.baud(115200);
+    
+     while(1){
+         
+       if(tsi.readPercentage()>0.00011)
+           break;
+     }
      
-     pc.baud(115200);
+    
      
      
       double motor;
@@ -131,7 +139,7 @@
        
                b_r_c=(double)cam.black_centerR();
 
-         PID_v=cam_to_M_ctrlr.compute(b_r_c,64.0);
+         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);