Dewmina's Thoughts

Giving Kobuki Eyes: My Journey with Freenect and Open Source

Where the Journey Began: RoboGames

As undergraduates at the Department of Computer Science and Engineering, University of Moratuwa, we had the privilege of organizing Sri Lanka’s flagship virtual robotics competition, IESL RoboGames. The primary goal of this initiative was to eliminate the financial barrier of hardware, allowing participants to focus purely on algorithms and autonomous decision-making.

In the final round of the competition, each team was provided with a Kobuki base robot, an Xbox 360 Kinect sensor, and a Raspberry Pi acting as the robot’s brain. Their task? Develop an autonomous solution using this platform to complete a given challenge.

Although I served as the chair of the competition, I found myself deeply immersed in the technical side of things. Our team had to prepare the Raspberry Pi OS environment, solve several configuration challenges (which deserve a post of their own), and prepare a consistent software platform for all teams.

We initially used a Python package for Kobuki, which, as we soon discovered, lacked compatibility with Python 3. With some tweaking and testing, we got it running on our setup — our robot now had a body and a brain. The next step: giving it eyes and ears. That's where the Kinect sensor came in.

Making the Kinect Work

Our plan was to use the libfreenect driver to interface with the Xbox 360 Kinect sensor. While it once had solid community support, the reality was that the project had been mostly inactive for over two years, a lifetime in the software world.

Undeterred, we created our own fork and set up a custom repository. I documented the entire installation process from scratch to help others, a small contribution, but one that felt necessary.

Once installed, the sensor was detected, and we verified its hardware components were functioning. However, our anticipated Python wrapper was broken, the module simply didn’t work with modern systems.

While others in the team focused on the algorithmic part of the challenge (as organizers, we had to complete the task ourselves first before handing it over to participants), I dove into the library codebase. We created a temporary workaround using OpenCV to access only the RGB stream, but I wasn’t satisfied with a half-functional sensor.

After hours of reading through legacy documentation and testing, I eventually patched the Python wrapper to work with the complete Kinect functionality, RGB, depth, and more — restoring full support on Python 3. At last, our autonomous robot had sight.

My Desire to Contribute to Open Source

This all happened around three months ago. The competition concluded as a tremendous success, raising the bar for robotics contests in Sri Lanka. However, the academic semester soon demanded our full attention, and the Kinect project had to be shelved temporarily.

Last week, I finally found time to revisit the wrapper. My initial intention was to open a GitHub issue, maybe even contribute a patch. But I noticed that the original repository had seen no active contributions in over two years. So, I made a decision: create a new Python package and publish it on PyPI.

Building the PyPI Module

This was my first time publishing to PyPI. The wrapper used Cython, where Python interfaces with C code to bind low-level Kinect functionality. Setting this up wasn't trivial.

The first roadblock came during the packaging step with twine. An error pointed to invalid license metadata, something I hadn’t even defined explicitly. After some digging through GitHub issues, I learned it was a compatibility issue between twine and newer versions of setuptools. Eventually, I resolved it.

The next challenge: since the wrapper includes compiled C code, the wheel (.whl) files were system-specific. To maintain broader compatibility, I published a source distribution (.tar.gz) instead. After verifying everything worked with TestPyPI, I pushed the final release.

You can now install the package using:

pip install freenect

A Word of Gratitude

Growing up, I was a heavy user of free and open source software. Limited by hardware constraints, Linux became my OS of choice — a gateway into the world of FOSS. Over time, I moved away from pirated software, switching entirely to open source or free-tier alternatives.

I've always admired the global community of contributors who quietly build the digital foundations many of us rely on. I dreamed of one day giving back, maybe by writing documentation, or submitting a patch. And now, here I am, publishing my first Python package.

I owe a heartfelt thank you to the contributors of the freenect project for reverse-engineering proprietary hardware and making it accessible to all. Their work not only helped us build a successful robotics competition platform but also gave me my own start in open source contribution.