$ show PetoiCamp/OpenCat-Quadruped-Robot
This repository provides the firmware and desktop tools for Petoi's quadruped robots (Bittle, Nybble, Chero). The core is an Arduino-based firmware (OpenCat.ino) running on ATmega328P (NyBoard) that handles servo control, gait generation, IMU integration, sensor processing (IR, ultrasonic, gesture, voice), and skill execution via pre-programmed motion sequences. A Python desktop application (pyUI) offers firmware upload, joint calibration, skill composition, and debugging. A Python serial API (serialMaster, OpenCatPythonAPI) enables scripting robot behaviors. The architecture is monolithic firmware with conditional compilation for multiple hardware variants and sensor options. While the project has a large user base and extensive documentation, the codebase shows signs of technical drift: it is explicitly legacy (development moved to OpenCatESP32), relies on outdated libraries, has duplicated code (e.g., three copies of IRremote), and uses global state and hardcoded paths. The skill system and serial protocol are well-defined patterns, but overall reusability is limited by tight coupling to specific hardware and board versions.
The LLM identified 4 files worth highlighting for reuse:
A generic doubly-linked list template implemented in C++ for Arduino. It provides push, pop, insert, remove, and iteration operations. The implementation is self-contained (no internal dependencies) and can be extracted for any embedded project needing a lightweight list. Demonstrates clean template usage and memory management for constrained environments.
A timed FIFO task queue for sequencing robot actions. Tasks are stored with a delay and executed in order. The implementation is independent of the robot hardware and can be reused in any embedded system requiring non-blocking sequential operations. It uses a simple struct and linked list pattern, making it easy to port.
A generic I2C read/write abstraction library supporting multiple backends (Wire, Fastwire, NBWire). It provides functions for reading/writing bytes, words, and buffers with error handling. This is a standalone component that can be reused for any I2C sensor on Arduino-compatible platforms. The code is well-structured and includes timeout and retry logic.
A simple translation system using a dictionary of language dictionaries. It provides a `txt(key)` function to look up strings in the selected language. The pattern is self-contained and can be extracted for any Python GUI application needing multi-language support. It demonstrates a clean, data-driven approach to i18n without external dependencies.