This project is a "smart vacuum" system that includes a mobile app for control and a Python backend for AI-powered 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.
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.
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.
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.
- Install the required Python packages:
pip install fastapi "uvicorn[standard]" python-multipart opencv-python-headless ultralytics Pillow - Run the backend server:
python api-backend.py
The server will start on http://0.0.0.0:8000.
- Open the
SmartVacuum.xcodeprojfile in Xcode. - Select your target device and run the app.
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 usingmatplotlib.visualization.py: Another visualization script.
These scripts are likely for development and debugging purposes.