Hello.
I split your post into its own thread because it was not very related to the thread you added it to. I have made a number of forum posts in the pasts with suggestions on how to tune PID constants for line followers, so I suggest you start off by searching the forum a bit. Here is one such thread:
I suggest you eliminate the integral term from your PID calculation and tune the Kp and Kd terms until it can follow a straight or gently curving line without oscillating (you might want to try a much higher Kd term relative to Kp; the constants I used on my 3pi line follower were Kp = 1/7 and Kd = 4). Note that PID line following will not necessarily work well on lines that abruptly change direction, so you might want to implement some special cases that override the PID following if the line is lost for more than some period of time.
- Ben
