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:
- 28:613239f10ba4
- Parent:
- 27:627d67e3b9b0
- Child:
- 29:b5b31256572b
--- a/main.cpp Thu Dec 15 16:39:32 2016 +0000 +++ b/main.cpp Thu Dec 15 16:42:16 2016 +0000 @@ -413,7 +413,7 @@ if(frame_counter % 256 == 0) { float level = TFC_ReadBatteryVoltage() * 6.25; pc.putc('J'); - byte_float_union.a = level; + byte_float_union._float = level; pc.putc(byte_float_union.bytes[0]); pc.putc(byte_float_union.bytes[1]); pc.putc(byte_float_union.bytes[2]); @@ -470,12 +470,12 @@ pc.putc('B'); - byte_float_union.a = wL * WHEEL_RADIUS;//left_motor_pid.output; // + byte_float_union._float = wL * WHEEL_RADIUS;//left_motor_pid.output; // pc.putc(byte_float_union.bytes[0]); pc.putc(byte_float_union.bytes[1]); pc.putc(byte_float_union.bytes[2]); pc.putc(byte_float_union.bytes[3]); - byte_float_union.a = wR * WHEEL_RADIUS; // right_motor_pid.output; // + byte_float_union._float = wR * WHEEL_RADIUS; // right_motor_pid.output; // pc.putc(byte_float_union.bytes[0]); pc.putc(byte_float_union.bytes[1]); pc.putc(byte_float_union.bytes[2]); @@ -494,19 +494,19 @@ byte_float_union.bytes[1] = xb.cBuffer->read(); byte_float_union.bytes[2] = xb.cBuffer->read(); byte_float_union.bytes[3] = xb.cBuffer->read(); - servo_pid.Kp = byte_float_union.a; + servo_pid.Kp = byte_float_union._float; byte_float_union.bytes[0] = xb.cBuffer->read(); byte_float_union.bytes[1] = xb.cBuffer->read(); byte_float_union.bytes[2] = xb.cBuffer->read(); byte_float_union.bytes[3] = xb.cBuffer->read(); - servo_pid.Ki = byte_float_union.a; + servo_pid.Ki = byte_float_union._float; byte_float_union.bytes[0] = xb.cBuffer->read(); byte_float_union.bytes[1] = xb.cBuffer->read(); byte_float_union.bytes[2] = xb.cBuffer->read(); byte_float_union.bytes[3] = xb.cBuffer->read(); - servo_pid.Kd = byte_float_union.a; + servo_pid.Kd = byte_float_union._float; sendString("pid= Kp: %f, Ki: %f, Kd: %f", servo_pid.Kp, servo_pid.Ki, servo_pid.Kd);