Safety monitoring in industrial and construction sites is traditionally done manually by safety officers. This process is time-consuming, prone to human error, and exposes inspectors to hazardous environments (like high-altitude structures or toxic zones).
Safety monitoring in industrial and construction sites is traditionally done manually by safety officers. This process is time-consuming, prone to human error, and exposes inspectors to hazardous environments (like high-altitude structures or toxic zones).
Baseer is an autonomous UAV (Drone) system designed to fully automate safety compliance inspections. The drone flies completely on its own along a pre-programmed path, scanning the environment using an integrated downward camera.
Instead of just recording video, Baseer integrates real-time computer vision using YOLOv8. The system automatically processes the live video feed to:
- Detect safety elements like traffic cones and hazard walls.
- Monitor worker safety compliance by detecting standing personnel.
- Trigger an automatic SOS emergency alert in the terminal the exact second a fallen worker is detected on the ground.
[Simulation & Environment] [AI & Response Layer] │ │ ┌─────▼─────┐ ┌───────▼───────┐ │ Gazebo │ ◀───── (Movement Cmds) ──── │ MAVSDK-Python │ │ Simulator │ │ Mission Logic │ └─────┬─────┘ └───────┬───────┘ │ │ (Live Video / Coordinates) (Image Analysis / Decision) │ │ ┌─────▼─────┐ ┌───────▼───────┐ │ PX4 │ ◀────── (MAVLink UDP) ────▶ │ YOLOv8 Engine │ │ Autopilot │ │ (Edge AI) │ └─────┬─────┘ └───────┬───────┘ │ │ └──────────► [ Emergency SOS Protocol ] ◄───┘ - Extract live GPS telemetry - Dispatch critical medical alert - Trigger Return-to-Base (RTB)
The system establishes a stable, low-latency bridge between three main components:
- PX4 Autopilot (SITL): Handles the core flight dynamics, takeoff, navigation, and landing states.
- Gazebo Simulator: Manages the 3D physics, lighting, and renders our custom world and drone sensors.
- MAVSDK (Python): Connects via UDP to send high-level asynchronous flight coordinates (
PositionNedYaw). - YOLOv8 & OpenCV: Ingests the camera stream via UDP to execute real-time object detection models.
To achieve a clean, professional simulation setup, we decoupled the environment map from the robotic asset:
The environment was custom-built to simulate a realistic hazardous work site. It features:
- A dense city environment base model (
model://city). - Target 1 (Safety Compliance): A standing worker model (
worker_1_standing) surrounded by safety cones. - Target 2 (Emergency Scenario): A fallen worker model (
worker_2_fallen_sos) lying down to simulate an accident. - Obstacles: Industrial hazard barriers (
jersey_barrier) to test perimeter security.
The drone utilizes the gz_x500_mono_cam_down platform. This setup integrates:
- A monocular camera sensor fixed downward to provide an un-obstructed field of view of the ground.
- A 2D LiDAR distance sensor attached to the principal
base_linkvia rigid joints to maintain precise altitude measurements above the structures.
Follow these exact steps to prepare the environment workspace:
cd ~ git clone https://github.com/PX4/PX4-Autopilot.git --recursive cd PX4-Autopilot bash ./Tools/setup/ubuntu.sh make px4_sitl
Navigate to the PyCharm project directory and install the machine learning and drone SDK libraries directly into the local environment: cd ~/PyCharmMiscProject ./.venv/bin/pip install opencv-python ultralytics mavsdk
Always launch the simulator environment first, allow it to stabilize, and then trigger the Python AI mission.
cd ~/PX4-Autopilot PX4_GZ_WORLD=project make px4_sitl gz_x500_mono_cam_down
source ~/PyCharmMiscProject/.venv/bin/activate python /home/renad/baseer_mission.py
During development, we faced major technical bugs that required deep troubleshooting:
- The Problem: We initially tried pasting the camera and laser
<joint>and<include>XML blocks directly inside the global world file (project.sdf). Gazebo crashed with multiple red errors because it tried to attach joints to a drone frame (base_drone::base_link) that did not exist yet in the world scope. - The Solution: We realized that from a proper engineering perspective, sensors must be embedded within the drone's model framework, not the environment. We cleaned the world file back to its clean state and utilized the official
gz_x500_mono_cam_downmodel which correctly encapsulates the camera and joints out-of-the-box.
- The Problem: During testing, there was confusion between different test environments (the
gaz_station_projectusing a gimbal drone at fixed coordinates11.68,8.13,8versus our actual mainprojectworld). This caused the python script to look for wrong camera ports and missing models. - The Solution: We strictly isolated the codebases. We targeted the exact world (
PX4_GZ_WORLD=project) and synchronized the Python coordinates to navigate precisely over our unique asset locations.
- The Problem: Even after installing OpenCV using standard pip, the Python script kept crashing with missing module errors inside PyCharm.
- The Solution: The global system Python interpreter