Braaaaaaains!

So, whilst waiting for parts to turn up and paint to dry, I thought I’d make a start on the controls for R2. Simplest would be to just have the drive wheels, dome, and a couple of other bits controlled from a standard hobby RC controller. I’ve got a eight channel one and a few spare receivers so it would’ve been trivial to do that. However, I wanted something a bit more fancy. I’m wanting to have the panels on the dome to be controllable, as well as various controls for the main body panels, arms, fire extinguisher, etc.

My thoughts for this is to use a Raspberry Pi, along with a bunch of peripherals on an i2c bus. Adafruit do a nice i2c 16 channel servo board which a couple of should give enough channels to control everything I want. I will be putting one of these in the dome for all the various flaps, and another in the body for speed controllers and door mechanisms. Using a Pi will give me lots of power for doing controlling the servos and playing sounds, and hopefully I won’t need a real time OS. Future plans will involve voice recognition and maybe even facial recognition!

I’m also wanting to do this as modularly as possible, so to this end my first bit of programming was a daemon to run that listens for commands and sends signals over i2c to the servo controllers. My thinking behind this is that I can write many different interfaces for controls, from a simple web/PHP interface for testing and such like, to another interface to translate bluetooth signals from a PS3 controller. I’ll also be able to write a scripting system to do preset motions.

IMG_0397_CR2_embedded_1

I’ve put the code for my R2 Control software up on github to keep track of changes and such like. If anyone else feels the urge to use it, or even contribute, they are more than welcome to. I’m no programmer, so I may be going down the wrong path for all this, but its a learning experience. The code seems to work pretty well for now, but still needs to be tested in R2. Theres still a couple of things I need to add before I start doing any of the other programs. Currently the servos will move as fast as possible to their new position so I need to add a loop in there to allow different speeds. I also need to add support for multiple i2c addresses. I should have these things coded in fairly soon hopefully, and once my hinges for the dome turn up I can start installing it all and testing.