Skip to content

Commit

Permalink
removed delay, tuned constants for smooth line follow
Browse files Browse the repository at this point in the history
  • Loading branch information
robrighter committed May 26, 2012
1 parent 2945c5d commit c8008fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions line-follower.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@ int integral = 0;


//use these functions to tune the constants //use these functions to tune the constants
int apply_kp(int p){ int apply_kp(int p){
return p/22; return p/10;
} }


int apply_kd(int d){ int apply_kd(int d){
//For initial tuning we set the constant to 0 //For initial tuning we set the constant to 0
return d/4; return d;
} }


int apply_ki(int i){ int apply_ki(int i){
//For initial tuning we set the constant to 0 //For initial tuning we set the constant to 0
return i/20000; return i/6000;
} }


int get_value_within_max(int value, int max){ int get_value_within_max(int value, int max){
Expand Down
7 changes: 3 additions & 4 deletions main.c
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ int main()
while(1){ while(1){
while(!button_is_pressed(BUTTON_B)){} while(!button_is_pressed(BUTTON_B)){}
wait_for_button_release(BUTTON_B); wait_for_button_release(BUTTON_B);
delay_ms(1000);


pololu_3pi_init(2000); pololu_3pi_init(2000);
calibrate_for_line(); calibrate_for_line();


reset_line_follower(); reset_line_follower();


//just follow the line for a little while while testing //just follow the line for a little while while testing
int counter = 0; while(1){
while(counter++ < 330){ set_motors_by_position(140,read_and_display_sensor_data());
set_motors_by_position(110,read_and_display_sensor_data());
delay_ms(100);
} }
set_motors(0,0); set_motors(0,0);
} }
Expand Down

0 comments on commit c8008fc

Please sign in to comment.