<p align="center">
  <img src="images/rush-mog.png" alt="RUSH-MOG omnidirectional robot" width="760">
</p>

<h1 align="center">RUSH-MOG</h1>

<p align="center"><strong>A VLA-powered omnidirectional robot that listens, sees, finds its target — and gets things done.</strong></p>
<p align="center">Raspberry Pi 4B · ROS 2 Humble · SmolVLA · 4WD Mecanum · Digital Twin</p>

<p align="center">
  <img alt="ROS 2 Humble" src="https://img.shields.io/badge/ROS%202-Humble-22314E">
  <img alt="Python 3.10+" src="https://img.shields.io/badge/Python-3.10%2B-3776AB">
  <img alt="SmolVLA" src="https://img.shields.io/badge/VLA-SmolVLA-7C3AED">
  <img alt="License Apache-2.0" src="https://img.shields.io/badge/License-Apache%202.0-blue">
</p>

<p align="center"><a href="README_cn.md">中文</a> | English</p>

RUSH-MOG is an open-source, Unimog-inspired omnidirectional robot. It is not a
remote-controlled car with a screen — it connects an **onboard Edge server, ROS 2
autonomy, a SmolVLA inference center, and a digital twin console** into one
end-to-end stack: drive it from a phone, ask it to find something, map a room,
inspect every subsystem, swap the policy — and next, use the arm to pick up what
it found and hand it to you.

Whether you want a mobile robot that follows instructions or a practical platform
for VLA / embodied-AI experiments, RUSH-MOG gives you a modular reference
implementation: a 4WD mecanum base, real-time STM32 control, a Raspberry Pi
Edge Server, ROS 2 SLAM/navigation, remote VLA inference, and a dashboard that
shows the whole vehicle in real time.

> **VLA-ready, not pretending to drive itself**: the inference center, HTTP
> contract, action mapping, and fallback path are already in place. To make it
> truly understand this chassis, fine-tune SmolVLA on your own demonstrations and
> align the action space with `[vx, vy, wz]`.

---

## Why RUSH-MOG

- **Three ways to drive, one robot**: a phone-based PS2 controller, voice/text
  commands, and a VLA policy. Manual driving works without the Center or even the
  ROS nodes — just open the web UI.
- **From finding to fetching**: target search + navigation + depth ranging + arm
  grasp/hand-over are being wired into one pipeline for “bring me the water on the
  table.”
- **Edge-native**: the web UI, MJPEG stream, chassis serial bridge, ROS 2 nodes,
  and health monitoring all run on the Raspberry Pi. Mapping, navigation, and
  monitoring still work without a cloud connection.
- **Center / Edge decoupled**: SmolVLA inference can run on a LAN GPU host or in
  Docker. The Center handshakes automatically, the onboard
  `vla_inference_node` discovers it, and the robot falls back to a rule-based
  stub if inference fails.
- **A digital twin that earns its name**: 20 Hz chassis telemetry, wheel/speed/
  odometry data, module health, and online parameter editing — all live in
  `dashboard.html`.
- **Full-stack open source**: hardware BOM/assembly, STM32 firmware, ROS 2
  packages, Center inference service, and Windows/Linux Docker deployment docs
  are all in the repository.
- **Safety by design**: VLA only produces high-level actions. Every command goes
  through `velocity_mux`, `safety_manager`, and a watchdog; E-stop and the real
  control loop stay on the vehicle.

---

## At a Glance

| What you want | How RUSH-MOG delivers |
|---|---|
| **Start driving now** | Join Wi-Fi and open the browser: an instant PS2 controller with eight directions, rotation, and live video |
| **See the world** | Astra Pro RGB-D + MJPEG + color/YOLO detection + LiDAR ranging |
| **Move autonomously** | 2D LiDAR + wheel encoders + ICM-45686 → SLAM / AMCL / EKF / Nav2 |
| **Find it — and fetch it** | Voice or text → explore/confirm/approach → arm grasp/hand-over → TTS announcement (arm scenario in progress) |
| **Understand the vehicle** | Digital twin dashboard: chassis, sensors, modules, health, and parameters on one screen |
| **Swap the brain** | SmolVLA HTTP inference center with automatic discovery; CPU/stub for integration, GPU for real inference |

