An autonomous fire detection and response system for fixed-wing UAVs. The system uses dual-camera sensor fusion (RGB + thermal) to detect and confirm fire locations, then autonomously navigates the aircraft to orbit around the detected fire.
This project implements a complete autonomous fire surveillance pipeline:
-
Fire Detection: Combines RGB camera (color-based detection) with thermal camera (temperature thresholding). Both cameras detect fire independently, and the system uses sensor fusion to match detections by comparing normalized pixel coordinates. Only fires confirmed by both sensors are considered valid, eliminating false positives.
-
Gimbal Tracking: When a confirmed fire is detected, the gimbal automatically tracks and centers the target in the camera frame.
-
Target Geolocation: Once the target is centered, the system calculates the GPS coordinates of the fire using raycasting. A virtual ray is projected from the aircraft position, through the camera at the gimbal's current pan/tilt angles, down to the ground plane. The intersection point gives the target's geographic coordinates.
-
Autonomous Navigation: The aircraft autonomously navigates toward the fire location. When within the desired distance, it transitions to loiter mode and orbits around the target.
The system calculates the fire's ground position using the aircraft's telemetry and gimbal orientation. The core calculation is:
ground_distance = altitude / tan(gimbal_tilt + vertical_offset)
Where:
altitudeis the aircraft's altitude above ground (meters)gimbal_tiltis the pitch angle of the gimbal (radians)vertical_offsetis the pixel offset from frame center, converted to angle
bearing = heading - (gimbal_pan + horizontal_offset)
Where:
headingis the aircraft's compass heading (radians)gimbal_panis the yaw angle of the gimbal (radians)horizontal_offsetis the pixel offset from frame center, converted to angle
The target coordinates are calculated using the Haversine formula inverse:
angular_distance = ground_distance / Earth_Radius
target_lat = arcsin(sin(lat) * cos(angular_distance) +
cos(lat) * sin(angular_distance) * cos(bearing))
target_lon = lon + arctan2(sin(bearing) * sin(angular_distance) * cos(lat),
cos(angular_distance) - sin(lat) * sin(target_lat))
This projects a point from the aircraft's position along the calculated bearing at the computed ground distance.
- Ardupilot
- OpenCV (cv2)
- NumPy
- PyMAVLink
- Gazebo Transport (gz.transport)
The system will:
- Connect to MAVLink on
udp:127.0.0.1:14550 - Subscribe to RGB and thermal camera topics
- Display a combined view with detection overlays
- Automatically control the aircraft when fire is confirmed
The interface shows:
- RGB camera feed with detection boxes (green = confirmed, orange = false positive)
- Thermal camera feed with temperature readings
- Gimbal status (LOCKING countdown, LOCKED indicator)
- Telemetry bar with aircraft position, speed, distance to target, and ROI coordinates
This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for details.