Skip to content
LuwuDynamicsPublic

About

Robot OS

Resources

Stars

9 stars

Watchers

1 watching

Forks

Latest commit

ย 

History

94 Commits

Folders and files

Repository files navigation

Luwu-OS Logo

Luwu-OS

A Lightweight Embedded Desktop OS for Educational Robots
Raspberry Pi CM4 / CM5 ยท Qt C++ Launcher ยท PySide6 Apps ยท Linux Framebuffer

Python C++ Qt Platform License

xgolib xgoedu-luwuos xgo-blockly-luwuos

๐Ÿ“– ไธญๆ–‡ๆ–‡ๆกฃ


Table of Contents


๐Ÿ“– Overview

Luwu-OS is a purpose-built embedded operating system for educational robotics. Running on Raspberry Pi CM4 and CM5, it powers a suite of interactive applications โ€” from AI-powered voice chat and gesture recognition to Blockly-based visual programming and multi-robot group performances.

The system features a Qt C++ launcher that manages a fleet of PySide6 application processes, all rendering directly to a 240ร—320 SPI LCD via the Linux framebuffer โ€” no X11, no Wayland, no display server overhead.

Mission: Give every student an intuitive, responsive, and delightful robotics experience โ€” right on the robot itself.


๐Ÿ“ธ Screenshots

๐Ÿ  Home & Gallery

Blockly Coding Demo Gallery Demo Gallery Page 1 Demo Gallery Page 2

๐Ÿง  AI Chat

AI Chat Detail AI Chat Config

๐Ÿงฉ Coding

Blockly Editor Coding Detail Coding Detail Page

๐Ÿค– Interactive Demos

Gesture Recognition Face Tracking Ball Tracking

๐ŸŒ Network & RC

WiFi Detail WiFi Detail 1 WiFi Detail 2 RC Mode

๐ŸŽฎ More Features

Group Control Bluetooth Gamepad Radar Scan


โœจ Features

Category Capability
๐Ÿง  AI Assistant Voice conversation, emotion recognition & expression, real-time TTS/ASR
๐ŸŽฎ Gamepad Control Bluetooth & wired gamepad support with joystick calibration
๐Ÿ–๏ธ Gesture Recognition Real-time hand pose estimation via MediaPipe
๐Ÿ‘ค Face Tracking Face detection & follow using onboard camera
โšฝ Ball Tracking Color-based ball detection, tracking & catching
๐Ÿ“ก RC Mode Remote control via mobile web interface with live camera feed
๐Ÿ—บ๏ธ Radar Scan LiDAR-based 360ยฐ environment scanning
๐ŸŽญ Group Performance MQTT-synchronized multi-robot choreography
๐Ÿงฉ Blockly Coding Visual programming with drag-and-drop blocks, generates Python on-device
๐ŸŒ WiFi Setup QR code scan-to-connect, hotspot management
๐Ÿ”Š Sound Localization Microphone-array based sound source detection
โš™๏ธ System Settings Language switching (EN/CN), volume control, device info

๐Ÿ”ง Hardware

# Component Interface Driver
1 SPI LCD (ST7789V, 240ร—320) SPI0 + GPIO 27/25/0 fbtft kernel driver โ†’ /dev/fb-spi
2 Camera (OV5647) CSI Picamera2 (per-app lifecycle)
3 4 Physical Buttons (A/B/C/D) GPIO 17/22/23/24 gpio-keys โ†’ /dev/input/eventX
4 Bluetooth (Cypress) mini-UART / PL011 bluetoothd via D-Bus
5 Audio + Microphone (WM8960) I2S + I2C ALSA dmix + dsnoop
6 Robot Dog UART ttyAMA0 / UART5 xgolib (auto-detect)
7 Servo / IMU / Battery UART โ†’ MCU xgolib forwarding
8 Cooling Fan (4-wire PWM) GPIO PWM + TACH pwm-fan kernel driver (hwmon)
9 Power + Battery VC voltage monitor + UART vcgencmd + xgolib joint monitoring

See HARDWARE_PLAN.md for the full hardware architecture, pinouts, and migration strategy.

Design Principle

Each hardware peripheral has exactly one owner โ€” the kernel driver or system service. Apps access hardware through standard interfaces, never by fighting over raw devices.


๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    Qt C++ Launcher                        โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
โ”‚  โ”‚ Gallery โ”‚  โ”‚ StatusBarโ”‚  โ”‚ KeyFilter โ”‚  โ”‚ QProcess โ”‚  โ”‚
โ”‚  โ”‚  View   โ”‚  โ”‚ (battery)โ”‚  โ”‚  (evdev)  โ”‚  โ”‚  Manager โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                  โ”‚ spawn
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚            PySide6 Apps (LinuxFB)      โ”‚       โ”‚
         โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”โ”‚       โ”‚
         โ”‚  โ”‚  AI  โ”‚ โ”‚Codingโ”‚ โ”‚Demos โ”‚ โ”‚Settingsโ”‚โ”‚  ...  โ”‚
         โ”‚  โ”‚ Chat โ”‚ โ”‚Blocklyโ”‚ โ”‚Page  โ”‚ โ”‚ Page   โ”‚โ”‚       โ”‚
         โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜โ”‚       โ”‚
         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜       โ”‚
                                                          โ”‚
  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  โ”‚
  โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  Linux Kernel Layer                       โ”‚