---

## Core Capabilities

### 🕹️ Your phone is the controller

Open the Edge Server web UI and your phone becomes a PS2 controller: forward,
backward, turn left/right, strafe left/right, and move diagonally. The camera feed
is displayed right on the controller page.

<p align="center">
  <img src="software/edge_server/ps2.png" alt="Phone-based PS2 controller" width="620">
</p>

- No app to install — just a browser;
- Web UI, joystick, and ROS `/cmd_vel` share one STM32 serial output;
- Manual driving still works when ROS is not running.

### 🗺️ Mapping, localization, and autonomous navigation

RUSH-MOG builds a 2D occupancy grid with a **2D LiDAR + wheel encoders + ICM-45686
6-axis IMU**, localizes with AMCL/EKF, and reaches goals with Nav2 or the built-in
direct controller.

- Mapping missions, map save/load, and exploration missions;
- Goal navigation with localization health gating, stall detection, and timeouts;
- Every velocity source is arbitrated through `velocity_mux`; the safety layer
  always has the final veto.

### 🎯 Say “find my slippers”

Voice is not a gimmick here — it drives a complete scenario pipeline:

```text
Phone speech / HTTP text
  → scenario layer (what to find, where to search, what if not found)
  → frontier exploration + object detection + LiDAR ranging
  → confirm target, approach to a configured standoff distance
  → TTS: “Found the slippers.”
```

Say “stop looking” to cancel; if the target is not found, the robot keeps
exploring or exits safely. Speech recognition runs in the phone browser
(Web Speech API), so motor noise does not degrade it; the Pi only receives text.

### 🧠 VLA inference center

The Center Server is a standalone SmolVLA HTTP inference service:

- Input: language instruction + multiple images + robot state;
- Output: action chunk, first-step `base_cmd` / `arm_cmd`, and action mapping;
- The Center handshakes with Edge on startup; the onboard node discovers it via
  `/api/center`;
- On inference failure/timeout, the robot falls back to the rule-based stub or
  stops — it never keeps executing stale actions.

> The default `lerobot/smolvla_base` checkpoint is a general-purpose model for
> validating the pipeline and API. Real control requires fine-tuning on this
> vehicle and aligning the action space with `action.mode`. See
> [Center Server design and API](software/center_server/README.md).

### 📊 Digital twin monitoring

`/dashboard.html` is more than a static dashboard:

- EDGE / ROS / CENTER module status around a vehicle digital twin;
- Health for camera, LiDAR, IMU, microphone, speaker, arm, base, and battery;
- 20 Hz chassis telemetry: wheel speed, vehicle speed, odometry, motor direction;
- Radar map, MJPEG video, runtime events, and scenario commands;
- Online module parameter editing, with some parameters applied immediately.

### 🦾 Scenario: bring the owner a bottle of water

Imagine saying, “Bring me the water on the table.” The robot drives over, avoids
the coffee table, finds the bottle, reaches out with its arm, picks it up, returns,
and hands it to you — not just “I found it,” but “here it is.”

```text
“Bring me the water on the table”
  → understand the target: water bottle / table
  → navigate to the table
  → depth camera + LiDAR locate the bottle
  → arm IK, grasp, secure grip
  → return to the owner, hand over / place down
  → TTS: “Here's your water.”
```

Speech, scenario orchestration, SLAM/navigation, visual detection, depth ranging,
and TTS are already connected. Arm IK, grasp/hand-over control, and the
return-to-owner approach behavior are still being completed — the most anticipated
next chapter of RUSH-MOG.

---

## System Architecture

<p align="center">
  <img src="images/system-arch.png" alt="RUSH-MOG system architecture" width="860">
</p>

