For the purpose of learning something about control systems, I built and programmed a robot using the LEGO® Mindstorms NXT that balances on two wheels (a type of inverted pendulum).
The robot uses a gyro sensor, which measures angular velocity, to counteract tilting. For example, if the robot starts to fall forward, the gyro sensor will read a positive angular velocity. As a result, the control system will correct for this by turning the robot's wheels forward to keep the robot vertical.
The control system that I made to keep the robot balancing is not a formally designed control system, and I am still working to improve the design.
I give credit to HiTechnic for making the gyro sensor and for supplying information about balancing robots. HiTechnic Website: http://www.hitechnic.com/
Video of the Alectric Labs Balancing Bot
This video continuously loops. Click anywhere on the center of the video to end it.