This repository contains the implementation of YOLOv8 integrated with ROS 2 (Robot Operating System 2) for real-time object detection. YOLOv8 is the version of the “You Only Look Once” (YOLO) family of models, designed for efficient and accurate object detection.
To run this project, you need to have the following installed:
Clone this repository to your local machine:
git clone https://github.com/enginksz/YOLOV8_ROS2.git
cd yolov8_ros2
Install dependencies:
pip install ultralytics
sudo apt install gazebo
sudo apt install python3-colcon-common-extensions
sudo apt install ros-foxy-gazebo-ros
Ensure that ROS 2 is properly installed and sourced on your machine.
Colcon build:
cd yolov8_ros2
colcon build
source yolov8_ros2/install/setup.bash
Launch ROS 2 nodes:
ros2 launch yolov8_gazebo yolov8_ros2_launch.py
Open a second terminal for recognition:
ros2 launch yolov8_ros2_recognition launch_yolov8.launch.py
Start detection by publishing images to the corresponding ROS 2 topic.
/rgb_cam/image_raw: Input image topic for object detection./inference_result_cv2: Output topic img_pub/inference_result: Output topic img_pub/Yolov8_Inference: Output topic yolov8_pubFeel free to submit issues, create pull requests, or fork this repository to improve and extend the project.