```text
Phone / PC browser
      │ HTTP
      ▼
┌───────────────────────┐        HTTP/JSON        ┌───────────────────────┐
│ Edge Server (Pi)      │ ◄─────────────────────► │ Center Server (GPU)   │
│ Web / MJPEG / UART    │   /v1/infer · handshake │ SmolVLA + action map  │
│ ROS 2 / SLAM / Nav2   │                         │ /v1/health · /v1/model│
└──────────┬────────────┘                         └───────────────────────┘
           │ UART
           ▼
┌───────────────────────┐
│ STM32 + L298N + base  │
│ motors / encoders/arm │
└───────────────────────┘
```

- **Terminal** talks only to the Edge Server, never directly to the Center;
- **Edge** handles real-time control, perception, navigation, and the web UI;
- **Center** handles heavy inference and can be deployed/upgraded independently;
- The two sides are HTTP-decoupled: losing the Center never blocks manual driving
  or chassis safety.

---

## Hardware Stack

| Module | Choice | Role |
|---|---|---|
| Onboard compute | Raspberry Pi 4B / Pi 5 / Jetson Orin Nano | Edge Server, ROS 2, SLAM/navigation |
| Real-time control | STM32F103C8T6 | Motor PWM, encoders, cliff sensors, serial protocol |
| Chassis | 4× JGB37-520 + 125 mm mecanum wheels + L298N | 4WD omnidirectional motion |
| Perception | Astra Pro RGB-D, D6/LD19 2D LiDAR, ICM-45686 | Images, depth, scans, attitude |
| Interaction | Phone browser, NewMine / HONOR AM510 Bluetooth speaker/mic | Controller, video, TTS, recording |
| Arm | PCA9685 + multi-joint arm | Grasping/manipulation extension |
| Power | 12 V / 5 V / 3.3 V power and conversion board | Vehicle power |

<p align="center">
  <img src="hardware/integrate_archetecture.png" alt="RUSH-MOG hardware integration" width="860">
</p>

See [Hardware Architecture and SLAM/Navigation Plan](hardware/README.md) for the
target architecture, BOM, PCB, assembly, power/safety, wiring, and calibration.

---

## Software Stack

| Layer | Technology / module | Purpose |
|---|---|---|
| Onboard Edge | Python stdlib HTTP, MJPEG, SSE, STM32 serial bridge | Web/API, video, chassis telemetry, health proxy |
| ROS 2 | Humble, slam_toolbox, Nav2, EKF, custom_msgs | Mapping, localization, navigation, target search, velocity arbitration |
| Health | `health_monitor_node`, `:8090/ros/health` | Unified snapshot of ROS nodes and devices |
| Inference center | SmolVLA, LeRobot, HTTP/JSON | Multimodal action-chunk inference, auto handshake/discovery |
| Web UI | Vanilla HTML/CSS/JS | PS2 controller and digital twin dashboard |
| Deployment | Windows scheduled task, Linux systemd, Docker Compose | On-site deployment, offline images, GPU/CPU variants |

<p align="center">
  <img src="software/architechture.png" alt="RUSH-MOG software architecture" width="860">
</p>

---

## Get Started

**1. Prepare the hardware**: follow the [Hardware Design Notes](hardware/README.md)
to assemble the base, sensors, and power; flash the
[STM32 firmware](software/body_control/README.md).

**2. Start Edge on the Raspberry Pi**:

```bash
# ROS 2 Humble workspace; see edge_server/README.md for configuration
ros2 launch edge_server robot_bringup.launch.py
```

**3. Open the web UI**:

```text
http://<edge-ip>/                 # phone PS2 controller
http://<edge-ip>/dashboard.html   # digital twin dashboard
```

**4. Optional: start the VLA inference center** (Windows scheduled task or Linux
Docker):

```text
Deployment and operations: software/center_server/deploy/DEPLOY.md
```

> Manual driving, mapping, and navigation work without the Center. VLA is an
> enhancement, not part of the safety chain. Model preparation, GPU/VRAM notes,
> Windows/Docker deployment, and troubleshooting are all in the
> [Center Server deployment and operations guide](software/center_server/deploy/DEPLOY.md).

---

## Repository Map

