I’m new to PID but wouldn’t it be possible to program a line following robot that adjusted it’s own PID values? I’m just figuring, if Kp is determined by watching the bot and adjusting based on it’s oscillation and sensitivity to corners, couldn’t a program say
I swayed off the track to sensor number n,
change the Kp value,
did it sway more or less this time
Then loop that until you reach a point where the value causes it to sway more.
This is a very basic idea, there is a lot more that needs to be taken into account but it’s an idea I thought about creating a project on. I figure I would see if it is possible first.
You might be able to do something like this, and I’d love to hear all about it if you do, but I think it will be a lot of work, and I don’t think it will be worth it unless your goal is the novelty of it. Part of the problem is that you’re searching for an optimum in a two-dimensional space (three-dimensional if you include the integral coefficient, I, but I think I doesn’t do much for you when it comes to line following), and the dependency of robot speed on performance further complicates things.
Basically, I think it will be difficult to write a program that can adequately analyze the performance of your robot, which might make the alternative approach of just watching your robot run (it’s pretty easy to see if it’s overshooting or undershooting) seem relatively attractive. And even if you do program your robot to learn its own PID constants, you will still likely have to supervise it since it’s probably going to need your help to get back on the line when it inevitably loses it due to poorly tuned constants.
Interesting you mention the manual portion. My first goal was going to be just that. I was going to have it run the track and the user would press a + or - based on the results, the program would then change the Kp value and run again. After that I was hoping to be able to develop a software based calibration.
I was just looking for a cool project, I always like ones that involve some computer learning mechanism, even though this would be very rudamentary as far as that goes but still seemed like a neat idea.
Thanks for the input, I will be sure to post my findings in the projects forum when I get started on this.
By the way, I’m not necessarily trying to discourage you from doing this. As PageFault’s video demonstrates, what you’re trying to do is clearly possible. I feel like the task will be somewhat like taking the stairs to get to the roof of a skyscraper rather than riding an elevator to get to the observation deck below. Taking the stairs might be fun (good exercise and a sense of accomplishment), and the final destination might be cooler, but it’s also going to be a lot more work. I just want to make sure you appreciate the magnitude of the challenge compared to your alternatives before you start working on it.