Clark Lin
/
BX-car
Fork of BX-car by
Diff: main.cpp
- Revision:
- 16:7ada30380595
- Parent:
- 15:3fa780990a6a
--- a/main.cpp Mon Jun 30 02:54:45 2014 +0000 +++ b/main.cpp Mon Jun 30 03:13:49 2014 +0000 @@ -32,7 +32,7 @@ //out_min out_max servo range // -DigitalOut task_pin(PTD1); +DigitalOut task_pin(PTD1);` TSISensor tsi; int main() { @@ -150,25 +150,9 @@ 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; - integral = 0.3 * integral + error; //0.3 is the factor to make old datas become smaller - derivative = error - last_error; - - //turn = error*Kp + integral*Ki + derivative*Kd; - - if(error < -8 && error >8){ - servo.set_angle(0.085); - } - else if (error > 8 && error <108){ - servo.set_angle(0.085+turn); - } - else if (error <-8 && error>-20){ - servo.set_angle(0.085+turn); - }*/ - last_error = error; - servo.set_angle(0.05); + servo.set_angle(PID_v);