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
Yes
How will you recognise that the 'bot is moving along a straight line ? Assuming that you can do that, then when a turn is detected how quickly can the 'bot slow down ?
Depends. If error is beetween 100 and -100, else if error > 100 II error <-100 it uses pid to do the turns. But I am asking I am not sure I can do that
it boils down to how often do you read the sensors so that you don't loose "sight" of the line. if no sensor is detecting a line, then you don't really know where you are (may be could guess based on last sensor which has seen the line, but hard call as you've been moving in between and would need to track back)
so how wide is the line, how many sensors do you have and what is the geometry? and then based on speed of the robot and the speed of sampling you can make a guess on how fast you can go to not loose the line when hitting a turn.
then there is the mechanical part, how fast can you go in a sharp curve, how hard can you hit the breaks, etc....
But can I use max speed in straight line?
Yes, as long as you can slow down enough to follow the curves