Technokat's website (
www.teachnokats.org), under resources, has all the autobalance stuff in the archive section. Their's is somewhat specific to their implementation of "balancing," so be sure to look at everything carefully. Their robot crawled up the ramp and then returned when it started to tip.
I'm sure that if you start programming such a platform, your intuition and trials will lead you toward something like what you want. Keep up updated on how it goes.