โ”‚  fbtft โ”‚ gpio-keys โ”‚ ALSA dmix โ”‚ pwm-fan โ”‚ vcgencmd     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
Layer Technology Role
Launcher Qt 5.15 C++ (EGLFS / LinuxFB) Process lifecycle, key routing, status bar
Applications PySide6 Python (LinuxFB) Feature apps, rendered to framebuffer
Hardware Abstraction Kernel drivers + systemd services Single-owner hardware access via standard Linux interfaces
IPC FIFO (/tmp/luwu_keys.fifo), D-Bus, MQTT Inter-process communication

๐Ÿš€ Quick Start

Prerequisites

  • Raspberry Pi CM4 or CM5 with compatible carrier board
  • SPI LCD (ST7789V) connected via SPI0
  • Debian-based Linux OS

System Image (Recommended)

The easiest way to get started is to flash a pre-built system image using Luwu-Imager:

The imager handles OS installation, SD card partitioning, and initial configuration automatically.

Install from Source

Note: install.sh is still under active development and may not cover all hardware configurations yet. It is recommended to use the Luwu-Imager approach above for a complete setup.

git clone https://github.com/LuwuDynamics/luwu_os.git /opt/luwu-os
cd /opt/luwu-os
sudo bash configs/install.sh

This single script handles everything:

  • Kernel overlays (SPI LCD, gpio-keys, fan control)
  • udev rules (/dev/fb-spi symlink)
  • ALSA multi-app audio sharing (dmix + dsnoop)
  • systemd services (launcher, undervolt monitor, hardware auto-detect)
  • Python dependencies via pip

Key Python packages installed:

Launch

The system starts automatically on boot via systemd:

sudo systemctl enable luwu-launcher
sudo systemctl start luwu-launcher

Development Mode

Run individual apps directly for development:

# Navigate to the app directory
cd apps/ai
python main.py

# Or for the coding app
cd apps/coding
python main.py

๐Ÿ“‚ Project Structure

Luwu-OS/
โ”œโ”€โ”€ launcher/              # Qt C++ main launcher (Gallery, StatusBar, KeyFilter)
โ”‚   โ”œโ”€โ”€ main.cpp           # Entry point, QProcess management, key routing
โ”‚   โ”œโ”€โ”€ galleryview.cpp    # Card-based app gallery UI
โ”‚   โ”œโ”€โ”€ statusbar.cpp      # Battery + time status bar
โ”‚   โ””โ”€โ”€ ...
โ”œโ”€โ”€ apps/                  # PySide6 feature applications
โ”‚   โ”œโ”€โ”€ ai/                # AI voice chat, emotion recognition, TTS/ASR
โ”‚   โ”œโ”€โ”€ coding/            # Blockly visual programming
โ”‚   โ”œโ”€โ”€ demo_page/         # Demo launcher page
โ”‚   โ”œโ”€โ”€ ball_track/        # Color-based ball tracking
โ”‚   โ”œโ”€โ”€ ball_catch/        # Ball catching with servo control
โ”‚   โ”œโ”€โ”€ face_follow/       # Face detection & tracking
โ”‚   โ”œโ”€โ”€ gesture/           # Hand gesture recognition
โ”‚   โ”œโ”€โ”€ gamepad/           # Bluetooth/USB gamepad control
โ”‚   โ”œโ”€โ”€ rc_mode/           # Remote control via web UI
โ”‚   โ”œโ”€โ”€ radar/             # LiDAR 360ยฐ scanning
โ”‚   โ”œโ”€โ”€ perform/           # Pre-programmed performance routines
โ”‚   โ”œโ”€โ”€ group_perform/     # MQTT-synchronized multi-robot group performance
โ”‚   โ”œโ”€โ”€ joystick/          # Joystick control interface
โ”‚   โ”œโ”€โ”€ hotspot/           # WiFi hotspot management
โ”‚   โ”œโ”€โ”€ network/           # Network configuration
โ”‚   โ””โ”€โ”€ settings/          # System settings (language, volume, device info)
โ”œโ”€โ”€ configs/               # System configuration files
โ”‚   โ”œโ”€โ”€ install.sh         # One-click deployment script
โ”‚   โ”œโ”€โ”€ boot-config.txt    # Kernel config template (new hardware)
โ”‚   โ”œโ”€โ”€ cm4-old.config     # Kernel config template (legacy hardware)
โ”‚   โ”œโ”€โ”€ luwu-keys.dts      # gpio-keys device tree source
โ”‚   โ”œโ”€โ”€ asound.conf        # ALSA dmix/dsnoop configuration
โ”‚   โ”œโ”€โ”€ asound.state       # Mixer state (anti-feedback + safe volume)
โ”‚   โ””โ”€โ”€ *.service          # systemd service unit files
โ”œโ”€โ”€ libs/                  # Shared Python libraries
โ”‚   โ”œโ”€โ”€ xgolib/            # Robot dog motion library
โ”‚   โ”œโ”€โ”€ xgoedu-luwuos/     # Educational library (PySide6 QPainter)
โ”‚   โ”œโ”€โ”€ theme/             # UI theming
โ”‚   โ”œโ”€โ”€ ui/                # Reusable UI components
โ”‚   โ””โ”€โ”€ i18n.py            # Internationalization support
โ”œโ”€โ”€ model/                 # ONNX AI models
โ”‚   โ”œโ”€โ”€ emotion.onnx       # Emotion recognition
โ”‚   โ”œโ”€โ”€ face_detection_*.onnx  # Face detection (YuNet)
โ”‚   โ”œโ”€โ”€ handpose_*.onnx    # Hand pose estimation (MediaPipe)
โ”‚   โ”œโ”€โ”€ person_detection_*.onnx  # Person detection
โ”‚   โ”œโ”€โ”€ pose_estimation_*.onnx   # Pose estimation
โ”‚   โ””โ”€โ”€ yolo_coco.onnx     # Object detection
โ”œโ”€โ”€ assets/                # Static assets
โ”‚   โ”œโ”€โ”€ expressions/       # Robot facial expression frames
โ”‚   โ”œโ”€โ”€ images/            # UI images & backgrounds
โ”‚   โ””โ”€โ”€ music/             # Audio files (system sounds, music)
โ”œโ”€โ”€ docs/                  # Documentation
โ”‚   โ””โ”€โ”€ HARDWARE_PLAN.md   # Detailed hardware architecture plan
โ””โ”€โ”€ scripts/               # Utility scripts

๐Ÿ“ฑ Applications

App Description Key Tech
AI Chat Voice conversation with emotion-aware responses LLM, TTS, ASR, ONNX emotion detection
Blockly Coding Visual drag-and-drop programming for robots Blockly, Python code generation
Face Follow Real-time face detection and tracking MediaPipe Face Detection, Picamera2
Ball Track Color-based ball detection and following OpenCV color filtering, PID control
Gesture Control Hand gesture recognition for robot commands MediaPipe Hands, ONNX
Gamepad Bluetooth/USB gamepad robot control evdev, Bluetooth HID, joystick calibration
RC Mode Remote control via mobile web browser Flask web server, MJPEG streaming
Radar 360ยฐ environment scanning visualization YDLiDAR SDK, real-time rendering
Group Perform Synchronized multi-robot choreography MQTT pub/sub, time-sync
Settings System configuration and device info Language switching, volume control

๐Ÿ› ๏ธ Development

Python Apps

All applications are built with PySide6 and render directly to the Linux framebuffer:

# apps/ball_track/main.py (simplified example)
import sys
from PySide6.QtWidgets import QApplication, QWidget
from PySide6.QtCore import QTimer
from picamera2 import Picamera2
import cv2

class BallTracker(QWidget):
    def __init__(self):
        super().__init__()
        self.camera = Picamera2()
        self.camera.start()
        self.timer = QTimer()
        self.timer.timeout.connect(self.process_frame)
        self.timer.start(33)  # ~30 FPS

Key Events

Key events are routed from the C++ launcher to Python apps via a FIFO (/tmp/luwu_keys.fifo):

Physical Button GPIO Linux Key Code
A (top-left) 17 KEY_LEFT
B (top-right) 22 KEY_RIGHT
C (bottom-left) 23 KEY_BACK
D (bottom-right) 24 KEY_ENTER

AI Models

ONNX models are located in model/ and loaded via onnxruntime. Models include:

  • Face detection (YuNet)
  • Hand pose estimation (MediaPipe)
  • Person detection (MediaPipe)
  • Pose estimation (MediaPipe)
  • Emotion recognition (custom)
  • Object detection (YOLO COCO)

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.


๐Ÿ“œ License

This project is licensed under the Apache License, Version 2.0.

Copyright ยฉ 2024โ€“2026 LuwuDynamics

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This means you are free to:

  • Use โ€” the software for any purpose
  • Modify โ€” the source code and create derivative works
  • Distribute โ€” copies of the original or modified software
  • Commercialize โ€” use the software in commercial products

Under the following conditions:

  • You must include a copy of the Apache 2.0 License in all distributions
  • You must state significant changes made to the original code
  • You must retain all copyright, patent, trademark, and attribution notices
  • The project name "Luwu-OS" and associated trademarks are not licensed

For the full license text, see LICENSE.


Built with โค๏ธ by LuwuDynamics

About

Robot OS

Resources

Stars

9 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages