Modernizing librobotcontrol: Kernel 6.12

Hi everyone,

I recently worked on a project for a professor at my university who needed the classic librobotcontrol library updated to run on modern OS images for his robotics course. I wanted to share my results here in case anyone else is struggling with the library.

The original librobotcontrol relies on deprecated Sysfs interfaces. On Kernel 6.12+ these interfaces are mostly gone or changed.

I created a targeted port for the BeagleBone Green to rescue the core robotics features:

Hardware Paths: Replaced the broken hardcoded paths with the stable /dev/bone/ symlinks (e.g., /dev/bone/pwm, /dev/bone/counter).

GPIOs: Integrated libgpiod to replace the old /sys/class/gpio calls for the critical tests.

Dynamic Pins: Motor initialization now dynamically finds the correct pins via gpio-line-names from the Device Tree, rather than relying on hardcoded paths.

You can check out the code, along with a detailed VALIDATION.md of what works and what doesn’t, on my GitHub:

Additionally, there is a second branch in the repository called windows-bundle. This branch contains highly specific modifications for our internal university course, where we use an ELEGOO Tumbller shield. If anyone is working with similar hardware, you might find these additions useful:

  • Tumbller Detection: Added automatic hardware detection for the Tumbller chassis inside model.c.

  • Centralized Pin Mapping: The pin-name structs are now centrally managed in model.c. Depending on the detected model, all other modules dynamically query model.c to get the correct gpio-line-names.

  • Flexible PWM: Made the PWM initialization more flexible to accommodate the shield.

  • MPU-6500 I2C Fix: Resolved I2C bus lockup issues. The original library expects an MPU-9250 (which has a compass). Our Tumbller uses an MPU-6500 (no compass). The driver now detects the missing magnetometer and safely disables the bypass mode to prevent crashes.

Some of these changes might be useful even if you don’t use the Tumbller.

Feel free to use the code or use it as a starting point for further modernizations!

Cheers,

Jakob