kao yi
/
Bov3
wu
Fork of CCC by
Diff: main.cpp
- Revision:
- 16:b78dce5c0e98
- Parent:
- 15:585df3979be8
- Child:
- 17:3dac99cf2b89
--- a/main.cpp Sun Jun 29 14:02:25 2014 +0000 +++ b/main.cpp Sun Jun 29 14:32:30 2014 +0000 @@ -15,8 +15,8 @@ #define task_ma_time -#define car_center 64 - +#define R_target 20 +#define L_target 108 @@ -54,6 +54,7 @@ static int b_r_c=64; +static int b_l_c=64; static int pre_b_r_c; static double v_motor; @@ -71,11 +72,11 @@ b_r_c=cam.black_centerR(); + b_l_c=cam.black_centerL(); + //if(b_r_c==-1) + // b_r_c=pre_b_r_c; - if(b_r_c==-1) - b_r_c=pre_b_r_c; - - pre_b_r_c=b_r_c; + //pre_b_r_c=b_r_c; Thread::wait(t_cam); } @@ -144,8 +145,11 @@ while(1){ - - v_servo=cam_to_M_ctrlr.compute(b_r_c,car_center); + if(b_r_c!=-1) + v_servo=cam_to_M_ctrlr.compute(b_r_c,R_target); + if(b_l_c!=-1) + v_servo=cam_to_M_ctrlr.compute(b_l_c,L_target); + @@ -211,7 +215,7 @@ // Thread thread(ctrl_thread); Thread th_s(servo_thread); Thread th_m(motor_thread); - Thread th_de(de_thread); + // Thread th_de(de_thread); while(1){