Hello everyone,
I have been tinkering around with the sample maze solving code included in the Pololu library, and I am having difficulties increasing the turning speed. My main goal is to make my 3pi run as efficiently as the prototype 3pi in the “Pololu 3pi Maze Solving Robot” video in the 3pi User’s Guide. Every time I increase the turning speed, the robot tends to either record a non-existent turn (such as recording a straight or ‘S’ turn when there is no intersection present) or veer off the track. I have tried tuning the PID constants, modifying the turning delays and speeds, and increasing the base speed, but to no avail. Reading the “Improving the Maze-Solving Code” in the 3pi User’s Guide did not provide me with much insight on this problem either.
I am not a master programmer, so I apologize if I am making some simple mistake. Here is my modified version of the file “turn.c”:
void turn(char dir)
{
switch(dir)
{
case 'L':
// Turn left.
red_led(HIGH); // Some simple light effects
play("L16 c"); // Some simple sound effects
set_motors(-150,150);
delay_ms(100);
red_led(LOW);
break;
case 'R':
// Turn right.
green_led(HIGH); // Simple light effects
play("L16 e"); // Simple sound effects
set_motors(150,-150);
delay_ms(100);
green_led(LOW);
break;
case 'B':
// Turn around.
set_motors(0,0); // Stop the motors while performing sound & light effects
play("L16 O7 a#>a#a#>a# !");
int i = 0;
while(i<2)
{
red_led(HIGH);
delay_ms(15);
red_led(LOW);
delay_ms(15);
green_led(HIGH);
delay_ms(15);
green_led(LOW);
delay_ms(15);
i++;
}
set_motors(200,-200);
delay_ms(150);
break;
case 'S':
// Don't do anything!
break;
}
}
And here is my modified version of the PID constants in the file “follow-segment.c”:
//int power_difference = proportional/20 + integral/10000 + derivative*3/2; //ORIGINAL
int power_difference = proportional/5 + integral/4000 + derivative*3/2; //MODIFIED
Please note that I am asking for advice only; I am not requesting that someone write the code for me. Any help is greatly appreciated.