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:
- 10:1bd0224093e4
- Parent:
- 9:aa2ce38dec6b
- Child:
- 11:53de69b1840b
--- a/main.cpp Wed Nov 16 16:05:13 2016 +0000 +++ b/main.cpp Wed Nov 16 16:31:46 2016 +0000 @@ -18,6 +18,8 @@ #define CAM_THRESHOLD 109 #define CAM_DIFF 10 +#define RIGHT_MOTOR_COMPENSATION_RATIO 1.1586276 + //Serial pc(USBTX,USBRX); Serial pc(PTD3,PTD2); XBEE xb(&pc); @@ -216,7 +218,7 @@ if(cmd == 'D') { TFC_InitServos(0.00052,0.00122,0.02); TFC_HBRIDGE_ENABLE; - TFC_SetMotorPWM(speed,speed); + TFC_SetMotorPWM(RIGHT_MOTOR_COMPENSATION_RATIO*speed,speed); integral = 0; } else if (cmd == 'C') {