car using PID from centre line
Dependencies: FRDM-TFC mbed CBuffer XBEE mbed_angular_speed motor2 MMA8451Q
Fork of KL25Z_Camera_Test by
Diff: main.cpp
- Revision:
- 47:6a58dcef714f
- Parent:
- 46:6806ea59ffed
- Child:
- 48:daa2a1900ada
diff -r 6806ea59ffed -r 6a58dcef714f main.cpp --- a/main.cpp Mon Mar 27 17:53:17 2017 +0000 +++ b/main.cpp Thu Apr 27 07:40:02 2017 +0000 @@ -80,7 +80,7 @@ accc = checkAcc(); } - if(accc < 0.2f) { + if(accc < 0.25f) { handleStartStop(); } else { //sendString("up %f", accc); @@ -161,22 +161,22 @@ case 0: initPID(&servo_pid, 2.2f, 0.6f, 0.f); speed = 40; - ed_tune = 1.0f; + ed_tune = man_tuner; break; case 1: initPID(&servo_pid, 2.2f, 0.6f, 0.f); - speed = 80; - ed_tune = 1.0f; + speed = 65; + ed_tune = man_tuner; break; case 2: initPID(&servo_pid, 2.2f, 0.6f, 0.f); - speed = 100; - ed_tune = 1.0f; + speed = 80; + ed_tune = man_tuner; break; case 3: initPID(&servo_pid, 2.2f, 0.6f, 0.f); - speed = 120; - ed_tune = 1.0f; + speed = 110; + ed_tune = man_tuner; break; } @@ -438,9 +438,9 @@ if(left_motor_pid.output > 1.0f) { left_motor_pid.output = 1.0f; } - if(left_motor_pid.output > 0.75f) { + /*if(left_motor_pid.output > 0.75f) { left_motor_pid.output = 0.75f; - } + }*/ if(left_motor_pid.output < 0.0f) { left_motor_pid.output = 0.0f; } @@ -449,9 +449,9 @@ right_motor_pid.output = 1.0f; } - if(right_motor_pid.output > 0.75f) { + /*if(right_motor_pid.output > 0.75f) { right_motor_pid.output = 0.75f; - } + }*/ if(right_motor_pid.output < 0.0f) { right_motor_pid.output = 0.0f; }