I hacked together a self balancing inverted pendulum machine demo in javascript using p5.js for the graphics and box2d for physics.  Having learned about this stuff ages ago in control systems class, it’s time to relearn principles of PID controllers and see if this will work.  It is also the principle behind the segway carts.

thumbnail_pendulum

The result is kind of fun.  One can attempt to balance some boxes on top of the inverted pendulum to see how well it can try to support and balance them.

load supporting self balancing inverted pendulum

A video posted by @hardmaru on