A Python-based interface for controlling a robot with GPS navigation capabilities. This project includes both the controller interface software and the Arduino firmware for the robot.
- Real-time controller input monitoring and visualization
- GPS navigation with waypoint support
- Interactive map display with click-to-add waypoints
- Route tracking and waypoint management
- Return to Home functionality
- Compass heading with BNO055 sensor
- Autonomous waypoint navigation with autopilot
- Serial communication with Arduino controller
- Support for multiple input devices
- nicegui
- pyserial
- inputs
- folium
- asyncio
- numpy
- AccelStepper
- Servo
- Wire
- Adafruit_ADXL345_U
- Adafruit_BNO055
- Adafruit_Sensor
- TinyGPS++
- Clone the repository
- Install Python dependencies:
pip install -r requirements.txt
- Upload the Arduino sketch (
controller_interface.ino) to your Arduino board
- Run the Python interface:
python src/main.py
- Connect your controller
- Select the appropriate serial port for the Arduino
- Use the interface to monitor controller inputs and manage GPS waypoints
- Real-time GPS position tracking
- Interactive map display
- Position history tracking
- Click-to-add waypoints on the map
- Waypoint table with name, coordinates, and status
- Automatic waypoint completion when within range
- Customizable completion radius
The Return to Home feature allows your robot to automatically navigate back to its starting position:
- How it works: The system automatically saves the first valid GPS position after startup as the "home" location
- Activation: Click the "Return to Home" button in the GPS section
- Behavior: Creates a new waypoint at the home position that the robot can navigate to
- Requirements: Requires a valid GPS fix on startup to set the home position
The autopilot feature provides autonomous navigation through waypoints:
- Waypoint Following: Automatically navigate through a sequence of waypoints
- Pure Pursuit Algorithm: Uses a sophisticated path-following algorithm with cross-track error correction
- Manual Override: Temporarily take control by moving the right joystick, autopilot resumes after 5 seconds of inactivity
- Split Control: Keep manual control of the camera gimbal (left joystick) while autopilot handles steering and throttle
- Speed Control: Adjust the maximum speed of the autopilot with an intuitive slider
- Variable Speed: Automatically reduces speed during sharp turns and when approaching waypoints
- Visual Feedback: Real-time display of heading errors, cross-track errors, and steering commands
- One-Click Activation: Enable/disable autopilot with a simple toggle switch
The BNO055 compass sensor provides accurate heading information for navigation:
- Heading: Displays the current direction in degrees (0-360°)
- Pitch and Roll: Shows the orientation of the vehicle in 3D space
- Auto-Calibration: The BNO055 features self-calibration capabilities
- Calibration Status: Visual indicators display calibration levels for system, gyroscope, accelerometer, and magnetometer
- Integration: Compass data is available simultaneously with GPS data, even without GPS signal
- Real-time Updates: Heading updates twice per second for responsive navigation
- Route visualization with lines between waypoints
- Distance and bearing calculations to next waypoint
- Route progress tracking
- Current route highlighted on map
This project is licensed under the MIT License - see the LICENSE file for details.