This project demonstrates a drone that detects and tracks vehicles using YOLOv8 in a Gazebo simulation, running with PX4 and MAVROS, and autonomously flies towards them.
Follow these steps from scratch if you are setting up on a fresh machine:
-
Install WSL2 and Ubuntu
- Install WSL2 on Windows and Ubuntu 20.04 LTS.
-
Install ROS Noetic
sudo apt update sudo apt install ros-noetic-desktop-full
-
Install MAVROS
sudo apt install ros-noetic-mavros ros-noetic-mavros-extras sudo apt install geographiclib-tools sudo geographiclib-get-geoids egm96-5
-
Install PX4 Autopilot
git clone https://github.com/PX4/PX4-Autopilot.git --recursive cd PX4-Autopilot bash ./Tools/setup/ubuntu.sh --no-nuttx
-
Install Gazebo Classic (for ROS-Gazebo simulation) PX4 setup will install it automatically, but ensure gazebo-classic is linked with ROS.
-
Clone this repository
cd ~ git clone https://github.com/symphl/drone_project.git cd drone_project
-
Setup your ROS workspace
mkdir -p ~/catkin_ws/src cd ~/catkin_ws/src ln -s ~/drone_project/drone_control . cd ~/catkin_ws catkin_make source devel/setup.bash
-
Copy the Modified Iris Model
- Replace your PX4 iris model with the provided
iris.sdf.jinja
:
cp ~/drone_project/modified_px4/Tools/simulation/gazebo-classic/models/iris/iris.sdf.jinja ~/PX4-Autopilot/Tools/simulation/gazebo-classic/models/iris/
- Replace your PX4 iris model with the provided
Open 5 Terminals and follow these steps:
cd ~/PX4-Autopilot
DONT_RUN=1 make px4_sitl_default gazebo-classic_iris
source Tools/simulation/gazebo-classic/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/simulation/gazebo-classic/sitl_gazebo-classic
roslaunch px4 posix_sitl.launch
source ~/catkin_ws/devel/setup.bash
roslaunch mavros px4.launch fcu_url:=udp://:14540@127.0.0.1:14557
Terminal 3: Start Vehicle State Monitor Node
source ~/catkin_ws/devel/setup.bash
rosrun drone_control vehicle_state_monitor.py
Terminal 4: Start Target Tracking Controller Node
source ~/catkin_ws/devel/setup.bash
rosrun drone_control target_tracking_controller.py
Terminal 5: Visualize Processed Image using rqt
rqt
# Then open "Plugins" > "Visualization" > "Image View"
# Select topic: `/processed_image`
This project is intended solely for educational and research purposes.
It is not recommended for real-world surveillance, tracking, or operational use.
If you choose to use it beyond educational settings, you are solely responsible for any outcomes, liabilities, or consequences.