TRACER is a modern, distributed robotics control system implemented into a robot tank featuring a responsive web-based dashboard, intelligent command processing, and real-time controls. The architecture consists of three interconnected components:
- Frontend Dashboard - Responsive SvelteKit web interface
- Raspberry Pi Controller - Central processing and AI integration
- Arduino Hardware Interface - Sensor management and motor control
The system is designed for mobile-friendly operation, intuitive controls, and expandability. View docs for detailed architecture and hardware information. view demos for examples of the web dashboard and command processing.
- 🎮 Multi-mode joystick control - Supports arcade, tank, car, and single-joystick modes
- 📱 Mobile-optimized dashboard - Responsive design for all devices
- 🔄 Joystick macro recording - Record, save, and playback movement patterns
- 🧠 AI-powered commands - Natural language processing for robot control
- 📊 Real-time telemetry - Live sensor data visualization
- 🔋 System monitoring - Battery, temperature, and connectivity status
- 🛑 Obstacle detection - Proximity awareness with severity levels
- 💻 Advanced logging - Filterable, searchable system logs
TRACER/
├── frontend/ # SvelteKit web dashboard
│ ├── src/ # Frontend source code
│ │ ├── lib/ # UI components and utilities
│ │ └── routes/ # Page routes
├── backend/ # Intermediary controller code
│ ├── Controller.py # Joystick input processing
│ └── main.py # Flask web server
├── rpi/ # Raspberry Pi robot controller
│ ├── src/ # Core robot functionality
│ │ ├── models/ # Robot models and types
│ │ ├── ai/ # GPT integration for commands
│ │ └── server.py # WebSocket server
├── arduino/ # Arduino firmware
│ └── main/ # Main controller sketch
└── docs/ # Documentation
Technology: SvelteKit, TypeScript, Socket.IO, TailwindCSS
Key Components:
- Mobile-responsive control dashboard (
src/routes/+page.svelte
) - Real-time joystick visualization with multiple control modes (
src/lib/components/JoystickStatus.svelte
) - Command processing and display (
src/lib/components/CommandList.svelte
) - Joystick macro recording and playback system (
src/lib/components/Recordings.svelte
) - Telemetry visualization including:
- Obstacle detection (
src/lib/components/ObstructionStatus.svelte
) - Battery monitoring (
src/lib/components/BatteryPercentage.svelte
) - System status visualization (
src/lib/components/Status.svelte
) - Comprehensive logs (
src/lib/components/Logs.svelte
)
- Obstacle detection (
Features:
- Responsive design that works on mobile devices
- Real-time updates via WebSockets
- Joystick control with multiple driving modes:
- Two-joystick arcade drive
- Single-joystick arcade drive
- Tank drive
- Car drive (with trigger controls)
- Precision mode toggle for fine control
- Recording and playback of joystick macros
- Command history with visual status indicators
- Comprehensive logging with filtering
- Sensor data visualization
Technology: Python, Socket.IO, Flask, PyGame, WebSockets
Components:
-
Controller Backend (Laptop/Server):
backend/main.py
- Flask server with Socket.IObackend/Controller.py
- Joystick handling and state managementbackend/ControllerState.py
- Control mode enumeration
-
Robot Controller (Raspberry Pi):
rpi/src/server.py
- Main WebSocket serverrpi/src/models/Robot.py
- Core robot functionalityrpi/src/models/SerialManager.py
- Serial communicationrpi/src/models/SensorData.py
- Sensor data processingrpi/src/ai/get_commands.py
- Natural language command integration
Features:
- Distributed architecture with dedicated controller and robot servers
- Physical controller support using PyGame
- Multiple control modes (TWO_ARCADE, ONE_ARCADE, TANK, CAR)
- Precision mode toggle for fine control
- Macro recording and playback with named recordings
- Real-time WebSocket communication between components
- Natural language command processing with GPT integration
- Sensor data handling with safety features
- Cliff and obstacle detection with automatic responses
- Command queuing and execution with status feedback
Technology: C++, Arduino Framework
Key Components:
- Main control loop (
arduino/main/main.ino
) - Sensor interface modules
- Motor control system
- Serial communication handler
Hardware Components:
- TB6612FNG motor driver for differential drive
- MPU6050/9250 IMU (gyroscope + accelerometer)
- 1602 LCD with I2C backpack for local status display
- IR sensors for cliff detection
- HC-SR04 ultrasonic sensor for distance measurement
Features:
- Real-time sensor data collection and processing
- Motor control with hardware PWM
- Safety-first design with emergency stops
- Serialized data communication with the Raspberry Pi
- Local status display on LCD
- Battery voltage monitoring
- Obstacle and cliff detection
User Input (Web UI/Controller) → Backend Socket → Raspberry Pi → Serial → Arduino → Sensors
↓
Telemetry Display (Web UI) ← Backend Socket ← Raspberry Pi ← Serial Data ← Arduino
Frontend ↔ Backend:
joystick_input
: Send joystick control values to backendjoystick_mode
: Control mode changes (TWO_ARCADE, ONE_ARCADE, TANK, CAR)precision_mode
: Toggle for precise movement controlstart_recording
: Begin recording joystick movementsstop_recording
: End recording and save macroplay_recording
: Play back a saved joystick macrosensor_data
: Streaming sensor updates from robotactive_command
: Current command being executed
Backend ↔ Raspberry Pi:
query
: Send natural language commands for AI processingjoystick_input
: Forward controller commandssensor_data
: Telemetry updatesrumble
: Trigger controller haptic feedbackstop
: Emergency stop command
Command Structure:
- Motor control: Binary packet with header and motor values
- LCD commands: Text display instructions
- Sensor requests: Periodic polling for data
Response Structure:
- Sensor data packets with ultrasonic, IMU, and IR readings
- Status acknowledgements
- Error messages
- Emergency stop capability at all levels (UI, controller, code)
- Cliff detection with automatic stopping
- Obstacle avoidance with configurable thresholds
- Connection monitoring with auto-shutdown on disconnect
- Battery voltage monitoring and low-power warnings
- Watchdog timers for system stability
Requirements:
- Python 3.10+ for backend and Raspberry Pi code
- Node.js and npm for frontend development
- Arduino IDE for firmware updates
Running the System:
- Ensure all dependencies are installed:
- For frontend:
npm install
in thefrontend
directory - For backend: Create venv and run
pip install -r requirements.txt
in thebackend
directory - For Raspberry Pi: Create venv and run
pip install -r requirements.txt
in therpi
directory
- For frontend:
- Upload
arduino/main/main.ino
to the Arduino board using the Arduino IDE - Run the raspberry Pi server:
- Navigate to the
rpi
directory and runpython -m main
- Navigate to the
- Connect xbox controller to the laptop or server running the backend
- Ensure the controller is recognized by the system (use
jstest
or similar tools to verify)
- Ensure the controller is recognized by the system (use
- Start the backend server:
- Navigate to the
backend
directory and runpython main.py
- Navigate to the
- Start the frontend server:
- Navigate to the
frontend
directory and runnpm run dev
- Open the web dashboard in a browser at
http://localhost:5173
- Navigate to the
- Enhanced autonomous navigation capabilities
- Pure pursuit path following and PID control for smoother movement
- Motor encoders for precise localization
- Custom shield and mounts
- Camera integration for computer vision tasks
- Visual SLAM for mapping and localization
- Multi-robot coordination
- Additional sensor integration
- Machine learning for behavior optimization
- Mobile app control interface