Skip to content

Raynard2/smart-vacuum

Repository files navigation

Smart Vacuum

This project is a "smart vacuum" system that includes a mobile app for control and a Python backend for AI-powered features.

Features

  • AI-Powered Pathfinding: The system uses a Python backend with a custom fine-tuned Yolo model to analyze a floor plan and calculate an optimal cleaning path.
  • Mobile App Control: A SwiftUI-based iOS app provides a user-friendly interface to control and monitor the vacuum.
  • Two Cleaning Modes:
    • Manual Mode: An augmented reality view where you can manually drive the vacuum using a joystick. This mode also uses the device's camera to detect "dirt" or "waste" on the ground and visualizes it in the AR scene.
    • SafePath Mode: A simulation view that displays the calculated cleaning path on the uploaded floor plan. You can watch the vacuum's progress and see real-time telemetry data like cleaning coverage and efficiency.
  • Floor Plan Analysis: The backend can take an image of a floor plan and convert it into a grid-based map for pathfinding.

Project Structure

The project is divided into two main components:

  • api-backend.py: A Python backend built with FastAPI that handles the AI and pathfinding logic.
  • SmartVacuum/: An Xcode project for the iOS app, written in Swift and SwiftUI.

Backend

The backend provides the following API endpoints:

  • POST /predict: Takes an image and returns a list of detected objects with their bounding boxes.
  • POST /get_floor_plan: Converts a floor plan image into a binary matrix.
  • POST /calculate-path: Calculates a cleaning path based on a floor plan matrix.

Mobile App

The iOS app has the following features:

  • Floor Plan Upload: Users can upload a floor plan image from their photo library.
  • Connection Simulation: The app simulates connecting to the smart vacuum.
  • Mode Selection: Users can choose between "Manual" and "SafePath" modes.
  • Manual Control: An AR view with a joystick for manual control and dirt detection.
  • Path Simulation: A view that visualizes the cleaning path on the floor plan.

How to Run

Backend

  1. Install the required Python packages:
    pip install fastapi "uvicorn[standard]" python-multipart opencv-python-headless ultralytics Pillow
  2. Run the backend server:
    python api-backend.py

The server will start on http://0.0.0.0:8000.

Mobile App

  1. Open the SmartVacuum.xcodeproj file in Xcode.
  2. Select your target device and run the app.

Visualization Tools

The project also includes Python scripts for visualizing the generated path:

  • path_visualization.py: A script to visualize the path from a hardcoded API response using matplotlib.
  • visualization.py: Another visualization script.

These scripts are likely for development and debugging purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •