← all projects

project

ControlPad — game controllers that work headless

Named axes, radial deadzone, expo curves and session recording, so starting a robotics project with a controller doesn't cost an hour of setup.

Date
Dec 2025
Role
Solo build — library, packaging, docs
Status
in progress
Built with
Python 3.10+, pygame, evdev, PyPI packaging

Every time I started a robotics project with a game controller I lost an hour to the same setup: wrangle SDL dummy drivers for the headless Pi, work out which axis index maps to which physical stick, invert Y manually, write a deadzone from scratch. After enough cycles of that I built ControlPad.

The library wraps pygame — and optionally evdev on Linux — behind an API that speaks in human terms. Axes are named, Y is corrected, a radial deadzone is on by default, and expo curves give fine control near centre without giving up range at the edges. The event-driven API registers callbacks with decorators, so application code reacts to changes rather than polling.

The feature I’m most pleased with is session recording. Record a real controller session to a plain JSON file, then replay it in tests with no hardware attached. Sessions store raw pre-filter values, so one recording can be run through different deadzone or expo settings.

What I took away

The headless pygame problem is one every embedded Python developer hits and works around individually. Abstracting it behind a single flag removed the most common point of friction.

Named inputs beat numeric indices for any hardware abstraction. The overhead of remembering that axis 3 is right_x is real and compounds every time someone new reads the code.

Storing pre-filter values in recordings was the right call — it makes a session a stable test fixture that tests application behaviour independently of filter tuning, instead of coupling the two.

Open SourceRobotics