Train Your Robot To Walk with a Neural Network
[Basti] was playing around with Artificial Neural Networks (ANNs), and decided that a lot of the “hello world” type programs just weren’t zingy enough to instill his love for the networks in others. So he juiced it up a little bit by applying a reasonably simple ANN to teach a four-legged robot to walk (in German, translated here).
Source: Elliot Williams
While we think it’s awesome that postal systems the world over have been machine sorting mail based on similar algorithms for years now, watching a squirming quartet of servos come to forward-moving consensus is more viscerally inspiring. Job well done! Check out the video embedded below.
The details of the network are straightforward. In order to reduce the number of output states, each servo can only assume three positions. The inputs include the current and previous leg positions. It’s got a distance sensor on the front, so it can tell when it’s made progress, and that’s it. The rest is just letting it flail around for fifteen minutes, occasionally resetting its position.
This is all made possible by a port of the Fast ANN library to the Cortex M4 microcontrollers, which in turn required [Basti] to port a small read-only filesystem to the chips. Read through his blog for details, or jump straight to the code if that’s more your style.
We’d say that if you’re interested in learning about ANNs, a hands-on application like this is a fantastic motivator. If you’d like to brush up on the basics before diving in, check out [Al]’s two-part series (one and two) on the subject. Meanwhile, we leave you with videos of flailing zip-tied Lego bricks.