Skip to content

gabe-zhang/weed-control-app

Repository files navigation

Release Actions License Python

Weed Control App

A companion GUI application for visualizing weed detection results on the Amiga agricultural robot platform.

Hardware Platform

This application runs on the Amiga Brain — the compute module of Farm-ng's Amiga robot. It is served as a brain app accessible via the robot's launcher web interface.

Required hardware:

  • Farm-ng Amiga robot with Brain (compute module)
  • OAK-D stereo camera (for obstacle detection feature)

Overview

This is a companion app for visualizing output from a separate weed detection service (weed-control.service). It does not perform weed detection itself.

What this app does:

  • Displays detection results (bounding boxes, cell views) from the main weed control service
  • Provides start/stop control for the weed control service via systemd
  • Offers independent obstacle detection using the OAK-D stereo camera

What this app does NOT do:

  • Run inference or detect weeds (handled by a separate service)
  • Control spraying actuators directly

How It Works with weed-control.service

This app communicates with the main weed control service via shared filesystem:

┌─────────────────────────┐      writes      ┌─────────────────────┐
│  weed-control.service   │ ───────────────► │ ~/Desktop/shared/   │
│  (separate repo)        │                  │   latest.jpg        │
│  - Runs inference       │                  └─────────────────────┘
│  - Draws bounding boxes │                            │
│  - Controls sprayers    │                            │ reads
└─────────────────────────┘                            ▼
                                             ┌─────────────────────┐
                                             │  weed-control-app   │
                                             │  (this repo)        │
                                             │  - Displays image   │
                                             │  - Refreshes @ 1Hz  │
                                             └─────────────────────┘

The weed control service writes annotated frames (with bounding boxes) to ~/Desktop/shared/latest.jpg. This app polls that file every second and displays the latest frame in the GUI.

Features

  • View Modes: Bounding box view, cell view, and obstacle detection
  • Obstacle Detection: Configurable safety distance with optional motor safety control (automatic zero-speed commands)
  • State Persistence: Remembers settings across restarts

Requirements

  • Python 3.10 or higher
  • Amiga Brain platform
  • UV package manager
  • OAK-D camera (for obstacle detection feature)

Installation

  1. Install dependencies using UV:

    uv sync
  2. Run the installation script:

    ./scripts/install.sh

This will create the necessary manifest symlink for the Amiga Brain service manager.

Usage

Run the application:

./scripts/entry.sh

The GUI will be available at http://localhost:8042

Configuration

The manifest.json file defines the application as an Amiga Brain service:

  • Service name: weed-control-app
  • Port: 8042
  • Autostart: disabled

Architecture

  • Main Thread: Gradio UI and user interactions
  • Detection Thread: Background async event loop for camera streaming
  • Thread Safety: Locks protect shared frame data and motor state
  • Logging: Systemd journalctl compatible, noisy logs suppressed

Uninstallation

To remove the application:

./scripts/uninstall.sh

This will remove the manifest symlink from the Amiga Brain service directory.

Third-Party Dependencies

This application uses the farm-ng-amiga package for robot communication and camera streaming, which is subject to the Amiga Development Kit License. This app is designed exclusively for use with Farm-ng Amiga robots.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

A companion GUI application for visualizing weed detection results on the Amiga agricultural robot platform.

Topics

Resources

License

Stars

Watchers

Forks

Contributors