Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Diff: Control/drivecontrol.cpp
- Revision:
- 22:1a02d66218e4
- Parent:
- 21:694ff00652de
- Child:
- 23:953651133b29
--- a/Control/drivecontrol.cpp Sat May 20 23:31:30 2017 +0000 +++ b/Control/drivecontrol.cpp Sun May 21 03:09:44 2017 +0000 @@ -16,13 +16,13 @@ // Sensor offsets //float FRONT_SENSOR_THRES = 7.0f, SENSOR_ERROR_OFFSET = 0.0f; -float FRONT_SENSOR_THRES = 6.0f, SENSOR_ERROR_OFFSET = 0.0f; -float LEFT_WALL_THRES = 0.5f, RIGHT_WALL_THRES = 0.3f; -float RIGHT_SIDE_WALL_THRES = 0.30f, LEFT_SIDE_WALL_THRES = 0.24f; +float FRONT_SENSOR_THRES = 2.2f, SENSOR_ERROR_OFFSET = 0.0f; +float LEFT_WALL_THRES = 0.527f, RIGHT_WALL_THRES = 0.358f; +float RIGHT_SIDE_WALL_THRES = 0.20f, LEFT_SIDE_WALL_THRES = 0.20f; // Motor speed offsets float left_speed, right_speed, motor_speed; -float MOTOR_BASE_SPEED = 10.0f; +float MOTOR_BASE_SPEED = 12.0f; float cool_down_offset = 0.0f; // Encoder offsets @@ -93,7 +93,7 @@ void one_cell_turned(){ leftEncoder.reset(); rightEncoder.reset(); - while(leftEncoder.getEncoderDistance(1)<-46000 & leftEncoder.getEncoderDistance(1)<46000){ + while(leftEncoder.getEncoderDistance(1)<-45500 & leftEncoder.getEncoderDistance(1)<45500){ //Do nothing } } @@ -148,7 +148,7 @@ void DriveControl::print_serial_ports(){ pc.printf("LEFT Encoder Reading %d\n\r", leftEncoder.getEncoderDistance(1)); pc.printf("RIGHT Encoder Reading %d\n\r", rightEncoder.getEncoderDistance(0)); - pc.printf("FRONT TOP RIGHT IRSensor %f\n\r", rightFrontIR.readIR() * 500); + pc.printf("FRONT TOP RIGHT IRSensor %f\n\r", rightFrontIR.readIR() * 1000); pc.printf("FRONT TOP LEFT IRSensor %f\n\r", leftFrontIR.readIR() * 10); pc.printf("LEFT Diagonal Sensor %f\n\r", leftDiagonalIR.readIR()); pc.printf("RIGHT Diagonal Sensor %f\n\r", rightDiagonalIR.readIR()); @@ -210,11 +210,11 @@ int max_two = (- leftEncoder.getEncoderDistance(1) < rightEncoder.getEncoderDistance(0)) ? rightEncoder.getEncoderDistance(0):- leftEncoder.getEncoderDistance(1); - return max_two > 46000; + return max_two > 45500; } bool DriveControl::has_front_wall() { - bool right_front_wall = (rightFrontIR.readIR() * 500) > FRONT_SENSOR_THRES; + bool right_front_wall = (rightFrontIR.readIR() * 1000) > FRONT_SENSOR_THRES; bool left_front_wall = (leftFrontIR.readIR() * 10) > FRONT_SENSOR_THRES; return right_front_wall && left_front_wall; }