Close

PC-based Universal Controller Emulator working

A project log for Stubby the (Teaching) Hexapod

100% open source robot platform with accessability and affordability in mind: teaching children of all ages about robots & programming

The Big One 12/31/2014 at 21:260 Comments

I have finished a preliminary version of a 'Universal Controller Emulator', written in Python. This should help those who want to play with Stubby, but cannot find a PS2 controller to re-purpose.

The program is very simple (currently about 150 lines), and is written in Python (I tested it on python 2.7 in Debian Jessie). It requires the pyserial and pygame libraries (both of which are available across all major platforms).

The controls are simple: use the keyboard to emulate the Universal Controller.

That's all that is implemented so far (and that is all that is currently used by Stubby). If you want to extend this program to support other keys, it would be very easy to do so.

Note that in order to get key press / release events working in a cross platform manner, I need to use pygame (and I need to open a SDL window, which in turn requires focus). It is just an empty, black window at 320x200 pixels in size. I'm not a fan of it, but it works.

You can download this program from the GitHub repository, under the 'python' folder.

Cheers

Discussions