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.
Diff: main.cpp
- Revision:
- 11:e04dc2090433
- Parent:
- 10:761333231e50
- Child:
- 12:915f22e7d7d9
--- a/main.cpp Thu Mar 26 19:01:48 2015 +0000 +++ b/main.cpp Thu Mar 26 19:14:36 2015 +0000 @@ -205,7 +205,8 @@ { //turn away a little bit for each frame that is wall if (left_counter >-.4) - left_counter -=.05; + //left_counter -=.05; + left_counter -=.03; turn_left=true; turn_right=false; @@ -227,7 +228,8 @@ { //turn away a little bit for each frame that is wall if (right_counter <.4) - right_counter +=.05; + //right_counter +=.05; + right_counter +=.03; turn_left=false; turn_right=true; @@ -247,7 +249,7 @@ else if (turn_right == false and turn_left == false and (violence_level !=0)) { TFC_SetServo(0,(0.0+ bullshit_offset)); - TFC_SetMotorPWM(current_left_motor_speed-(.0001*num_of_straight), current_right_motor_speed+(.0001*num_of_straight)); // --left is faster, ++right is faster + TFC_SetMotorPWM(current_left_motor_speed-(.00005*num_of_straight), current_right_motor_speed+(.00005*num_of_straight)); // --left is faster, ++right is faster if (violence_level !=0) num_of_straight++; } @@ -267,7 +269,7 @@ if(left_counter > -.2) // small turn, normalize quickly left_counter += .015; else // hard turn, normalize slowly - left_counter += .004; + left_counter += .01; // no longer turning boolean if (left_counter > (0+ bullshit_offset)) @@ -279,7 +281,7 @@ need_decel = false; } else // turning speeds - TFC_SetMotorPWM(current_left_motor_speed+(.2*left_counter), current_right_motor_speed+(.35*left_counter)); // ++left is slowed, ++right is faster + TFC_SetMotorPWM(current_left_motor_speed+(.3*left_counter), current_right_motor_speed+(.3*left_counter)); // ++left is slowed, ++right is faster }// end of turn left // set servo and motors according to how much right we need to turn @@ -294,7 +296,7 @@ if(right_counter < .2) // small turn, normalize quickly right_counter -= .015; else // hard turn, normalize slowly - right_counter -= .004; + right_counter -= .01; // no longer turning boolean @@ -307,7 +309,7 @@ need_decel = false; } else // turning speeds - TFC_SetMotorPWM(current_left_motor_speed-(.35*right_counter), current_right_motor_speed-(.2*right_counter)); // --left is faster, --right is slowed + TFC_SetMotorPWM(current_left_motor_speed-(.3*right_counter), current_right_motor_speed-(.3*right_counter)); // --left is faster, --right is slowed } // end with turn right