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:
- 51:6a84fbc404c8
- Parent:
- 50:1cfe1f975b0c
- Child:
- 52:af17b1a330f4
diff -r 1cfe1f975b0c -r 6a84fbc404c8 main.cpp --- a/main.cpp Thu Apr 27 15:51:01 2017 +0000 +++ b/main.cpp Thu Apr 27 15:58:18 2017 +0000 @@ -174,7 +174,7 @@ speed = 65; } else{ - speed = 0.6 + speed = 0.6; } ed_tune = man_tuner; break; @@ -184,7 +184,7 @@ speed = 80; } else{ - speed= 0.8 + speed= 0.8; } ed_tune = man_tuner; break; @@ -427,7 +427,7 @@ t.start(); handlePID(&servo_pid); //enables the ED - sensorCorner(left_motor_pid.desired_value,right_motor_pid.desired_value, servo_pid.output,speed,ed_tune); + //sensorCorner(left_motor_pid.desired_value,right_motor_pid.desired_value, servo_pid.output,speed,ed_tune); handlePID(&left_motor_pid); handlePID(&right_motor_pid); @@ -470,9 +470,12 @@ if(right_motor_pid.output < 0.0f) { right_motor_pid.output = 0.0f; } - + if(!torque){ TFC_SetMotorPWM(left_motor_pid.output,right_motor_pid.output); - + } + else{ + dutyCycleCorner(speed,servo_pid.output); + } t.stop(); t.reset(); t.start();