| Directory | Contents |
|---|---|
| [`software/body_control`](software/body_control) | STM32 firmware: motors, encoders, arm, serial protocol |
| [`software/edge_server`](software/edge_server) | Raspberry Pi Edge Server + ROS 2: web, video, SLAM/navigation/search |
| [`software/center_server`](software/center_server) | SmolVLA HTTP inference center |
| [`software/custom_msgs`](software/custom_msgs) | ROS 2 custom messages, services, and actions |
| [`hardware`](hardware) | Target architecture, BOM, PCB, assembly, wiring, power/safety |
| [`models`](models) | Model weights directory (weights are not shipped in the repo) |
| [`images`](images) | Project photos and architecture diagrams |

---

## Documentation

| Document | Contents |
|---|---|
| [Hardware Architecture & SLAM/Navigation Plan](hardware/README.md) | Target architecture, BOM, PCB, assembly, wiring, power/safety, calibration |
| [Software Architecture](software/README.md) | Subsystems and code map |
| [Edge Server / ROS 2](software/edge_server/README.md) | Web, video, SLAM, navigation, target search, health |
| [Edge Design](software/edge_server/docs/DESIGN.md) | Layered architecture, interfaces, topics/services |
| [Center Server design and API](software/center_server/README.md) | SmolVLA inference, HTTP contract, action mapping, configuration |
| [Center Deployment & Operations](software/center_server/deploy/DEPLOY.md) | Windows / Linux Docker, GPU, logs, upgrades/rollback |
| [ROS Health Contract](software/edge_server/docs/HEALTHCHECK.md) | Device health fields and status semantics |
| [OpenAPI](software/api.yaml) | Edge / Center / Body Control HTTP API archive |

---

## Status & Roadmap

**✅ Available**

- Phone PS2 web controller, MJPEG video, and digital twin dashboard;
- STM32 serial bridge, encoder telemetry, odometry, velocity arbitration,
  E-stop/watchdog;
- ROS 2 mapping, localization, Nav2/direct navigation, object detection, and
  target search;
- Bluetooth speaker/mic, TTS announcements, and health monitoring;
- SmolVLA Center Server, auto handshake/discovery, CPU/stub and GPU deployment;
- Windows scheduled task, Linux Docker/Compose, and offline images.

**🚧 In progress**

- Fine-tuning SmolVLA on this vehicle so the action space truly matches the base;
- Arm IK, grasp-and-hand-over trajectories, and the end-to-end “bring me the water” scenario;
- Multi-robot/multi-session isolation and an asynchronous inference queue;
- Stress tests for Wi-Fi jitter, camera dropouts, and GPU throttling.

**⚠️ Notes**

- The generic `lerobot/smolvla_base` checkpoint is for pipeline validation only;
  it is not a policy for this vehicle;
- A 4 GB GPU can run float16 inference, but headroom is tight — avoid stacking
  other GPU workloads;
- VLA output must pass through the onboard safety chain; never bypass
  `safety_manager` or the hardware E-stop.

---

## Safety by Design

RUSH-MOG separates “thinking” from “stopping safely”:

- **Center only infers**: it returns action chunks/velocity suggestions, not
  direct STM32 commands;
- **Edge arbitrates**: `velocity_mux` unifies all velocity sources, and
  `safety_manager` has the highest priority;
- **STM32 backs it up**: serial timeout, E-stop, and watchdog all bring the chassis
  to a stop;
- **Hardware E-stop** is always independent of software — the final physical line
  of defense.

---

## Contributing

Issues, PRs, hardware mods, deployment notes, and new scenarios are all welcome.
Teaching the robot one more object or porting the VLA policy to a new chassis is
exactly the kind of contribution RUSH-MOG wants to see.

If this project inspires you, please give it a ⭐ Star so more people can find it.

---

## License

[Apache License 2.0](LICENSE)

---

## Acknowledgements

Thanks to LeRobot / SmolVLA, ROS 2, Nav2, slam_toolbox, the Raspberry Pi
community, and everyone who shares their experience in embodied AI and open-source
hardware.
