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.
- YOLOv8 integration: Utilize the latest advancements in object detection using the YOLOv8 architecture.
- ROS 2 support: Communicate and control through ROS 2, making it easier to use in robotics applications.
- Real-time detection: Optimized for real-time object detection on robotic platforms.
- Extensible design: Easily customizable for different detection tasks and sensors.
To run this project, you need to have the following installed:
- Python 3.8+
- ROS 2 (Foxy, Galactic, or later)
- PyTorch
- OpenCV
- TensorRT (optional for GPU acceleration)
-
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_pub
Feel free to submit issues, create pull requests, or fork this repository to improve and extend the project.