4
$\begingroup$

See the video below of my balancing robot.
Balancing robot

I was having trouble getting it to balance on hard surfaces but finally got it after playing with the PID gains a lot. Previously it was balancing just fine on carpet.

I set the PID gains by just picking a Kp, then increasing Ki until the robot oscillated very badly and tried to smash it's self into the ground, then increasing Kd until it was finally stable. Here's the gains I'm using in the video.

  Kp=20, Ki=4.5, Kd=45;

It will sit in one spot balancing without any problem. You can see in the video that it can even stop from falling after I give it a pretty good kick. The problem is that it stops from falling over but then greatly overshoots the other direction. In the video you can see when I give it just a small tap it runs the other way for a while before finally becoming stable again.

Any suggestions on what to try next?

$\endgroup$
  • $\begingroup$ Just out of interest, why did you tune Ki before tuning Kd? I have always found Kp, Kd then Ki the best order to tune a PID loop. Were you following any specific advice? $\endgroup$ – Mark Booth Apr 8 '13 at 11:22
  • $\begingroup$ Just trial and error really. Should I try doing Kd first next time? $\endgroup$ – JDD Apr 8 '13 at 11:39
  • $\begingroup$ If you haven't already followed the advice at What are good strategies for tuning PID loops? then I would suggest that you look there first. Once you have done that, feel free to ask about specific problems with your system which aren't answered by that question. For the moment though, I think this is a duplicate of that question. Feel free to edit this question and flag it if you can make it less of a duplicate. $\endgroup$ – Mark Booth Apr 8 '13 at 15:31

Browse other questions tagged or ask your own question.