系统:ubuntu18
ROS版本:melodic
设备:Realsense D455
如何搭建yolov5环境:vslam从入门到如土:ubuntu18环境下配置YOLOv5_bingshuiyuyi的博客-CSDN博客
1.创建ROS工作空间
创建工作空间和编译realsense D455
mkdir -p ~/yolov5_ws/src
cd ~/yolov5_ws/src/
git clone https://github.com/IntelRealSense/realsense-ros.git
git clone https://github.com/pal-robotics/ddynamic_reconfigure.git
cd ~/yolov5_ws
catkin_make clean
catkin_make -DCATKIN_ENABLE_TESTING=False -DCMAKE_BUILD_TYPE=Release
catkin_make install
2.下载代码并配置好yolo_ros:
地址:https://github.com/qianmin/yolov5_ROS
cd yolov5_ws/src
git clone https://github.com/qianmin/yolov5_ROS.git
cd ~/yolov5_ws
catkin_make
修改final_yolo.py
在yolov5_ws/src/yolov5_ROS/ros_yolo_scripts
image_topic_1 = "/usb_cam/image_raw" 改成 image_topic_1 = "/camera/color/image_raw"
sys.path.remove('/opt/ros/kinetic/lib/python2.7/dist-packages') 改成sys.path.remove('/opt/ros/melodic/lib/python2.7/dist-packages')
3.运行:
#新terminal
roscore
#新terminal
roslaunch realsense2_camera rs_rgbd.launch
#新terminal
conda activate yolov5
rosrun ros_yolo final_yolo.py