Advanced Line Follower

I’m making a line follower with n20 motors (733 rpm), qtr rc sensor, l298n driver motor, arduino uno R3…
I use pid, it does the tracks with curves with a good speed, but I want it to accelerate as much as possible on the straights and when a curve appears, decelerate is this possible? Basically I want to use the maximum power of the motors on the straights

Hello.

Generally, you should want the robot to be going its fastest at all times (not just during straight sections). So, before trying to have special logic to accelerate during straights, you might try looking into why it cannot take turns at high speeds (e.g. could the PID be tuned better, is it losing traction, does it need special logic to handle sharp turns?).

If your robot is just hitting a physical limitation for how quickly it can turn, there are probably a several ways you could add the kind of acceleration behavior you are talking about. One idea would be to increase the maximum speed while the calculated error is within a certain range. However, it might be tricky to recognize a turn is coming and slow down unless your course has some built-in way to indicate that, and if it accelerates too much during a straight segment it might have problems with overshooting the turn.

Brandon

I were thinking something like this If error is beetween 100 and -100 use max speed, else if error > 100 II error <-100 it uses pid to do the turns. What do u think