For those who are feeling a bit intimidated by PID loops, here's a really clear and easy to understand tutorial from an autopilot project. The code examples are C++, but they're easy to translate to C.
I wrote up a little PID tutorial as part of an explanation of the FlightGear autopilot. It's a little bit different angle on the subject so it might work for people that are put off by reading code. I've used a few math equations, but if you slow down and pick your way through them carefully, they are very simple. If you are able to add, subtract, and multiply real numbers you can understand my math. :-)
Comments
http://www.flightgear.org/Docs/XMLAutopilot/node2.html