See the video below of my 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?