# Tuning Line follower PID constants with Q-learning

I am currently working on a line follower buggy and have managed to tune the PID constants​ manually. The buggy follows the line at a moderate speed.

I will now like to take things further and learn new things as well. I read about Q-learning and will like to ask if what I am about to implement is on the right track.

I have chosen:

• Three states: last three positions of line sensors
• Three rewards: middle position, end of track and less wobbling (measured with gyroscope).
• Four actions: $Kp$, $Ki$, $Kd$, and Max speed.

The computation will be made on a PC as the robot is wirelessly connected.

• Am I on the right track?
• How do I make the 3 constants have "states" because as I understand, the actions have to be non-analog ?
• Do I create a range of numbers close to the constants I have now and the Q-learning decides which is best ? (It's inefficient to just try random numbers)