ROS with yolov4

 

ROS環境配置

基礎需求

  • boost (C++ lib)
    • sudo apt install libboost-all-dev
    • https://stackoverflow.com/questions/12578499/how-to-install-boost-on-ubuntu
  • apt裝opencv
  • 基本上與darknet需求同

Install ROS

==http://wiki.ros.org/cn/melodic/Installation==

安裝步驟說明:

http://wiki.ros.org/Installation/Ubuntu https://ithelp.ithome.com.tw/articles/10202378

設置安裝權限

https://sychaichangkun.gitbooks.io/ros-tutorial-icourse163/content/chapter1/1.4.html 不使用GUI: ==https://linuxconfig.org/how-to-enable-disable-universe-multiverse-and-restricted-repository-on-ubuntu-20-04-lts-focal-fossa==


ROS + yolov4

使用的專案:

https://github.com/tom13133/darknet_ros/tree/yolov4 ==https://medium.com/@zero000.ece07g/%E5%9C%A8ros%E4%B8%8A%E6%B8%AC%E8%A9%A6yolo-v4-18a6aa6ba681==

安裝教學:

==https://blog.csdn.net/lzy6041/article/details/108056283==

先創一個資料夾當workspace

http://wiki.ros.org/catkin/Tutorials/create_a_workspace mkdir參數:-p 確保目錄名稱存在,不存在的就建一個 若不加 -p,且原本子目錄不存在,則產生錯誤

mkdir -p <隨便資料夾名稱>/src
cd <隨便資料夾名稱>/src
catkin_init_workspace

原本的指令: git clone --recursive https://github.com/tom13133/darknet_ros.git

我們要改成: 抓這分支https://github.com/tom13133/darknet_ros/tree/yolov4 但不要用它裡面的darknet folder, 改用我們自己編譯好的

補充git recursive

https://zlargon.gitbooks.io/git-tutorial/content/advanced/submodule.html

補充git clone branch

https://www.freecodecamp.org/news/git-clone-branch-how-to-clone-a-specific-branch/ git clone -b yolov4 --single-branch https://github.com/tom13133/darknet_ros.git

編譯

https://www.cnblogs.com/jessica-jie/p/6520061.html 雖然<隨便資料夾名稱>裡面只有src資料夾, 但還是可以編譯

# 路徑維持在<隨便資料夾名稱>
catkin_make -DCMAKE_BUILD_TYPE=Release

yolo v4 weight要下載到src/darknet_ros/darknet_ros/yolo_network_config/weights

相機使用

uvc_cammera or usb_cam https://www.ncnynl.com/archives/201703/1437.html

/dev下應該會有cammera

修改launch, src/darknet_ros/launch/darknet_ros.launch 修正影像路徑

<node name="republish" type="republish" pkg="image_transport" output="screen" args="compressed in:=/zed/right/image_raw_color raw out:=/camera/rgb/image_raw" />

RGBD相机


測試

如果相機有launch file記得啟動

# 回到 <隨便資料夾名稱>
source devel/setup.bash 
roslaunch darknet_ros yolo_v4.launch
rosbag play test.bag --clock