Stop Sign Detection - Simulation | Stop Sign Detection - TurtleBot3 | Stop Sign Detection - Remote PC |
Note: The above demonstrations use this repository for controlling TurtleBot3 to obey the stop sign.
- Make a directory
ROS2_WS
to act as your ROS 2 workspace.$ mkdir -p ~/ROS2_WS/src/
- Clone this repository:
$ git clone https://github.com/Tinker-Twins/YOLO-ROS-2.git
- Install
OpenCV
(or build from source).$ sudo apt update $ sudo apt install libopencv-dev python3-opencv
- Build the ROS packages (build in
Release
mode to maximize performance).$ cd ~/ROS2_WS $ colcon build --cmake-args -DCMAKE_BUILD_TYPE=Release
- Source the
setup.bash
file of yourROS2_WS
.$ echo "source ~/ROS2_WS/install/setup.bash" >> ~/.bashrc $ source ~/.bashrc
$ ros2 launch darknet_ros darknet_ros.launch.py
- Installation configuration can be managed from
CMakeLists.txt
.darknet_ros/darknet_ros/darknet/CMakeLists.txt
# CUDA/cuDNN Settings option(ENABLE_CUDA "Enable CUDA support" OFF) option(ENABLE_CUDNN "Enable CUDNN" OFF) option(ENABLE_CUDNN_HALF "Enable CUDNN Half precision" OFF)
darknet_ros/darknet_ros/darknet_ros/CMakeLists.txt
# CUDA/cuDNN Settings set(CUDA_ENABLE OFF) set(CUDNN_ENABLE OFF) set(FP16_ENABLE OFF) # YOLO Pre-Trained Model (Weights) Settings set(DOWNLOAD_YOLOV2_TINY OFF) set(DOWNLOAD_YOLOV3 OFF) set(DOWNLOAD_YOLOV4 OFF) set(DOWNLOAD_YOLOV4_CSP ON) set(DOWNLOAD_YOLOV4_TINY ON) set(DOWNLOAD_YOLOV4_MISH OFF) set(DOWNLOAD_YOLOV7_TINY ON)
- Names and other parameters of the publishers, subscribers and actions can be modified from
darknet_ros/config/ros.yaml
. - Parameters related to YOLO object detection algorithm can be modified from
darknet_ros/darknet_ros/darknet_ros/config/yolo.yaml
. - It is recommended to create a copy of the existing configuration file(s) as a template and do necessary modifications.
- Reference the updated configuration file(s) in
darknet_ros/darknet_ros/darknet_ros/launch/darknet_ros.launch.py
.